Google charts - change axis text color

LcSalazar picture LcSalazar · Oct 16, 2014 · Viewed 24.9k times · Source

I'm trying to create a black chart with Google Charts, but I can't seem to change the text color of the axis. I tried some code pieces I found on the web, like:

hAxis: {
  color: '#FFF'
}

But it just doesn't work. I've managed to change the title and legend color, but not the axis text. I'm trying to set the axis text color to white, to contrast with the backgroud:

Answer

juvian picture juvian · Oct 16, 2014

Correct usage for hAxis is using the textStyle options, in which you want the color:

hAxis: {
    textStyle:{color: '#FFF'}
}

I would also recommend using google.setOnLoadCallback(drawChart); function for rendering the chart instead of timeout, at least for me 100 milliseconds was not enough