【问题标题】:How to hide the tooltip in dimplejs?如何在dimplejs中隐藏工具提示?
【发布时间】:2019-01-17 00:31:16
【问题描述】:

我使用了 dimple._showPointTooltip 来显​​示我的工具提示。在 mouseout 或 mouseleave 中,我想隐藏它。我应该使用哪个命令来执行此操作?

这个展示中有很多组件。

用于显示工具提示的命令:

myChart.draw();
mySeries.shapes.on("click", function (e) {
    dimple._showPointTooltip(e, this, myChart, mySeries);
}); 

【问题讨论】:

    标签: javascript d3.js onclicklistener dimple.js


    【解决方案1】:

    由于找不到更合适的解决方案,我确定了每个对象并将其删除:

            series.shapes.on("mouseleave", function (e) {
                svg.select(".dimple-tooltip").remove();
                svg.select(".dimple-custom-tooltip-box").remove();
                svg.select(".dimple-custom-tooltip-label").remove();
                svg.select(".dimple-line-marker-circle").remove();
                svg.select(".dimple-custom-line-marker-circle").remove();
                svg.select(".dimple-tooltip-dropline").remove();
                svg.select(".dimple-custom-tooltip-dropline").remove();     
            });     
    

    【讨论】:

      【解决方案2】:

      您可以通过以下方式删除附加了显示工具提示的事件的圈子:

      yourSvg.selectAll('circle').remove()
      

      【讨论】:

        猜你喜欢
        • 2011-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-23
        • 2011-11-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多