禁用一个点的工具提示? [英] Disable tooltip for one point?

查看:76
本文介绍了禁用一个点的工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图表是这样的:

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

我知道如果我想禁用工具提示效果

 工具提示:{
启用:false
}我需要添加到我的代码中:


但我不知道如何禁用它只有一个点...

 系列:[{
名称:'Reading',
colorByPoint:
{color:#ff0000 },

data:[
// [X,Y,Z]
[1,8,1],
[1,9,2] ,
[1,1,5],
[2,7,2],
[2,3,4],
[4,5,7],
[4,5,8 ],
[7,3,3],
[7,8,5],
[10,7,10]
]},{----- - 在底部画一条线
data:[[0,0,5],[10,0,5]
],
lineWidth:1,
marker:{
启用:false
},
颜色:'rgba(0,0,0,0.51)'
},------结束绘制

{// ------绘制一个点(右边缘)底部框架
data:[[10.7,0,5]],
dataLabels:{
启用:true,
crop:false,
overflow:false,
format:3,
},
标记:{

已启用:假,
状态:{

盘旋:{
启用:false
$ b}
}
}

}]

如何禁用我添加的点的工具提示?

解决方案

您可以使用 tooltip.formatter 禁用特定点的工具提示。您将需要添加一些标识属性到没有工具提示的点,然后在 tooltip.formatter 函数中检查。



例如,您可以像这样设置您的数据(请参阅第一点):
$ b $数据:[{x:1,y:6,z:5,noTooltip:true},[8,7,9],[1,3,4], [4,6,8],[5,7,7]]

然后在 tooltip.formatter 您可以这样评估:

 工具提示:{
格式化程序:function(){
//如果点将有一个工具提示
if(!this.point.noTooltip){
//模仿默认工具提示内容
返回'●'+ this.series.name +
'< br /> x:< b>'+ this.point.x +
'< / b>< br /> y:< b>'+ this.point.y +
'< / b>< br /> z:< b>'+ this.point.z +
< / B><峰; br />;
}

//如果tooltip被禁用
返回false;


请参阅这个JSFiddle演示(禁用点位于左下角的坐标[1,1,0]处)。


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 that if i want to disable the tooltip effect in highcharts, i need to add to my code this:

 tooltip: {
   enabled: false
   }

but i don't know how to disable it for only one point...

    series: [{
        name: 'Reading',
        colorByPoint:
        { color: "#ff0000"},

        data: [
            // [X, Y, Z]
            [1, 8, 1],
            [1, 9, 2],
            [1, 1, 5],
            [2, 7, 2],
            [2, 3, 4],
            [4, 5, 7],
            [4, 5, 8],
            [7, 3, 3],
            [7, 8, 5],
            [10, 7, 10]
        ]},{ ------ draw a line on bottom frame
            data: [[0,0,5],[10,0,5]
        ],
        lineWidth: 1,
        marker: {
            enabled: false
        },
        color: 'rgba(0,0,0,0.51)' 
        },  ------ end draw

           {  // ------ draw a point on (right edge) bottom frame
            data: [[10.7,0,5]],                
             dataLabels: {
                enabled: true,                    
                crop: false,
                overflow: false,
                 format: 3,
            }, 
            marker: {

                enabled: false,
                states:{

                    hover: {
                        enabled: false

                    }
                }
            }

    }]

how can i to disable the tooltip for the point that i addded ?

解决方案

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+
                   '<br/>x: <b>'+this.point.x+
                   '</b><br/>y: <b>'+this.point.y+
                   '</b><br/>z: <b>'+this.point.z+
                   '</b><br/>';
        }

        // If tooltip is disabled
        return false;
    }
}

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

这篇关于禁用一个点的工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆