我现在也在寻找一种方法来禁用我的谷歌折线图中单个列的工具提示。上面的答案并不遥远,但我想它并不完全清楚。
没有办法为单个列“禁用”工具提示,但是您可以禁用单个列的交互性,据我所知,这会导致相同的所需行为。为此,只需使用图表选项中的系列:
series :{
0:{
enableInteractivity: false,
tooltip: 'none'}
}
或者更长的例子:
var options = {
tooltip: {isHtml: true},
legend: 'none',
chartArea: {
width: 500,
},
lineWidth: 2,
series: {
0: { }, // Output
1: { enableInteractivity: false, tooltip: 'none', lineDashStyle: [2, 2] },
2: { enableInteractivity: false, tooltip: 'none' },
},
colors: ['#6f9654', '#1c91c0', '#7F3F98'],
};
var chart = new google.visualization.LineChart(document.getElementById('myChart'));
chart.draw(dataTable, options);
我在这里找到了答案:https://groups.google.com/forum/#!topic/google-visualization-api/ZADPolRZtxM
这对我有用。我有一个包含 3 列(图表中的 3 行)的折线图,我能够使用这种技术“禁用”其中 2 列的工具提示。