Javascript 从 Google Visualization 饼图(核心图表)中删除悬停工具提示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8223145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove hover tooltip from Google Visualization pie chart (core chart)
提问by Shumon Saha
How to remove hover tooltip from Google Visualization pie chart (core chart)? Need to make it work cross-browser, eg, IE, FF, Chrome, Safari, Opera
如何从 Google Visualization 饼图(核心图表)中删除悬停工具提示?需要使其跨浏览器工作,例如 IE、FF、Chrome、Safari、Opera
Edit: I need the slices to be be clickable too.enableInteractivity : false
removes the hovers but doens't throw 'select' or other interaction-based events.
编辑:我需要切片也可以点击。enableInteractivity : false
删除悬停但不抛出“选择”或其他基于交互的事件。
回答by Sir_Faenor
Maybe you need to add this to your chart's options
也许您需要将此添加到图表的选项中
'tooltip' : {
trigger: 'none'
}
In this way you can leave enableInteractivity set to true.
通过这种方式,您可以将 enableInteractivity 设置为 true。
回答by Nix
Use the enableInteractivity = Falseoption. It will disable interaction and hover.
使用enableInteractivity = False选项。它将禁用交互和悬停。
chart.draw(data, {
width: 400,
height: 240,
title: 'Your chart and data',
enableInteractivity: false,
hAxis: {title: 'Year'}
});
回答by zsimo
This remove hover event but maintains the click event:
此删除悬停事件但保持点击事件:
tooltip: { trigger: 'selection' }
回答by Dasun
set tooltip: { isHtml: true } in option section.
在选项部分设置工具提示:{ isHtml: true }。
chart.draw(data, {
tooltip: { isHtml: true },
width: 400,
height: 240,
title: 'Title',
hAxis: {title: 'Year'}
});
in css file
在 css 文件中
div.google-visualization-tooltip { display:none }