【问题标题】:Android AChartEngine - Unable to change textColor of Y-Axis LabelsAndroid AChartEngine - 无法更改 Y 轴标签的 textColor
【发布时间】:2012-08-10 00:25:18
【问题描述】:

在为 Android 使用 AChartEngine (JAR 1.0.0) 时,我看到了一种允许我更改 X 轴文本颜色的方法 (mRenderer.setXLabelsColor(Color.BLACK))

很遗憾,我找不到 Y 轴标签的相应方法!

还有没有办法设置实际折线图的颜色?

我还尝试使用

将标签对齐到 Y 轴的左侧
mRenderer.setYAxisAlign(Align.LEFT, 0);   
mRenderer.setYLabelsAlign(Align.LEFT, 0);  

但它似乎确实起作用。

【问题讨论】:

    标签: android achartengine linechart


    【解决方案1】:

    renderer.setYLabelsColor();用于设置Y轴标签颜色。

    当你使用 Align.LEFT 时,表示它们是左对齐的,如果你想在轴的左侧右对齐,使用Align.RIGHT

    折线图颜色是来自其自己的渲染器的颜色。

    【讨论】:

    • 感谢您的回答丹!你帮了大忙。
    【解决方案2】:

    要正确对齐和设置颜色,您需要如下所示:

    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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多