2012-08-10 91 views
6

在使用AChartEngine(JAR 1.0.0)爲Android,我看到了一種方法,可以讓我改變文字的顏色爲X軸(mRenderer.setXLabelsColor(Color.BLACK)的Android AChartEngine - 無法更改Y軸的文字顏色標籤

不幸的是我無法找到Y軸標籤的相應方法!

也有一種方法來設置實際線圖的顏色?

我也嘗試過使用

mRenderer.setYAxisAlign(Align.LEFT, 0); 
mRenderer.setYLabelsAlign(Align.LEFT, 0); 

對準標籤Y軸的左邊,但它似乎工作。

enter image description here

回答

7

renderer.setYLabelsColor();用於設定Y軸標籤顏色。

當您使用Align.LEFT時,這意味着它們左對齊,如果要將它們右對齊在軸的左側,請使用Align.RIGHT

線圖顏色是來自其自己的渲染器的顏色。

+0

謝謝您的解答丹!你一直在幫助很大。 – Ahmed 2012-08-10 19:33:39

2

要對準和properlly設置顏色,你需要把它作爲如下:

mRenderer.setYAxisAlign(Align.LEFT, 0); 
mRenderer.setYLabelsAlign(Align.RIGHT, 0); 

// setYLabelsColor method you need include which the 
// int for your YLabel, since this library you can 
// use more than one YLabel, so in your case, 
// you only have one YLabel and its index is 0. 

mRenderer.setYLabelsColor(0, Color.BLACK); 
mRenderer.setXLabelsColor(Color.BLACK);