highcharts报表 四:tooltip数据提示框指配置

数据提示框指的当鼠标悬停在某点上时,以框的形式提示该点的数据,比如该点的值,数据单位等。数据提示框内提示的信息完全可以通过格式化函数动态指定;通过设置 tooltip.enabled = false 即可不启用提示框。

这里写图片描述


        tooltip : {

            shared: true,  // 提示框是否共享

            backgroundColor : 'red', // 提示框背景色

            enabled : true, // 是否启用提示框, 默认启用

            formatter : function (){ // 提示框格式化字符串
                 var s = '<b>'+this.x+'</b>';
                 $.each(this.points ,function(){
                     s += '<br />' + this.series.name + ':' + this.y;
                 });
                 return s;
             },

             pointFormatter : function () { // 格式化提示框字符串,更灵活,优先使用
                // 函数中的 this 代表着 Point 对象。
             }
             positioner: function () { // 固定提示框
                 return { x: 80, y: 50 };
             },
             valueSuffix: ' cm', // 数值后缀

             valuePrefix : '数据前缀' // 数值前缀

             valueDecimals : 2, // 保留小数位数

             xDateFormat :  '%Y-%m-%d', // shared: true,

             backgroundColor : 'red',

             enabled : true,

             formatter : function (){
                 var s = '<b>'+this.x+'</b>';
                 $.each(this.points ,function(){
                     s += '<br />' + this.series.name + ':' + this.y;
                 });
                 return s;
             },
             pointFormatter : function () {
                // 函数中的 this 代表着 Point 对象。
             }
             positioner: function () {
                 return { x: 80, y: 50 };
             },

            valueSuffix: ' cm',

             valuePrefix : '数据前缀'

             valueDecimals : 2,

             xDateFormat :  '%Y-%m-%d', //  如果 X轴是时间轴,格式化提示框标题中的日期
     }
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值