见下图,试图弄清楚为什么它们会跳过'1','3'等等。
我在哪里设置系列和图表:
DataPoint[] dataPoints = new DataPoint[rankList.size()]; // declare an array of DataPoint objects with the same size as your list
for (int i = 0; i < rankList.size(); i++) {
dataPoints[i] = new DataPoint(i, Double.parseDouble(rankList.get(i))); // not sure but I think the second argument should be of type double
}
BarGraphSeries<DataPoint> series2 = new BarGraphSeries<DataPoint>(dataPoints); // This one should be obvious right? :)
series2.setAnimated(true);
series2.setTitle("Random Curve 1");
series2.setColor(Color.GREEN);
series2.setSpacing(30);
series2.setDataWidth(1);
graph2.getViewport().setMinX(-1);
graph2.getViewport().setMaxX(12);
graph2.addSeries(series2);
正在绘制正确的信息,但我已经尝试了一些来自文档的东西并让它工作。
答案 0 :(得分:1)
抱歉,我误解了你的问题...
这会有所帮助:
yourGraph.getGridLabelRenderer().setNumHorizontalLabels(numberOfBars);
答案 1 :(得分:0)
它实际上显示了所有条形图。您已设置series2.setSpacing(30);
。
取而代之的是series2.setSpacing(0);
。