Accepted answer

After revisiting the question, here's your problem: you are using the wrong version of chart.js. According to this section, if you want to use an axis that's time based, you either need to explicitly include moment.js, or use the bundle version.

Changing the resource in your jsfiddle to will show the expected chart. No need to change the code at all.


You have to use the version 2 of chart.js. If you are using npm, in your package.json, update chart.js e.g., "chart.js": "^2.1.1",. In case you use react-chartjs-2, you will still need to make sure that your chart.js version is 2 or bigger.


Use this : var ctx = document.getElementById("myChart").getContext("2d");

Instead of : var ctx = document.getElementById("myChart");


If you want to use Chart.js v2.0 then this CDN will work.

Related Query