美文网首页
echarts 根据Y轴的值(动态的)设置图上的背景色

echarts 根据Y轴的值(动态的)设置图上的背景色

作者: 垃圾桶边的狗 | 来源:发表于2019-12-20 10:46 被阅读0次
option = {
    xAxis: {
        type: 'category',
        // 调整X轴文字方向
        axisLabel: {interval:0,rotate:0 },
        data: ['嘿嘿', '哈哈', '嘎嘎', '嘻嘻', '丫丫', '七七', 'PiuPiu']
    },
    yAxis: {
        type: 'value',
        max:1400,
        min:800,
        // 删除 axisLabel 显示刻度
        axisLabel : {
            formatter: function(){
                  return "";
            }
        },
        splitArea:{
            show:true,
            areaStyle:{
                color:[
                    'rgba(12,23,34,0.3)',
                    'rgba(10,53,54,0.6)',
                    'black',
                    'red',
                    'white',
                    'rgba(20,123,5,0.6)',
                    ]
            }
        }
    },
    series: [{
        dataBackground:'green',
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line'
    }]
};

下载 (6).png

相关文章

网友评论

      本文标题:echarts 根据Y轴的值(动态的)设置图上的背景色

      本文链接:https://www.haomeiwen.com/subject/lrvbnctx.html