Hello I have problem with date format on the chart:
I am fetching csv file where data look like that
2020-07-11T23:11:52,23.45
2020-07-14T21:06:39,25.02
2020-07-14T21:08:05,25.07
2020-07-14T21:10:00,25.13
2020-07-14T21:12:10,25.04
2020-07-14T21:14:32,25.07
2020-07-14T21:30:49,24.87
Code:
async function getData(){
var response =await fetch(‘data.csv’);
var data = await response.text();
var table = data.split(‘\n’).slice(1);
table.forEach(row =>{
var columns = row.split(‘,’);
var date = new Date(columns[0]);
var xValue = date;
var yValue = columns[1];
xlabels.push(date);
dataPoints.push({
x: xValue,
y: yValue
});
});
And creating chart:
var chart;
chart = new CanvasJS.Chart(“chartContainer”,
{
title: {
text: “Chart with Date Selector”
},
data: [
{
type: “line”,
dataPoints: xlabels
}
]
});
chart.render();
What is a problem?