Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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_Google Visualization - Fatal编程技术网

Javascript 删除谷歌图表中的突出显示条

Javascript 删除谷歌图表中的突出显示条,javascript,google-visualization,Javascript,Google Visualization,我有一个工作谷歌组合图。现在,当我将鼠标悬停在图例中的某个项目上时,我想删除特定时刻的突出显示。我使用了“enableInteractivity”选项,但这也删除了工具提示之类的内容 我当然想保留工具提示。我在网上似乎找不到任何关于这是怎么可能的。我知道我只能禁用工具提示,但无法禁用此高亮显示的方法(我想要的) 有人知道我如何做到这一点吗 提前谢谢 没有内置的方法来执行此操作。突出显示被绘制到SVG中,工具提示也由google internal charts API代码绘制。因此,要么您必须找到

我有一个工作谷歌组合图。现在,当我将鼠标悬停在图例中的某个项目上时,我想删除特定时刻的突出显示。我使用了“enableInteractivity”选项,但这也删除了工具提示之类的内容

我当然想保留工具提示。我在网上似乎找不到任何关于这是怎么可能的。我知道我只能禁用工具提示,但无法禁用此高亮显示的方法(我想要的)

有人知道我如何做到这一点吗


提前谢谢

没有内置的方法来执行此操作。突出显示被绘制到SVG中,工具提示也由google internal charts API代码绘制。因此,要么您必须找到一种方法来阻止高亮显示被绘制到SVG中(同时仍然允许工具提示),要么禁用交互性并实现您自己的工具提示,就像这样。以下引述的答覆:

我最终制作了一个自定义工具提示弹出窗口,效果非常好 嗯

假设气泡图的div定义如下:

<div id="bubble_chart_div"></div>

然后我使用了下面的JavaScript。请注意,我遗漏了这个 关于如何设置google图表数据和加载 谷歌图表软件包。这段代码只显示了如何获得自定义 toolip弹出窗口

    var mouseX;
    var mouseY;
    $(document).mousemove( function(e) {
        mouseX = e.pageX; 
        mouseY = e.pageY;
    });

    /*
     *
     *instantiate and render the chart to the screen
     *
     */
    var bubble_chart = new google.visualization.BubbleChart(document.getElementById('bubble_chart_div'));
    bubble_chart.draw(customer_product_grid_data_table, options);

    /*
     * These functions handle the custom tooltip display
     */
    function handler1(e){
        var x = mouseX;
        var y = mouseY - 130;
        var a = 1;
        var b = 2;
        $('#custom_tooltip').html('<div>Value of A is'+a+' and value of B is'+b+'</div>').css({'top':y,'left':x}).fadeIn('slow');
    }
    function handler2(e){
        $('#custom_tooltip').fadeOut('fast');
    }

    /*
     *  Attach the functions that handle the tool-tip pop-up
     *  handler1 is called when the mouse moves into the bubble, and handler 2 is called when mouse moves out of bubble
     */
    google.visualization.events.addListener(bubble_chart, 'onmouseover', handler1);
    google.visualization.events.addListener(bubble_chart, 'onmouseout', handler2);
var-mouseX;
var mouseY;
$(文档).mousemove(函数(e){
mouseX=e.pageX;
mouseY=e.pageY;
});
/*
*
*实例化图表并将其呈现到屏幕上
*
*/
var bubble\u chart=new google.visualization.BubbleChart(document.getElementById('bubble\u chart\u div');
绘制气泡图(客户、产品、网格、数据表、选项);
/*
*这些函数处理自定义工具提示显示
*/
功能手柄1(e){
var x=鼠标;
变量y=mouseY-130;
var a=1;
var b=2;
$(“#自定义工具提示”).html('A的值为“+A+”,B的值为“+B+”).css({'top':y,'left':x}).fadeIn('slow');
}
功能手柄2(e){
$(“#自定义工具提示”).fadeOut('fast');
}
/*
*附加处理工具提示弹出窗口的功能
*当鼠标移动到气泡中时调用handler1,当鼠标移出气泡时调用Handler2
*/
google.visualization.events.addListener(气泡图,'onmouseover',handler1);
google.visualization.events.addListener(气泡图,'onmouseout',handler2);
接下来,您可以通过应用此css样式来消除悬停时的灰色轮廓高亮显示

#mychart svg g g g g rect {
    stroke-width:0px;
}

一个定制的将是真正的解决方案。在本例中,我创建了一个自定义图例,因为我拥有工具提示的所有代码。我只需要删除自动图例并创建一个自定义。。谢谢,事情终于解决了。谢谢你的反馈!如果您共享自定义代码,它可能会帮助未来的用户(和我自己)。当然,如果你不能/不想分享,不要觉得有义务。