0
GraphViewData[] data = new GraphViewData[numElements];       
for (int c = 0; c<numElements; c++) {
data[c] = new GraphViewData(c+1, pvalueArray[c]);
}
GraphView graphView = new LineGraphView(this, Captionname);
GraphViewSeries graphViewSeries = new GraphViewSeries(data);

I am populating a graph as above, my array contains values set to 2 decimal places.

When I use the graph on my app, the Y axis goes up to 3 decimal places. Can I force it to be 2?

I am using version 3.1.3. I don't really want to upgrade and have to change loads of code.

How do I use DefaultLabelFormatter? - Sorry I can't add a comment as I'm new!

1 Answers1

0

I have had to upgrade to version 4 then I can use

NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(1);
nf.setMinimumIntegerDigits(2);
graph.getGridLabelRenderer().setLabelFormatter(new DefaultLabelFormatter(nf, nf));

Now stuck on how to add data from my array!!!

  • you should take a look at the documentation and the GraphView-Demos project. http://www.android-graphview.org/documentation/how-to-create-a-simple-graph – appsthatmatter Jan 21 '15 at 15:15