Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Visualization API font color

I created a simple ColumnChart. Is there a way to change the font color globally (through options)?

I would like to change the color of the X and Y axis text. I was able to change the font, the background color, etc. but not the font color.

This is what I have so far:

var options = {
    backgroundColor: '#f1f1f1',
    fontName: 'Segoe UI'
};

chart.draw(data, options);

Thanks in advance.

like image 485
MrUpsidown Avatar asked Feb 25 '14 16:02

MrUpsidown


1 Answers

There is no global font style option. You have to set the styles on each element separately:

chart.draw(data, {
    titleTextStyle: {
        color: 'red'
    },
    hAxis: {
        textStyle: {
            color: 'red'
        },
        titleTextStyle: {
            color: 'red'
        }
    },
    vAxis: {
        textStyle: {
            color: 'red'
        },
        titleTextStyle: {
            color: 'red'
        }
    },
    legend: {
        textStyle: {
            color: 'red'
        }
    }
});

If you wish to, you can make a feature request to add support for a global font style.

like image 53
asgallant Avatar answered Sep 20 '22 04:09

asgallant