禁用Highcharts中某些点的工具提示

All*_*Liu 20 highcharts

我有一个Highcharts折线图,我启用了工具提示,但是,我想在x = 0的某些情况下禁用工具提示.有办法做到这一点吗?我到目前为止最接近的是:

tooltip: {
    formatter: function() {
        if (this.x > 0) {
            return this.x;
        }
        else return null;
    }
}
Run Code Online (Sandbox Code Playgroud)

这只是创建一个空的工具提示,但仍然有一个弹出窗口.

All*_*Liu 36

好的......只是想通了.我只需要返回false而不是null.

tooltip: {
    formatter: function() {
        if (this.x > 0) {
            return this.x;
        }
        else return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 遗憾的是,在为给定系列定义自定义工具提示时,它似乎不适用于`pointFormatter`.返回false只会打印false.返回null显示一个空的小方框.系列工具提示不支持formatter. (3认同)