坐标轴指示器线条样式设置
编辑教程坐标轴指示器线条样式设置
对 ECharts 中的坐标轴指示器的线条进行设置的时候,会有两种情况:
- axisPointer.type 为 'line' 时;
- axisPointer.type 为 'cross' 时;
grid.tooltip.axisPointer.lineStyle
Object
axisPointer.type 为 'line' 时有效。
grid.tooltip.axisPointer.lineStyle.color
Color
[ 默认值: #555 ]
线的颜色。
颜色可以使用 RGB 表示,比如 'rgb(128, 128, 128)',如果想要加上 alpha 通道表示不透明度,可以使用 RGBA,比如 'rgba(128, 128, 128, 0.5)',也可以使用十六进制格式,比如 '#ccc'。除了纯色之外颜色也支持渐变色和纹理填充
// 线性渐变,前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,相当于在图形包围盒中的百分比,如果 globalCoord 为 true
,则该四个值是绝对的像素位置
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'red' // 0% 处的颜色
}, {
offset: 1, color: 'blue' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
}
// 径向渐变,前三个参数分别是圆心 x, y 和半径,取值同线性渐变
color: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.5,
colorStops: [{
offset: 0, color: 'red' // 0% 处的颜色
}, {
offset: 1, color: 'blue' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false }
// 纹理填充
color:
{ image: imageDom, // 支持为 HTMLImageElement, HTMLCanvasElement,不支持路径字符串
repeat: 'repeat' // 是否平铺, 可以是 'repeat-x', 'repeat-y', 'no-repeat'
}
grid.tooltip.axisPointer.lineStyle.width
number
[ 默认值: 1 ]
线宽。
grid.tooltip.axisPointer.lineStyle.type
string
[ 默认值: solid ]
线的类型。
可选:
- 'solid'
- 'dashed'
- 'dotted'
grid.tooltip.axisPointer.lineStyle.shadowBlur
number
图形阴影的模糊大小。该属性配合 shadowColor,shadowOffsetX, shadowOffsetY 一起设置图形的阴影效果。
示例:
{
shadowColor: 'rgba(0, 0, 0, 0.5)',
shadowBlur: 10
}
grid.tooltip.axisPointer.lineStyle.shadowColor
Color
阴影颜色。支持的格式同color。
grid.tooltip.axisPointer.lineStyle.shadowOffsetX
number
[ 默认值: 0 ]
阴影水平方向上的偏移距离。
grid.tooltip.axisPointer.lineStyle.shadowOffsetY
number
[ 默认值: 0 ]
阴影垂直方向上的偏移距离。
grid.tooltip.axisPointer.lineStyle.opacity
number
图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
grid.tooltip.axisPointer.crossStyle
Object
axisPointer.type 为 'cross' 时有效。
grid.tooltip.axisPointer.crossStyle.color
Color
[ 默认值: #555 ]
线的颜色。
颜色可以使用 RGB 表示,比如 'rgb(128, 128, 128)',如果想要加上 alpha 通道表示不透明度,可以使用 RGBA,比如 'rgba(128, 128, 128, 0.5)',也可以使用十六进制格式,比如 '#ccc'。
除了纯色之外颜色也支持渐变色和纹理填充
// 线性渐变,前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,相当于在图形包围盒中的百分比,如果 globalCoord 为 true
,则该四个值是绝对的像素位置
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'red' // 0% 处的颜色
}, {
offset: 1, color: 'blue' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
}
// 径向渐变,前三个参数分别是圆心 x, y 和半径,取值同线性渐变
color: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.5,
colorStops: [{
offset: 0, color: 'red' // 0% 处的颜色
}, {
offset: 1, color: 'blue' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
}
// 纹理填充
color: {
image: imageDom, // 支持为 HTMLImageElement, HTMLCanvasElement,不支持路径字符串
repeat: 'repeat' // 是否平铺, 可以是 'repeat-x', 'repeat-y', 'no-repeat'
}
grid.tooltip.axisPointer.crossStyle.width
number
[ 默认值: 1 ]
线宽。
grid.tooltip.axisPointer.crossStyle.type
string
[ 默认值: dashed ]
线的类型。
可选:
- 'solid'
- 'dashed'
- 'dotted'
grid.tooltip.axisPointer.crossStyle.shadowBlur
number
图形阴影的模糊大小。该属性配合 shadowColor,shadowOffsetX, shadowOffsetY 一起设置图形的阴影效果。
示例:
{
shadowColor: 'rgba(0, 0, 0, 0.5)',
shadowBlur: 10
}
grid.tooltip.axisPointer.crossStyle.shadowColor
Color
阴影颜色。支持的格式同color。
grid.tooltip.axisPointer.crossStyle.shadowOffsetX
number
[ 默认值: 0 ]
阴影水平方向上的偏移距离。
grid.tooltip.axisPointer.crossStyle.shadowOffsetY
number
[ 默认值: 0 ]
阴影垂直方向上的偏移距离。
grid.tooltip.axisPointer.crossStyle.opacity
number
图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。

选择支付方式:



备注:
转账时请填写正确的金额和备注信息,到账由人工处理,可能需要较长时间