0

Pretty basic question : how to change the color of the y-axis values in a line chart. I need the background of the chart to be a specific color, with the y-axis values being white.

enter image description here

I need the values of the y-axis to be white, instead of black.

Thanks a lot for your time.

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51

3 Answers3

6

Get YAxis of your chart object and set Text Color.

mChart.getYAxis().setTextColor(getResources().getColor(R.color.your_color));

if you want to change axisline color, you can use below method.

mChart.getYAxis().setAxisLineColor(getResources().getColor(R.color.yourcolor));
rafa
  • 1,319
  • 8
  • 20
5

in the new version the library changed so it can be

mpLineChart.getAxisLeft().setTextColor(getResources().getColor(R.color.white));
mpLineChart.getAxisLeft().setAxisLineColor(getResources().getColor(R.color.white));
Waged
  • 372
  • 3
  • 14
0

And in the new, new version:

mpLineChart.getAxisLeft().setTextColor(ContextCompat.getColor(this, R.color.white));
mpLineChart.getAxisLeft().setAxisLineColor(ContextCompat.getColor(this,R.color.white));
jlsogorb
  • 45
  • 1
  • 5