I have sets of data called series, containing [x,y] pairs, in the format:
[
[x1,a1],
[x2,a2],
[x3,a3],
...
],[
[x4,b1],
[x1,b2],
[x5,b3],
...
]
These multiple sets need to be combined (matching x-values) to fit into Dygraph's data format where all the x-values are the first element of each array:
{
[x1,a1,b2],
[x2,a2,null],
[x3,a3,null],
[x4,null,b1],
[x5,null,b3]
...
}
Ive been trying to use ES6 functions to make this easier but since I am new to javascript I am having trouble finding a good (and fast, as it will handle a lot of data) way to do this. I think I am having more trouble because I don't know the terminology for what I am trying to do which makes googling harder as I am sure this problem is out there somewhere.
Should I be just using a bunch of for loops to make this work or is there a better, efficient way to do this?
Thank you. (I am using mathjs if it has function that could help; i've tried matrix's reshape,concat,etc and none seem to do what I want).