Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 920
Ahmed Avatar asked Aug 10 '12 00:08

Ahmed


Video Answer


2 Answers

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.

like image 54
Dan D. Avatar answered Sep 18 '22 00:09

Dan D.


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);
like image 25
SerSánGal Avatar answered Sep 18 '22 00:09

SerSánGal