My json file:
Last item in each object is the type ("tp":"graphA"). Second item in each object is the time (t":"09/27/2022 10:23:48.733").
[
{"spd":65.62,"t":"09/27/2022 10:23:48.733","d":1037.29,"tp":"graphA"},
{"acc":1.45,"t":"09/27/2022 10:23:48.930","sgstr":56208,"incltn":56.17",tp":"graphB"},
{"spd":65.62,"t":"09/27/2022 10:23:48.934","d":1037.51,"tp":"graphA"},
{"acc":1.45,"t":"09/27/2022 10:23:49.050","sgstr":56208,"incltn":56.17,"tp":"graphB"},
{"spd":65.62,"t":"09/27/2022 10:23:49.134","d":1037.73,"tp":"graphA"},
{"spd":65.62,"t":"09/27/2022 10:23:49.200","d":1037.62,"tp":"graphA"},
{"acc":1.45,"t":"09/27/2022 10:23:49.325","sgstr":56208,"incltn":56.17,"tp":"graphB"},
{"spd":65.62,"t":"09/27/2022 10:23:49.334","d":1037.95,"tp":"graphA"},
{"acc":1.45,"t":"09/27/2022 10:23:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
{"acc":1.45,"t":"09/27/2022 10:23:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
{"acc":1.45,"t":"09/27/2022 10:24:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
{"acc":1.45,"t":"09/27/2022 10:25:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
{"acc":1.45,"t":"09/27/2022 10:26:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
{"acc":1.45,"t":"09/27/2022 10:27:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
{"acc":1.45,"t":"09/27/2022 10:28:49.555","sgstr":56208,"incltn":56.17,"tp":"graphB"}
]
Below is my code:
var acc= [];
var sgstr = [];
var spd =[];
var d =[];
if (data.tp === "graphA") {
acc.push(data.acc)
sgstr.push(data.sgstr)
}
else {
acc.push(null)
sgstr.push(null)
}
if (data.tp === "graphB") {
spd.push(data.spd)
d.push(data.d)
}
else {
spd.push(null)
d.push(null)
}
Assume Json gets generated when a tool runs. I push null in above code because I want to keep each graph(A and B) in line with the whole time the tool was running. Now the problem is, since most of the times graphA and graphB comes alternatively, graphs are generated like points and does not connect like a graph. How do I show them connected like a real graph .Can time diff in milliseconds be ignored or how do we go about it?
If you the notice last 5 lines, only graphB gets data. So, graphA will not have anything plotted for that time period in real graph, which is fine because graphA is not getting data for that time period (like for five mins).
Do we have any technique in highcharts that can handle this? Any suggestion would be helpful.