echarts修改axisPointer shadow的宽度

echarts yekong 6649℃

echarts一直想修改axisPointer shadow宽度,想变窄一点,但是从文档里面的配置找不到对应的配置,很是苦恼找了方法最后换了一种方式将shadow更换为line通过修改line的宽度和颜色就可以实现类似的效果了。

修改前

wanjunshijie 2021-04-07 at 16.05.23@2x

修改后

wanjunshijie 2021-04-07 at 16.06.05@2x

修改前的代码

axisPointer: {
            type: 'shadow',
            shadowStyle: {
              width: 'auto',
              color: {
                type: 'line',
                x: 0,
                y: 0,
                x2: 1,
                y2: 1,
                colorStops: [{
                  offset: 0, color: '#000613' // 100% 处的颜色
                }, {
                  offset: 1, color: '#77f0ff' // 0% 处的颜色  #000613','#00334f', '#77f0ff'
                }],
              },
              opacity: 0.1,
              shadowOffsetY: 1,
              shadowOffsetX: 1,
              shadowColor: "rgba(201, 233, 238, 0.5)",
              shadowBlur: 1
            },
          },

修改后的代码

axisPointer: {
            type: 'line',
            lineStyle: {
              color: {
                type: 'line',
                x: 0,
                y: 0,
                x2: 1,
                y2: 1,
                colorStops: [{
                  offset: 0, color: 'rgba(0, 6, 20, 0.5)' // 100% 处的颜色
                }, {
                  offset: 1, color: 'rgba(125, 239, 255, 0.5)' // 0% 处的颜色  #000613','#00334f', '#77f0ff'
                }],
              },
              type: 'solid',
              width: 30
            },
          },
喜欢 (12)