Reputation: 117
I use the following code to set the size of my graph area. I have done some searching but I haven't found a way to add this in the XML.
// Set size of graph area (not plot area)
final Size sm = new Size(900, SizeLayoutType.ABSOLUTE, 900, SizeLayoutType.ABSOLUTE);
myPositionLines.getGraphWidget().setSize(sm);
How can I do this in the XML file as per the legend i.e. something like this:
ap:legendHeight="40dp"
Thanks
Upvotes: 1
Views: 443
Reputation: 8317
(Updated) As of Androidplot v0.9.7 there are now styleable attrs for controlling the size and positioning of the graph widget from XML.
Keep in mind though that because the graph is a widget component, the sizing / positioning conventions follow those of all other Androidplot widgets. Check out the "x/y positioning widgets" and "sizing widgets" sections of this doc for info on how that works.
Here are the xml attrs currently available:
<attr name="graphHeightSizeLayoutType"/>
<attr name="graphWidthSizeLayoutType"/>
<attr name="graphHeight" format="dimension|float|integer"/>
<attr name="graphWidth" format="dimension|float|integer"/>
<attr name="graphLayoutStyleX"/>
<attr name="graphLayoutStyleY"/>
<attr name="graphPositionX" format="dimension|float|integer"/>
<attr name="graphPositionY" format="dimension|float|integer"/>
<attr name="graphAnchorPosition"/>
So for example, adding the following to your plot's xml element would give your graph a width of 300dp:
ap:graphWidthSizeLayoutType="absolute"
ap:graphWidth="300dp"
Upvotes: 1