自定义颜色 gridLine echarts

custom color gridLine echarts

eCharts中gridLine可以自定义颜色吗? I want to custom the color of horizontal white line

是的,您可以在选项 yAxis.splitLine.lintStyle.color

中自定义
yAxis : [
    {
        type : 'value',
        splitLine: {
            lineStyle: {
                color: 'blue'
            }
        }
    }
],

以及更多详细信息there

查看此演示:

let echartsObj = echarts.init(document.querySelector('#canvas'));
 
option = {
    color: ['#3398DB'],
    xAxis : [
        {
            type : 'category',
            data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        }
    ],
    yAxis : [
        {
            type : 'value',
            splitLine: {
                lineStyle: {
                    color: 'blue'
                }
            }
        }
    ],
    series : [
        {
            name:'metric',
            type:'bar',
            data:[10, 52, 200, 334, 390, 330, 220]
        }
    ]
};


    echartsObj.setOption(option)
<html>
      <header>
        <script src="https://cdn.bootcss.com/echarts/4.1.0.rc2/echarts-en.min.js"></script>
      </header>
      <body>
        <div id="canvas" style="width: 100%; height: 300px">
        </div>
      </body>
    </html>