Highcharts(六)之提示框

作者: 徐笔笔 | 来源:发表于2016-07-31 18:08 被阅读365次

1.提示框的背景,边框宽度,边框颜色

tooltip: {
                backgroundColor:'#ff0000',
                borderWidth: 1,
                borderColor: '#AAA'
            },

2.格式化提示框:

formatter:
数据提示框格式化函数,功能最强大也是最灵活的方法,函数里 this 关键字代表着当前数据点对象,常用的变量有:

this.x : 当前点 X 值
(一下属性需要数据共享,既全部内容显示在一个框里对比)
this.y / this.point[i].y : 当前点的 Y 值/ 当前第 i 个点的 Y 值 
this.point / this.point[i] : 当前点 / 当前第 i 个点
this.series / this.point[i].series : 当前数据列 / 当前第 i 个点的数据列

3.后缀单位:

valuePrefix、valueSuffix 来给数据添加前缀及后缀。

tooltip: {
    valuePrefix: '¥',
    valueSuffix: '元'
}

4.数据共享:

在有多组数据的时候,使用shared:true即可进行数据共享

tooltip: {
                backgroundColor:'#ff0000',
                borderWidth: 1,
                borderColor: '#AAA',
//                formatter:function () {
//                    return this.y
//                },
//                pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.percentage:.1f}%</b> ({point.y:,.0f} millions)<br/>',
                shared: true
            },          

5.启用十字准星:

crosshairs: [true, true]

相关文章

网友评论

    本文标题:Highcharts(六)之提示框

    本文链接:https://www.haomeiwen.com/subject/xlfxsttx.html