2015-01-08 4 views
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); 

위 그래프와 같이 그래프를 채울 때 배열에 소수점 이하 2 자리까지의 값이 포함되어 있습니다.일식의 GraphView에서 Y 축을 소수 2 자리로 설정할 수 있습니다.

내 앱에서 그래프를 사용할 때 Y 축은 최대 세 자리까지 올라갑니다. 2로 강제 할 수 있습니까?

버전 3.1.3을 사용하고 있습니다. 나는 정말로 업그레이드하고 싶지 않고 많은 코드를 변경해야한다.

어떻게 DefaultLabelFormatter를 사용합니까? - 죄송합니다. 새 소식으로 덧글을 추가 할 수 없습니다!

+0

'DefaultLabelFormatter (xAxisNumberFormatter, yAxisNumberFormatter)'를 사용해 보셨습니까? –

+0

GraphView 3.x의 예제는 https://github.com/jjoe64/GraphView-Demos/tree/3.x – appsthatmatter

답변

0

나는 그때

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

이제 내 배열에서 데이터를 추가하는 방법에 붙어 사용할 수 있습니다 버전 4로 업그레이드해야했다!

+0

에서 계속 사용할 수 있습니다. 설명서와 GraphView-Demos 프로젝트를 살펴 봐야합니다. http://www.android-graphview.org/documentation/how-to-create-a-simple-graph – appsthatmatter