使用鼠标输入图表时禁用自动点悬停

Disable automatic point hover when entering chart with mouse

本文关键字:悬停 鼠标 输入      更新时间:2023-09-26

$(function () {
    $('#container').highcharts({
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    });
});
body {
    font-family: Arial, Verdana, sans-serif;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>

试着将图表悬停在某处。您会注意到,它会自动触发图表上相应x值的悬停事件。

尽管我们甚至还没有在线路上徘徊。

我想禁用它。我只想在悬停发生在lite本身时触发悬停事件。

检查这个小提琴http://jsfiddle.net/Rakesh_V_R/ykn77Lmw/13/

添加了以下系列选项:

type: 'scatter',
stickyTracking: false,
lineWidth: 2,