简体   繁体   English

Google图表工具提示-注释

[英]Google Charts Tooltips-Annotations

My google chart will have 3-4 data series, and when the user puts their mouse on the chart I would like the tooltip to show each series data point in the tooltip at the same time including the date (haxis). 我的Google图表将具有3-4个数据系列,并且当用户将鼠标放在图表上时,我希望工具提示同时显示工具提示中的每个系列数据点,包括日期(轴)。

Does anyone know how I might add the tooltips the way I described above? 有谁知道我如何以上述方式添加工具提示?

     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'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM