Skip to content

Commit 02ef341

Browse files
committed
minor tweaks to widget example
1 parent b60683f commit 02ef341

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

demoapp/src/main/java/com/androidplot/demos/widget/DemoAppWidgetProvider.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import android.widget.RemoteViews;
2626
import com.androidplot.demos.R;
2727
import com.androidplot.ui.*;
28+
import com.androidplot.util.PixelUtils;
29+
import com.androidplot.xy.XYGraphWidget;
2830
import com.androidplot.xy.XYSeries;
2931
import com.androidplot.xy.LineAndPointFormatter;
3032
import com.androidplot.xy.SimpleXYSeries;
@@ -43,10 +45,6 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
4345

4446
plot.getGraph().setMargins(0, 0, 0 , 0);
4547
plot.getGraph().setPadding(0, 0, 0, 0);
46-
// plot.getGraphWidget().getDomainLineLabelPaint().setTextSize(PixelUtils.spToPix(10));
47-
// plot.getGraphWidget().getRangeLineLabelPaint().setTextSize(PixelUtils.spToPix(10));
48-
// plot.getGraphWidget().getDomainOriginLineLabelPaint().setTextSize(PixelUtils.spToPix(10));
49-
// plot.getGraphWidget().getRangeOriginLineLabelPaint().setTextSize(PixelUtils.spToPix(10));
5048

5149
plot.getGraph().position(0, HorizontalPositioning.ABSOLUTE_FROM_LEFT, 0,
5250
VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.LEFT_TOP);
@@ -55,6 +53,15 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
5553

5654
plot.getLayoutManager().moveToTop(plot.getTitle());
5755

56+
plot.getGraph().setLineLabelEdges(XYGraphWidget.Edge.LEFT, XYGraphWidget.Edge.BOTTOM);
57+
plot.getGraph().getLineLabelInsets().setLeft(PixelUtils.dpToPix(16));
58+
plot.getGraph().getLineLabelInsets().setBottom(PixelUtils.dpToPix(4));
59+
plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.LEFT).getPaint().setColor(Color.RED);
60+
plot.getGraph().getGridInsets().setTop(PixelUtils.dpToPix(12));
61+
plot.getGraph().getGridInsets().setRight(PixelUtils.dpToPix(12));
62+
plot.getGraph().getGridInsets().setLeft(PixelUtils.dpToPix(36));
63+
plot.getGraph().getGridInsets().setBottom(PixelUtils.dpToPix(16));
64+
5865
plot.measure(w, h);
5966
plot.layout(0, 0, w, h);
6067

0 commit comments

Comments
 (0)