使用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: {
                     2
                }
            }
         }
    },
    {
        name:'产量',
        data: ['',932,800, 900, 930, '','',1110,1200,900],
        type: 'line',
        itemStyle: {
            normal: {
                lineStyle: {
                     2,
                        type:'dashed'
                    }
                }
        }
    }
    ]
};
原文地址:https://www.cnblogs.com/juicy-initial/p/11535533.html