6

While using AChartEngine (JAR 1.0.0) for Android, I see a method that allows me to change the color of text for X-Axis (mRenderer.setXLabelsColor(Color.BLACK))

Unfortunately I am unable to find a corresponding method for the Y-Axis labels!

Also is there a way to set the color of the actual line graph?

I also tried to align the labels to the left of Y-Axis using

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

but it does seem to function.

enter image description here

Seraphim's
  • 12,559
  • 20
  • 88
  • 129
Ahmed Faisal
  • 4,397
  • 12
  • 45
  • 74

2 Answers2

7

There is renderer.setYLabelsColor(); for setting the Y axis label color.

When you use Align.LEFT, it means they are left aligned, if you want to right align them on the left side of the axis, use Align.RIGHT.

The line graph color is the one from its own renderer.

Seraphim's
  • 12,559
  • 20
  • 88
  • 129
Dan D.
  • 32,246
  • 5
  • 63
  • 79
2

To align and set a color properlly you need put it as follow:

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);
SerSánGal
  • 467
  • 4
  • 15