echarts虚线连接无效值或特殊值

1.把一条线拆两条实线在上虚线在下

实线data中将无效值改为 '-',虚线是原数组

option = {
  xAxis: {
    type: "category",
    data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
  },
  yAxis: {},
  color:['red','red'],
  series: [
    {
        name:'实线',
        data: [   '-',
    '-',
    0,
    0,
    0,
    0,
    1,
    1,],
        type: 'line',
       
    },
    {
        name:'虚线',
        data: [   2,
    2,
 0,
    0,
    0,
    0,
    1,
    1,
    ],
        type: 'line',
        itemStyle: {
            normal: {
                lineStyle: {
                    width: 2,
                        type:'dashed'
                    }
                }
        }
    },
    ]
}

echarts虚线连接无效值或特殊值_第1张图片

你可能感兴趣的:(echarts,javascript,前端)