Highcharts(六)之提示框

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]

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容