新聞中心
這里有您想知道的互聯(lián)網營銷解決方案
創(chuàng)新互聯(lián)ECharts教程:xAxis坐標軸指示器的文本標簽設置
xAxis.axisPointer.label | Object
用來控制坐標軸指示器的文本標簽。

xAxis.axisPointer.label.show | boolean
[ default: false ]
表示是否顯示文本標簽。如果 tooltip.axisPointer.type 設置為 'cross' 則默認顯示標簽,否則默認不顯示。
xAxis.axisPointer.label.precision | number, string
[ default: 'auto' ]
表示文本標簽中數(shù)值的小數(shù)點精度。默認根據當前軸的值自動判斷。也可以指定如 2 表示保留兩位小數(shù)。
xAxis.axisPointer.label.formatter | string, Function
[ default: null ]
作為文本標簽文字的格式化器。
- 如果為 function,可以是例如:
參數(shù):
{Object} params: 含有:
- {Object} params.value: 軸當前值,如果 axis.type 為 'category' 時,其值為 axis.data 里的數(shù)值;如果 axis.type 為 'time',其值為時間戳。
- {Array.
{
componentType: 'series',
// 系列類型
seriesType: string,
// 系列在傳入的 option.series 中的 index
seriesIndex: number,
// 系列名稱
seriesName: string,
// 數(shù)據名,類目名
name: string,
// 數(shù)據在傳入的 data 數(shù)組中的 index
dataIndex: number,
// 傳入的原始數(shù)據項
data: Object,
// 傳入的數(shù)據值
value: number|Array,
// 數(shù)據圖形的顏色
color: string,
}每項內容還包括軸的信息:
{
axisDim: 'x', // 'x', 'y', 'angle', 'radius', 'single'
axisId: 'xxx',
axisName: 'xxx',
axisIndex: 3,
axisValue: 121, // 當前 axisPointer 對應的 value。
axisValueLabel: '文本'
}
返回值:
顯示的 string。
例如:
formatter: function (params) {
// 假設此軸的 type 為 'time'。
return 'some text' + echarts.format.formatTime(params.value);
}
xAxis.axisPointer.label.margin | boolean
[ default: 3 ]
表示 label 距離軸的距離。
網站題目:創(chuàng)新互聯(lián)ECharts教程:xAxis坐標軸指示器的文本標簽設置
新聞來源:http://m.fisionsoft.com.cn/article/dpphpgo.html


咨詢
建站咨詢
