Ahmed Faisal
Ahmed Faisal

Reputation: 4427

Android AChartEngine - Unable to change textColor of Y-Axis Labels

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

Upvotes: 6

Views: 5554

Answers (2)

SerSánGal
SerSánGal

Reputation: 467

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

Upvotes: 2

Dan D.
Dan D.

Reputation: 32391

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.

Upvotes: 7

Related Questions