使用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'
                    }
                }
        }
    }
    ]
};

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM