自定义颜色gridLine echarts

时间:2018-10-30 16:06:34

标签: echarts gridlines

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

1 个答案:

答案 0 :(得分:1)

是的,您可以在选项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>