2017-02-13 70 views
1

我正在使用GraphView庫在我的android應用程序上創建圖形,並且我的水平(X)軸標籤出現問題。 正如你所看到的here軸上的數字標籤有問題,數字互相盤旋,我願意使用填充來避免這種情況。GraphView橫軸標籤填充

雖然經過長時間的在線調查,我還沒有找到答案。

這裏是我的圖設計代碼:

GraphView graph = (GraphView) findViewById(R.id.graph); 
    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(getDataPoint()); 
    GridLabelRenderer gridLabel = graph.getGridLabelRenderer(); 
    gridLabel.setHumanRounding(true); 
    gridLabel.setNumHorizontalLabels(this.numberAxis); 
    gridLabel.setHorizontalAxisTitle(getApplicationContext().getString(R.string.updates)); 
    gridLabel.setLabelHorizontalHeight(50); 
    gridLabel.setVerticalAxisTitle(getApplicationContext().getString(R.string.weight)); 
    graph.addSeries(series); 

我怎樣才能避免相互橫軸標籤的徘徊?

+0

沒有足夠的空間,所以您應該通過'setNumHorizo​​ntalLabels(5)'減少水平標籤的數量 – appsthatmatter

回答

0

嘗試添加

graph.getViewport()。setScrollable(true);

您正試圖添加大量1屏幕可以處理的數字。