I am using google api line chart with annotation. How can I change the font size and font format?
<script type="text/javascript">
                google.load("visualization", "1", {packages: ["corechart"]});
                google.setOnLoadCallback(drawChart);
                function drawChart() {
                    var data = new google.visualization.DataTable();
                    data.addColumn('string', '');
                    data.addColumn({type: 'string', role: 'annotation'});
                    data.addColumn('number', '');
                    data.addRows([['2010', '67', 67]]);
                    data.addRows([['2011', '69', 69]]);
                    data.addRows([['2012', '68', 68]]);
                    data.addRows([['2013', '67', 67]]);
                    var options = {
                        width: 350,
                        height: 250,
                        pointSize: 5,                           
                        legend: {position: 'none'},
                        chartArea: {
                            left: 0,
                            top: 60,
                            width: 300,
                            height: 75},
                        vAxis: {
                            baselineColor: '#fff',
                            gridlines: {color: '#fff'},
                            minValue: 64,
                            maxValue: 71
                        },
                        tooltip: {trigger: 'none'},
                        enableInteractivity: false,
                        annotation: {
                            1: {
                                style: 'default'
                            }
                        },
                        series: {0: {color: '#4D7AD3'}, 1: {color: '#4D7AD3'}}
                    };
                    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
                    chart.draw(data, options);
                }
            </script>
<body>                
    <h2>Line Charts</h2>
    <div id="chart_div"></div>
</body>
Try this
var options = {
annotations: {
  textStyle: {
  fontName: 'Times-Roman',
  fontSize: 18,
  bold: true,
  italic: true,
  color: '#871b47',     // The color of the text.
  auraColor: '#d799ae', // The color of the text outline.
  opacity: 0.8          // The transparency of the text.
}
}
};
https://developers.google.com/chart/interactive/docs/gallery/linechart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With