4

I want to combine 2 or more line charts having dates in x-axis and values in y-axis. But the dates for some series do not match.

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"];

I have merged and sorted Dates array for x-axis:

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"];

I want the y axis series values to be like this:

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"]

Chart Code Editor Ref: http://gallery.echartsjs.com/editor.html?c=xB1-xTeDC-

enter image description here

1 Answers1

1

Use null instead of 0 as a value for missing data. In my case it works quite good

Sonne
  • 691
  • 1
  • 6
  • 20