echartsapache-echarts

Echarts SplitLine overlap AxisLine when opacity is set


It may sounds logical, but the splitLine is overlapping my axisLine when I set an opacity in Echarts. I would like to achieve this design:

bar graph with axis and split lines

The axis and the split lines have an opacity to 0.3. The correct option should be:

xAxis: {
    axisLine: {
       lineStyle: {
         color: 'black',
         opacity: 0.3,
         width: 1,
      }
    },
    splitLine: {
       lineStyle: {
         color: 'black',
         opacity: 0.3,
         width: 1,
         type: 'dashed'
      }
    }
  }

With this config, I got an overlap at the xAxis:

enter image description here

The only work-around I found is to set splitLine colors:

{
  splitLine: {
    lineStyle: {
       color: color: [
          'none', // This one represents the first splitLine (set on the axis)
          'black',
          'black',
          'black',
          'black',
          ... // until Infinity
       ],
       opacity: 0.3,
       width: 1,
       type: 'dashed'
    }
  }
}

Anyone faced this issue before ?


Solution

  • They finally fixed it inside the 5.6.0 with this PR
    What you can do now is:

    xAxis: {
      splitLine: {
        show: true,
        showMinLine: false,  // do not show the first splitLine
        lineStyle: { color: 'black', width:3 }
      }
    }