I'm plotting a graph using highchart but date in not properly displaying in x-axis so i need to parse the dates from the json response. I tried to manipulate the json date but not getting as expected.
This is my current json response
"linechart":[{
"name":"Average Conversation Length (In minutes)",
"data":[["2020,02,12",12],["2020,02,13",13]]
},{
"name":"Average Number of Conversations",
"data":[["2020,02,12",10],["2020,02,13",21]]
}]
This is my expected output
linechart: [{name: "Average Conversation Length (In minutes)",
data: [[Date.UTC(2020, 02, 12), 12],[Date.UTC(2020, 02, 13), 13]]},
{name: "Average Number of Conversations",
data: [[Date.UTC(2020, 02, 12), 10],[Date.UTC(2020, 02, 13), 21]]}],
This is what i tried
var arr1 = [];
var data = chartdata.linechart
for (var i = 0; i < data.length; i++){
var obj = data[i];
for (var key in obj){
var value = obj[key];
for (var value2 in value){
var values = value[value2];
arr1.push(Date.parse(values));
}
}
}