Google charts change haxis font size
Asked Answered
H

2

24

Does anyone know a way to change the font size of these dates? I want to make them a little smaller so they will all fit instead of skipping one each time..

enter image description here

Harts answered 26/11, 2014 at 18:59 Comment(0)
R
63

Try with:

options:{
    hAxis : { 
        textStyle : {
            fontSize: 7 // or the number you want
        }

    }

}
Raoul answered 26/11, 2014 at 20:58 Comment(3)
Is there any document for other options ? I want to underline and change cursor to pointer.Shenyang
@SunilGarg you mean change cursor in the chart canvas? You can do that with css. You want to underline the text?Raoul
Thanks @juvian. I have done this on ready event of chart #38394472Shenyang
H
6

I fixed this issue using below code:

titleTextStyle -- An object that specifies the title text style. The object has this format:

    var options = {
    title: 'Chart Name ',
    width: '100%',
    height: '100%',
    legend: {
        position: "none"
    },
    hAxis: {
        title: 'Request Status',
        titleTextStyle: {
            color: "#000",
            fontName: "sans-serif",
            fontSize: 11,
            bold: true,
            italic: false
        }
    },
    vAxis: {
        title: 'Amount requested ($)',
        titleTextStyle: {
            color: "#000",
            fontName: "sans-serif",
            fontSize: 11,
            bold: true,
            italic: false
        }
    },
    annotations: {
        alwaysOutside: true,
        textStyle: {
            fontSize: 14,
            auraColor: 'none'
        }
    }
};

More details from Google Chart

Happy coding...

Holcman answered 17/7, 2018 at 9:24 Comment(1)
No percentage or "em" values for fontSize yet, only integer pixel values are supported at the moment in case anyone needed something else.Kc

© 2022 - 2024 — McMap. All rights reserved.