如何更改Google Chart Tooltip的字体大小

时间:2017-02-22 15:55:47

标签: javascript jquery charts google-visualization tooltip

如何更改Google Chart Tooltip的字体大小? [这是我到目前为止所尝试的:https://jsfiddle.net/Albion87/ujpv8oep/3/] 这些是我拥有的设置选项..

// Set chart options
var options = {
    isStacked: true,
    tooltip: { textStyle: { fontName: 'verdana', fontSize: 7 } },       
    width: 800,
    height: 600,
    chart: {
        title: 'Year-by-year coffee consumption',
        subtitle: 'This data is not real'
    },      
    vAxis: {
        viewWindow: {
            min: 0,
            max: 100
        }
    },
    legend: { position: 'left', alignment: 'start' },
    series: {
        2: {
            targetAxisIndex: 1
        },
        3: {
            targetAxisIndex: 1
        }
    },
    backgroundColor: {fill: 'transparent'},
    chartArea: {
      backgroundColor: 'transparent'
    }
};

enter image description here

1 个答案:

答案 0 :(得分:0)

问题是材料图表......

有几个选项根本不适用于材料图表,
包括......

tooltip.isHtml
tooltip.showColorCode
tooltip.textStyle
tooltip.trigger

参见 - > http://django-adminactions.readthedocs.io/en/latest/install.html

建议使用以下选项尝试核心图表...

theme: 'material'

材料图表 - > google.charts.Bar - packages: ['bar']

核心图表 - > google.visualization.ColumnChart - packages: ['corechart']