javascript – 在echarts.js中为缺少的数据设置零
作者:互联网
我想组合两个或多个具有x轴日期和y轴值的折线图.但是某些系列的日期并不匹配.
series0X= ["2015-11-21","2017-09-21"];
series1X= ["2017-09-21","2017-10-22","2017-11-20"];
series2X= ["2018-05-21","2018-09-22","2018-10-20","2018-11-21"]
series0Y=["5","8"];
series1Y=["3","4","7"];
series2Y= ["2","9","6","1"];
我已经为x轴合并并排序了Dates数组:
DatesX = ["2015-11-21", "2017-09-21", "2017-10-22", "2017-11-20", "2018-05-21", "2018-09-22", "2018-10-20", "2018-11-21"];
我希望y轴系列值如下:
series0Y= ["5","8","0',"0","0", "0", "0", "0"]
series1Y= ["0","3","4',"7","0", "0", "0", "0"]
series2Y= ["0","0","0',"0","2","9","6","1"]
图表代码编辑器参考号:http://gallery.echartsjs.com/editor.html?c=xB1-xTeDC-
解决方法:
使用null而不是0作为缺失数据的值.就我而言,它的效果非常好
标签:jquery,javascript,echarts,timeserieschart 来源: https://codeday.me/bug/20190710/1425314.html