How can I hide tooltip in highcharts

本小妞迷上赌 提交于 2020-03-25 18:47:11

问题


I want a tooltip to hide when the cursor is moved, but the column remains selected

$(function () {

        Highcharts.Pointer.prototype.reset = function () {

        };
        let chart = Highcharts.chart('bar', {


            tooltip: {
                shared: true,
                hideDelay:100,
                useHTML: true,
                outside: true,
                style: {
                    fontSize: "13px",
                    color: '#505050'
                }
            },
        });

});

https://jsfiddle.net/alexserden/wq6j0tnp/6/


回答1:


I prepare a demo with custom function which hides tooltip when mouse leaves the chart container.

  events: {
    load() {
      let chart = this;

      chart.container.onmouseleave = function() {
        chart.series[0].points.forEach(p => {
          if(p.state === 'hover') {
            chart.tooltip.hide(p)
          }
        })
      }
    }
  }

Demo: https://jsfiddle.net/BlackLabel/0ag7ojmy/

API: https://api.highcharts.com/highcharts/chart.events.load



来源:https://stackoverflow.com/questions/60632236/how-can-i-hide-tooltip-in-highcharts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!