legend控制marklineecharts bar' }, { //这两组数据用来模拟markLine线段开关,data可以为空 name:'季度销量配置项内容和展示

legend控制markline

配置项如下
      option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    tooltip:{},
    legend:{
      data:["本月销量","季度销量","年度销量"]  
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {   
            name:'本月销量',
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar'
        },
        { //这两组数据用来模拟markLine线段开关,data可以为空
            name:'季度销量',
            type:'line',
            markLine:{
                data:[
                    {
                        name:'季度销量',
                        yAxis:"150"
                    }
                ]
            }
        },
        {
            name:'年度销量',
            type:'line',
            markLine:{
                data:[
                    {
                        name:'年度销量',
                        yAxis:"100"
                    }
                ]
            }
        }

    ]
};
    
截图如下