使用echarts插件做图表常见的几个问题(一)—— 折线图局部虚线

场景:实现折线图局部虚线

措施:series中两组数据name相同,data数据部分,实现或者虚线无值的部分用空来占位。

代码如下:

option = {
    xAxis: {
        type: 'category',
        data: ['1日', '2日', '3日', '4日', '5日', '6日', '7日','8日','9日','10日']
    },
    yAxis: {
        type: 'value'
    },
    series: [{
        name:'产量',
        data: [820, 932,'','',930,1200,1000,1110,'',''],
        type: 'line',
        itemStyle: {
            normal: {
                lineStyle: {
                    width: 2
                }
            }
         }
    },
    {
        name:'产量',
        data: ['',932,800, 900, 930, '','',1110,1200,900],
        type: 'line',
        itemStyle: {
            normal: {
                lineStyle: {
                    width: 2,
                        type:'dashed'
                    }
                }
        }
    }
    ]
};

 

posted @ 2019-09-17 17:20  rqpjuicy  阅读(3057)  评论(0编辑  收藏  举报