Disable tooltip for one point?

前端 未结 1 1375
后悔当初
后悔当初 2021-01-06 10:55

my chart is this:

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/3d-scatter-draggable/

i know

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-06 11:47

    You can disable tooltip for specific points using tooltip.formatter. You will need to add some identifying attribute to the points that are not going to have a tooltip, and then check for that in your tooltip.formatter function.

    For example, you could set your data like this (see first point):

    data: [{x:1, y:6, z:5, noTooltip: true}, [8, 7, 9], [1, 3, 4], [4, 6, 8], [5, 7, 7]]
    

    Then in your tooltip.formatter you can evaluate like this:

    tooltip: {
        formatter: function() {
            // If the point is going to have a tooltip
            if(!this.point.noTooltip) {
                // Mimic default tooltip contents
                return '● '+this.series.name+
                       '
    x: '+this.point.x+ '
    y: '+this.point.y+ '
    z: '+this.point.z+ '
    '; } // If tooltip is disabled return false; } }

    See this JSFiddle demonstration (point that is disabled is at coordinates [1,1,0] in bottom left).

    0 讨论(0)
提交回复
热议问题