-1

I have 2-time series data with different time stamps and a different number of data points.

First one:

​​[
 { time: "2020-03-10T06:48:08.884220928Z", value: 99.05870056152344 }
​​​​​
 { time: "2020-03-10T06:48:10.888220928Z", value: 99.09293365478516 }
​​​​​
 { time: "2020-03-10T06:48:14.890221056Z", value: 99.17850494384766 }
​​​​​
 { time: "2020-03-10T06:49:18.894221056Z", value: 99.12715911865234 }
​​​​​
 { time: "2020-03-10T06:49:20.895220992Z", value: 99.16139221191406 }
​​​​​
 { time: "2020-03-10T06:49:24.900220928Z", value: 99.14427185058594 }
​​​​​
 { time: "2020-03-10T06:49:26.901220864Z", value: 99.21273040771484 }
​​​​​
 { time: "2020-03-10T06:50:30.904220928Z", value: 99.24696350097656 }
​​​​​
 { time: "2020-03-10T06:50:32.904220928Z", value: 99.22985076904297 }
​​​​​
 { time: "2020-03-10T06:50:36.910221056Z", value: 99.22985076904297 }
]

and the second one: ​​​​

[
{ time: "2020-03-10T06:48:59.000Z", value: 0 }
​​​​
{ time: "2020-03-10T06:49:01", value: 61.7744735137 }
​​​​
{ time: "2020-03-10T06:49:05", value: 27.1289544868 }
​​​​
{ time: "2020-03-10T06:49:09", value: 100 }
]

As I have seen in the stacked line chart https://www.echartsjs.com/examples/en/editor.html?c=line-stack one has to add additional data points to the second array in order to plot it correctly. Otherwise only 4 first points on xAxis (positions 0,1,2,3) are shown on the chart for the second distribution. Which is not what I want. I need to place the location according to the data stamp.

Is there a way to just plot this points in the chart without altering the second array which will be feeding the second series object with nulls?

6axter82
  • 569
  • 2
  • 8
  • 19

1 Answers1

0

I have figured out my solution but it is a strange one

so, basically, one needs to feed the data with each point of second.

In order to do so for different arrays of timestamps, one gets the start and end times, runs a loop with each second added and populates the the first series (0) data with this array. Only afterwards will the points from subsequent data series (1 and 2) start to adjust correctly to the timestamp points from series 0.

This is totally unclear from the documentation on the official example page.

6axter82
  • 569
  • 2
  • 8
  • 19