解决多条曲线,x轴跨度不同,数据连接会断开的问题;
有的4个小时有一个值,有的1个小时有一个值,4个小时的点会断开
解决方法
series数组中每个对象添加 connectNulls: true 属性
上边是我项目中循环添加属性,直观些看下面
//解决缺失的点,数据正常连接不断开
series:[
{
connectNulls: true, //添加此属性
data: ["", "12.2", "", "", "", "11.8", "", "", "", "13.5", "", "", "", "10.3", "", "", "", "7.8", "", "", "",…],
name: "化学需氧量"
smooth: true
type: "line"
unit: "mg/L"
},
{
connectNulls: true,//添加此属性
data: ["7.543", "7.558", "7.532", "7.529", "7.521", "7.504", "7.484", "7.476", "7.47", "7.459", "7.433",…],
name: "PH"
smooth: true
type: "line"
unit: "无量纲"
}
]