如何在Google API图表的线图中增加注释字体大小和大胆的注释值



我正在使用带注释的Google API线图。如何更改字体大小和字体格式?

<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>

尝试此

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

相关内容

  • 没有找到相关文章

最新更新