Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase annotation font size and bold the annotation value in line chart of google api chart?

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>
like image 233
Arunprasath Avatar asked Jan 24 '14 06:01

Arunprasath


1 Answers

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

like image 101
Gopal Avatar answered Sep 20 '22 03:09

Gopal