谷歌图表工具提示-注释

Google Charts Tooltips-Annotations

本文关键字:注释 工具提示 谷歌      更新时间:2023-09-26

我的谷歌图表将有3-4个数据系列,当用户将鼠标放在图表上时,我希望工具提示同时显示工具提示中的每个系列数据点,包括日期(轴)。

有谁知道我如何用上面描述的方式添加工具提示吗?

     var data = google.visualization.arrayToDataTable([
          ['Year', 'Data1', 'Data2', 'Data3'],
          [new Date(2001, 01, 01), 30, 20, 1000],
          [new Date(2002, 01, 01), 70, 20, 1000],
...
var options = {
          colors: ['#ffffff', '#ffffff', '#ffffff'],
          hAxis: {
            slantedText: true,
            slantedTextAngle: 45,
            gridlines: {
              color: 'f2f2f2'
            }
          },
          vAxis: {
            minValue: 0,
            gridlines: {
              color: 'f2f2f2'
            }
          },
          series: {
            0: {
              type: 'area',
              areaOpacity: 0.25,
              lineWidth: 1.5
            },
            1: {
              type: 'line',
              lineWidth: 1.5
            },
            2: {
              type: 'line',
              lineWidth: 1.5,
              targetAxisIndex: 1
            },
          },

添加以下配置选项…

aggregationTarget: 'category'