新聞中心
singleAxis.axisPointer.label | Object
ECharts 單軸指示器文本標簽設(shè)置。

大通ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書合作)期待與您的合作!
singleAxis.axisPointer.label.show | boolean
[ default: false ]
是否顯示單軸指示器文本標簽。如果 tooltip.axisPointer.type 設(shè)置為 'cross' 則默認顯示標簽,否則默認不顯示。
singleAxis.axisPointer.label.precision | number, string
[ default: 'auto' ]
單軸指示器文本標簽中數(shù)值的小數(shù)點精度。默認根據(jù)當前軸的值自動判斷。也可以指定如 2 表示保留兩位小數(shù)。
singleAxis.axisPointer.label.formatter | string, Function
[ default: null ]
單軸指示器文本標簽文字的格式化器。
如果為 string,可以是例如:formatter: 'some text {value} some text,其中 {value} 會被自動替換為軸的值。
如果為 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ù)據(jù)名,類目名
name: string,
// 數(shù)據(jù)在傳入的 data 數(shù)組中的 index
dataIndex: number,
// 傳入的原始數(shù)據(jù)項
data: Object,
// 傳入的數(shù)據(jù)值
value: number|Array,
// 數(shù)據(jù)圖形的顏色
color: string,
}每項內(nèi)容還包括軸的信息:
{
axisDim: 'x', // 'x', 'y', 'angle', 'radius', 'single'
axisId: 'xxx',
axisName: 'xxx',
axisIndex: 3,
axisValue: 121, // 當前 axisPointer 對應(yīng)的 value。
axisValueLabel: '文本'
}返回值:
顯示的 string。
例如:
formatter: function (params) {
// 假設(shè)此軸的 type 為 'time'。
return 'some text' + echarts.format.formatTime(params.value);
}singleAxis.axisPointer.label.margin | boolean
[ default: 3 ]
label 距離軸的距離。
singleAxis.axisPointer.label.textStyle | boolean
單軸指示器文本標簽的文字樣式??梢詫崿F(xiàn)如下設(shè)置:
- singleAxis.axisPointer.label.textStyle.color Color
[ default: '#fff' ]
文字的顏色。 - singleAxis.axisPointer.label.textStyle.fontStyle string
[ default: 'normal' ]
文字字體的風(fēng)格
可選: - 'normal'
- 'italic'
- 'oblique'
- singleAxis.axisPointer.label.textStyle.fontWeight string
[ default: normal ]
文字字體的粗細
可選: - 'normal'
- 'bold'
- 'bolder'
- 'lighter'
- 100 | 200 | 300 | 400...
- singleAxis.axisPointer.label.textStyle.fontFamily string
[ default: 'sans-serif' ]
文字的字體系列
還可以是 'serif' , 'monospace', 'Arial', 'Courier New', 'Microsoft YaHei', ... - singleAxis.axisPointer.label.textStyle.fontSize number
[ default: 12 ]
文字的字體大小 - singleAxis.axisPointer.label.textStyle.lineHeight number
行高。
rich 中如果沒有設(shè)置 lineHeight,則會取父層級的 lineHeight。例如:
{ lineHeight: 56 rich:{ a:{ // 沒有設(shè)置 `lineHeight`,則 `lineHeight` 為 56 } } } - singleAxis.axisPointer.label.textStyle.width number, string
文字塊的寬度。一般不用指定,不指定則自動是文字的寬度。在想做表格項或者使用圖片(參見 backgroundColor)時,可能會使用它。
注意,文字塊的 width 和 height 指定的是內(nèi)容高寬,不包含 padding。
width 也可以是百分比字符串,如 '100%'。表示的是所在文本塊的 contentWidth(即不包含文本塊的 padding)的百分之多少。之所以以 contentWidth 做基數(shù),因為每個文本片段只能基于 content box 布局。如果以 outerWidth 做基數(shù),則百分比的計算在實用中不具有意義,可能會超出。
注意,如果不定義 rich 屬性,則不能指定 width 和 height。 - singleAxis.axisPointer.label.textStyle.height number, string
文字塊的高度。一般不用指定,不指定則自動是文字的高度。在使用圖片(參見 backgroundColor)時,可能會使用它。
注意,文字塊的 width 和 height 指定的是內(nèi)容高寬,不包含 padding。
注意,如果不定義 rich 屬性,則不能指定 width 和 height。 - singleAxis.axisPointer.label.textStyle.textBorderColor string
[ default: 'transparent' ]
文字本身的描邊顏色。 - singleAxis.axisPointer.label.textStyle.textBorderWidth number
[ default: 0 ]
文字本身的描邊寬度。 - singleAxis.axisPointer.label.textStyle.textShadowColor string
[ default: 'transparent' ]
文字本身的陰影顏色。 - singleAxis.axisPointer.label.textStyle.textShadowBlur number
[ default: 0 ]
文字本身的陰影長度。 - singleAxis.axisPointer.label.textStyle.textShadowOffsetX number
[ default: 0 ]
文字本身的陰影 X 偏移。 - singleAxis.axisPointer.label.textStyle.textShadowOffsetY number
[ default: 0 ]
文字本身的陰影 Y 偏移。
singleAxis.axisPointer.label.padding | string, Array
[ default: [5, 7, 5, 7] ]
axisPointer 的內(nèi)邊距,單位px,默認各方向內(nèi)邊距為5,接受數(shù)組分別設(shè)定上右下左邊距。
使用示例:
// 設(shè)置內(nèi)邊距為 5
padding: 5
// 設(shè)置上下的內(nèi)邊距為 5,左右的內(nèi)邊距為 10
padding: [5, 10]
// 分別設(shè)置四個方向的內(nèi)邊距
padding: [
5, // 上
10, // 右
5, // 下
10, // 左
]singleAxis.axisPointer.label.backgroundColor | string
[ default: 'auto' ]
文本標簽的背景顏色,默認是和 axis.axisLine.lineStyle.color 相同。
singleAxis.axisPointer.label.borderColor | string
[ default: null ]
文本標簽的邊框顏色。
singleAxis.axisPointer.label.borderWidth | string
[ default: 0 ]
文本標簽的邊框?qū)挾取?/p>
singleAxis.axisPointer.label.shadowBlur | number
[ default: 3 ]
圖形陰影的模糊大小。該屬性配合 shadowColor,shadowOffsetX, shadowOffsetY 一起設(shè)置圖形的陰影效果。
示例:
{
shadowColor: 'rgba(0, 0, 0, 0.5)',
shadowBlur: 10
}singleAxis.axisPointer.label.shadowColor | Color
[ default: #aaa ]
陰影顏色。支持的格式同color。
singleAxis.axisPointer.label.shadowOffsetX | number
[ default: 0 ]
陰影水平方向上的偏移距離。
singleAxis.axisPointer.label.shadowOffsetY | number
[ default: 0 ]
陰影垂直方向上的偏移距離。
分享文章:創(chuàng)新互聯(lián)ECharts教程:ECharts單軸指示器文本標簽
鏈接分享:http://www.dlmjj.cn/article/ccieosd.html


咨詢
建站咨詢
