2016-11-30 126 views
0

請看下圖,試圖弄清楚它爲什麼跳過'1','3'等等。Graphview不顯示所有的x軸值

Bar Graph Example

我在哪裏設置的系列和圖:

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

安置自己的代碼.. – Rahil2952

+0

更新,我的道歉。 – AndroidDev21921

回答

0

它實際上顯示所有酒吧。你已經設置了series2.setSpacing(30);。 而不是series2.setSpacing(0);

0

對不起,我誤解你的問題...

這將幫助:

yourGraph.getGridLabelRenderer().setNumHorizontalLabels(numberOfBars);