Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌图表工具提示_Javascript_Tooltip_Google Visualization - Fatal编程技术网

Javascript 谷歌图表工具提示

Javascript 谷歌图表工具提示,javascript,tooltip,google-visualization,Javascript,Tooltip,Google Visualization,有没有办法让谷歌图表中的工具提示始终可见?正如我在API中所发现的,我只能完全禁用它们 目前在谷歌可视化API中没有这样做的方法 你可以试着看看你是否能找出CSS来让它们正常显示(这是可能的) 或者,您可以编写自己的Javascript,在任何地方显示您想要的内容。不幸的是,我在任何地方都没有看到这样的工作示例。如果您确实找到了解决方案,请在此处共享,并将其标记为答案 var svg = document.getElementById('div_id').getElementsByTagName

有没有办法让谷歌图表中的工具提示始终可见?正如我在API中所发现的,我只能完全禁用它们

目前在谷歌可视化API中没有这样做的方法

你可以试着看看你是否能找出CSS来让它们正常显示(这是可能的)

或者,您可以编写自己的Javascript,在任何地方显示您想要的内容。不幸的是,我在任何地方都没有看到这样的工作示例。如果您确实找到了解决方案,请在此处共享,并将其标记为答案

var svg = document.getElementById('div_id').getElementsByTagName('svg')[0];     
var parent = svg.childNodes[4].firstChild.nextSibling.firstChild.nextSibling.firstChild.parentNode;
for(var i=0; i<svg.childNodes[4].childNodes[1].childNodes[1].childElementCount; i++) {
    var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
    var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');  
    var child = svg.childNodes[4].firstChild.nextSibling.firstChild.nextSibling.firstChild; 
    text.setAttribute('x', child.getAttribute('x'));
    text.setAttribute('y', child.getAttribute('y'));
    text.setAttribute('fill', '#000000');
    text.setAttribute('dy', '-2');      
    text.textContent = 'Hell0'; 
    parent.removeChild(child);
    g.appendChild(child);   
    g.appendChild(text);
    parent.appendChild(g);
}
tooltip: {tigger: 'none'},
enableInteractivity: false,