高图散点图-使工具提示不跟随指针

Highcharts scatter plot - make tooltip not follow pointer

本文关键字:不跟随 指针 工具提示 散点图 高图      更新时间:2023-09-26

我想有一个直线图,我把鼠标悬停在一个点上,工具提示被触发,它不跟随指针。我不希望工具提示被触发,除非我直接悬停在一个点上。我可以使用线宽的散点图来解决第一个问题(只在直接悬停在图上时显示工具提示)。不过,我不知道如何让工具提示不跟随鼠标。我尝试以各种方式设置followPointer为false,但它似乎没有工作(http://api.highcharts.com/highcharts#tooltip.followPointer)

下面是演示问题的示例:

http://jsfiddle.net/6uGJp/1/

$(function () {
$('#container').highcharts({
    chart: {
        type: 'scatter'
    },
    xAxis: {
        categories: ['Nov', 'Dec']
    },
    tooltip: {
        shared: true,
        useHTML: true,
        headerFormat: '<small>{point.key}</small><table>',
        pointFormat: '<tr><td style="color: {series.color}">{series.name}: </td>' +
            '<td style="text-align: right"><b>{point.y} EUR</b></td></tr>',
        footerFormat: '</table>',
        valueDecimals: 2,
    },
    series: [{
        name: 'Short',
        lineWidth: 2,
        data: [95.6, 54.4]
    }]
});

});

我在我的系列中遇到了同样的问题,我改变了以下选项,它工作得很好:

plotOptions: {
  series:{
    stickyTracking: false
  }
}
下面是highcharts api文档中的一个例子:stickyTracking

你可以使用一个固定的工具提示,比如

需要

 positioner: function () {
                return { x: 80, y: 50 };
            }

这将使工具提示始终呈现在固定位置。

希望这是你需要的

试试这个:

plotOptions: {
            scatter:{
                     tooltip:{
                             followPointer: false
                     }
            }
}