'How do I display 2 time series with different x values in ECharts?

I am looking at the examples provided with Echarts and I can't find a way to have 2 time series with different time values on the same chart. The time series both represent measures taken during the same interval but they don't align.

Example:

TS1 = [
   {time: 0:00, value: 1}, 
   {time: 0:10: value: 2, 
   {time: 0:22, value: 3},
... ]

TS2 = [
   {time: 0:05, value: 0.2}, 
   {time: 0:11: value: 0.45, 
   {time: 0:15, value: 0.3}, 
   {time: 0:21, value: 0.17},
... ] 

Some suggested to merge the 2 streams and replace missing values with null which I'd rather not do if I don't have to...

TS1 = [
   {time: 0:00, value: 1}, 
   {time: 0:05, value: null}, 
   {time: 0:10: value: 2}, 
   {time: 0:11: value: null},
   {time: 0:15, value: null}, 
   {time: 0:21, value: null},
   {time: 0:22, value: 3},
... ]

TS2 = [
   {time: 0:00, value: null}, 
   {time: 0:05, value: 0.2},
   {time: 0:10: value: null}, 
   {time: 0:11: value: 0.45, 
   {time: 0:15, value: 0.3}, 
   {time: 0:21, value: 0.17},
   {time: 0:22, value: null},

Help would be much appreciated thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source