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]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章