I want to add my own data in a sample HTML chart. The javascript codes of the data part is:
var data = [];
var visits = 10;
for (var i = 1; i < 50000; i++) {
visits += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 10);
data.push({
date: new Date(2018, 0, i),
value: visits
});
}
chart.data = data
I ran the output of the data with console.log(data)
and found the data is the following list of dictionaries:
[{"date":"2018-11-10T05:00:00.000Z","value":-459},
{"date":"2018-11-11T05:00:00.000Z","value":-459},
{"date":"2018-11-12T05:00:00.000Z","value":-464},
...
{"date":"2020-11-22T05:00:00.000Z","value":-493}]
I changed my own data to match the format of the above sample data list, the following list is my own data:
my_data =
[{'date': '01/02/2020', 'value': 13},
{'date': '01/03/2020', 'value': 2},
{'date': '01/06/2020', 'value': 5},
...
{'date': '01/07/2020', 'value': 6}]
I realized the date format is different from the sample data, so I changed them to the format of mm-dd-yyyy. However, when I replace the sample data with my own data, the chart doesn’t show up any data. What did I miss?