问题
I create a simple xyseries with a boundary and set the mode to AUTO.
The range of values I set is between 103 and 107. I am getting constant updates between these values and can I redraw the plot when it goes over size=20.
The Y axis seems to only take two digits and not the entre number. This is the code.
plot.setRangeBoundaries(0, 200.0, BoundaryMode.AUTO);
plot.setDomainBoundaries(0, 20, BoundaryMode.AUTO);
In the graph I am seeing the following on the Y axis and X axis with the dynamic graph. The Y axis should start from 103.0 to 107.0 but seems they are getting truncated.
07.0
05.7
04.3
03.0
0.0 2.2 4.4 6.7 8.9 11.1 13.3 15.6 17.8 20.0
My question is:
1. Y axis value is truncated on the first digit. They should be 103.0 to 107.0 but they are 03.0 to 07.0.
2. Is there a way to set the Y axis to a whole number?
回答1:
The missing digit(s) are most likely getting clipped by the graphWidget's margin. Try giving it more room by adding this to your XYPlot's xml config:
androidPlot.graphWidget.marginLeft="30dp"
As far as setting the Y axis to a whole number - sure you can. This doc explains what's going on. What you're probably wanting to do can be accomplished by adding this to your Activity's onCreate() method:
plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1);
来源:https://stackoverflow.com/questions/23964945/range-field-in-android-plot-0-6-1-is-not-showing-the-entire-number