How Do I Remove All Space Around A Chart In Androidplot?
Solution 1:
The Plot itself (mDynamicPlot in your example) is essentially a collection of widgets positioned in a shared space. The actual class that handles the positioning is LayoutManager.
In addition to positioning, the size of the Widget will also need to be adjusted to fill the entire Plot. Each Widget keeps track of its own size using an instance of SizeMetrics. You can modify the size of any Widget by invoking setSize(SizeMetrics newInstance); The "chart" area you are interested in corresponds to the XYGraphWidget.
I have not personally tested this but I believe the code below should do what you want:
// get a handle to the XYGraphWidget:
Widgetgw= mDynamicPlot.getGraphWidget();
// FILL mode with values of 0 means fill 100% of container:SizeMetricssm=newSizeMetrics(0,SizeLayoutType.FILL,
0,SizeLayoutType.FILL));
gw.setSize(sm);
// get a handle to the layout manager:LayoutManagerlm= mDynamicPlot.getLayoutManager();
// position the upper left corner of gw in the upper left corner of the space // controlled by lm.
lm.position(gw, 0, XLayoutStyle.ABSOLUTE_FROM_LEFT,
0, YLayoutStyle.ABSOLUTE_FROM_TOP);
Solution 2:
SizeMetrics is no Longer used to set the size, instead Size is used with the same Constructor as SizeMetrics and the same way to use. new Call looks like this.
Widgetgw= mPlot.getGraph();
Sizesize=newSize(0,SizeMode.FILL,0,SizeMode.FILL);
gw.setSize(size);
gw.position(0, HorizontalPositioning.ABSOLUTE_FROM_LEFT,0, VerticalPositioning.ABSOLUTE_FROM_TOP);
Post a Comment for "How Do I Remove All Space Around A Chart In Androidplot?"