0👍
Update:
I found a way to prepare the data in a way I need.
By cycling through the JSON object and building an array based on that.
async function prepData(){
var chartLabel = [];
var data_points = [];
var dataset = [];
var entry = [];
var data_point = [];
for (var channel in json_data){
data_points = [];
dataset = [];
entry = [];
chartLabel = [];
chartLabels.push(channel);
for(entry in json_data[channel]){
data_point = {
y:json_data[channel][entry].Value,
t:json_data[channel][entry].Timestamp
};
data_points.push(data_point);
};
dataset = {
label: channel,
data: data_points
};
//console.log(dataset);
chartData.push(dataset)
};
console.log(chartData);
console.log(chartLabels)
}
- Chartjs-Chartjs annotations-plugin: Can I add multiple vertical lines to identically named x-axis labels?
- Chartjs-Customize ChartJS Hover Data Format
Source:stackexchange.com