在选择过程中,如何禁用工具提示



是否可以禁用选择的Highcharts工具提示?我尝试了:

...
charts: {
    events: {
        selection: function(event) {
             this.tooltip.enabled = false;
        }
    }
}

我确实希望该工具提示用户只需徘徊在数据上时。谢谢

仅在选择图表区域之后才触发selection事件。您可以在图表容器上使用mousedownmouseup事件来切换工具提示:

chart: {
    zoomType: 'x',
    events: {
        load: function() {
            var chart = this,
                chartContainer = document.getElementById('container');
            chartContainer.onmousedown = function(e) {
                chart.update({
                    tooltip: {
                        enabled: false
                    }
                });
            };
            chartContainer.onmouseup = function() {
                chart.update({
                    tooltip: {
                        enabled: true
                    }
                });
            };
        }
    }
}

实时演示: https://jsfiddle.net/blacklabel/y0fluk9a/

API参考: https://api.highcharts.com/class-reference/highcharts.chart#update

最新更新