目前,下面的代码显示了附加的条形图,其刻度包含小数并从 2 开始。
我的问题是:有没有办法从 0 开始 y 轴标签,并将整数增加到数据的最大值?例如,0,1,2,3,4,5?
barData = this.getIntent().getExtras().getString("GraphData");
GraphViewSeries barGraphSeries = new GraphViewSeries(
new GraphViewData[] {
new GraphViewData(0, Integer.parseInt(barData
.substring(0, barData.indexOf(",")))),
new GraphViewData(1, Integer.parseInt(barData
.substring(barData.indexOf(",") + 1,
barData.length()))) });
GraphView statGraphView = new BarGraphView(this,
"Current Stat Graph");
statGraphView.getGraphViewStyle().setGridColor(Color.BLACK);
statGraphView.getGraphViewStyle().setHorizontalLabelsColor(
Color.BLACK);
statGraphView.getGraphViewStyle().setVerticalLabelsColor(
Color.BLACK);
String[] horLabels = { "Correct", "Incorrect" };
statGraphView.setHorizontalLabels(horLabels);
statGraphView.getGraphViewStyle().setNumHorizontalLabels(2);
statGraphView.getGraphViewStyle().setNumVerticalLabels(10);
statGraphView.addSeries(barGraphSeries);
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(statGraphView);