Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Color for X-axis lables #319

Closed
rutvijkumarshah opened this issue Jan 24, 2015 · 14 comments
Closed

Text Color for X-axis lables #319

rutvijkumarshah opened this issue Jan 24, 2015 · 14 comments

Comments

@rutvijkumarshah
Copy link

@PhilJay Thanks for this awesome library.

I could not find a way to change color of x-axis lables. I was able to change text color of y axis values using
mChart.setValueTextColor(getResources().getColor(android.R.color.white));

But this changes text color of only y-axis values in Bar Chart.

@rutvijkumarshah
Copy link
Author

Closing this issue. There is a way to set text color for XLables using following code :
XLabels labels = mChart.getXLabels();
labels.setTextColor(getResources().getColor(android.R.color.white));

@surfer190
Copy link

@rutvijkumarshah I'm not finding .getXLabels()

Is this on an older version?

@rutvijkumarshah
Copy link
Author

@surfer190 , yeah its with old version, I filed the issue one year ago.

@Rohittt728
Copy link

Rohittt728 commented Jan 13, 2017

@rutvijkumarshah It isn't working. then how to set color for x-axis Labels for Pie-Chart ?

@vishalsgithub
Copy link

vishalsgithub commented Feb 16, 2017

Try it.

Chart.getXAxis().setTextColor(Color.Blue);

OR

XAxis xLabels = Chart.getXAxis();
xLabels.setTextColor(Color.Blue);

@AlexandrSushkov
Copy link

AlexandrSushkov commented Feb 20, 2017

getXAxis() - deprecated, and throws RuntimeException("PieChart has no XAxis"). What is the new way to change x-axis text color?

@vishalsgithub
Copy link

if you want to change the text color of lables
try it..

mChart.setEntryLabelColor(Color.BLUE);

or if you want to change value color try it..

PieData data = new PieData(dataSet);
data.setValueTextColor(Color.RED);

i hope it works..

@AlexandrSushkov
Copy link

Thanks! It helped me, and saved a lot of time.

@goodlifechris
Copy link

legend will do

@goodlifechris
Copy link

    pieChart.getLegend().setTextColor(Color.WHITE);

@MasonDarcy
Copy link

I have this issue now on a linechart, the text color of my x-labels changes to a dark purple but will not change to any other color.

@babbar01
Copy link

I have this issue now on a linechart, the text color of my x-labels changes to a dark purple but will not change to any other color.

I know its a late reply but surely it will help others as it is common mistake
Use below line for that

ContextCompat.getColor(context, R.color.red_color)

The mistake is that you are providing the id of color ( by giving only R.color.some_color) not the actual color

@anshul2502
Copy link

is it possible to give multiple colours to labels in pie chart? like this:
frnWb

@saldous
Copy link

saldous commented Apr 29, 2022

is it possible to give multiple colours to labels in pie chart? like this: frnWb

I would also love to be able to have each label with a different color, to match the color of the bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants