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
https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.bundle.min.js 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.
- Uncaught TypeError: Cannot read property 'draw' of undefined : Angular chart js
- Chart JS Error : Uncaught TypeError: Cannot read property 'top' of undefined
- Chart Js Cannot read property 'length' of undefined
- Uncaught TypeError: Cannot read property 'offsetWidth' of undefined - chart.js
- ChartJS: Uncaught TypeError: Cannot read property 'call' of undefined
- Uncaught TypeError: Cannot read property 'draw' of undefined
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- Angular / ng2-charts: Fetching json data in chart object showing: Cannot read property 'length' of undefined
- Uncaught TypeError: Cannot read property 'draw' of undefined for object scale
- Uncaught (in promise) TypeError: Cannot read property 'length' of undefined in chartjs with Vuejs
- Uncaught TypeError: Cannot read property 'format' of undefined
- js error: while trying to display graph using chart.js: Uncaught TypeError: Cannot read property 'call' of undefined
- Chart.js Line graph legend yields error: Uncaught TypeError: Cannot read property '0' of undefined
- Chartjs cannot read property datasets of undefined
- TypeError: Cannot read property 'defaults' of undefined when using the react wrapper of chartjs
- Cannot read property 'labels' of undefined
- Chart.js Cannot read property 'fontSize' of undefined
- TypeError: Cannot read property 'legend' of undefined | Angular + ng2-charts
- Ionic/Chart.js - Cannot read property 'nativeElement' of undefined
- Updating Chart.js with JSON, cannot read property 'length' of undefined
- chartjs & asp.net: Cannot read property 'labels' of undefined
- Cannot read property 'reactiveProp' of undefined in vue-chartjs
- react-chartjs integration error. Cannot read property 'xLabels' of undefined
- Chartjs + Vue.js - Cannot read property '_meta' of undefined
- chartjs; cannot read property '0' of undefined
- Chart.js Uncaught TypeError: Cannot read properties of undefined (reading 'options')
- Chart.js Cannot read property 'apply' of undefined
- Cannot read property 'length' of undefined for ChartJS when I use it inside React
- react-chartjs error Cannot read property 'Chart' of undefined
- ERROR TypeError: Cannot read property 'testMethod' of undefined
More Query from same tag
- Can't make chart js responsive
- Hiding the ticks on the x-axes clips the chart (Chart.JS)
- How to use excess vertical space in stacked bar chart?
- Increase space between largest bar and top grid line in charts.js
- How to replay animation chart.js
- ChartJS bar chart with legend which corresponds to each bar
- How to remove the line/rule of an axis in Chart.js?
- How to install Chart.js without a library?
- int Array with empty value
- Tooltip alignement with Chart.js v2
- Unable to separate elements of JSON
- Chart.js - graph responsivity / sizing
- How to have mutiple charts in a single page using Chart.js?
- How can I create a stacked bar chart with Charts.JS that displays relative rather than absolute values?
- ng2 charts bar chart need spacing between 2 bars in series Angular
- ChartJS: add a clickable text in title
- Horizontally align Chart.js y axes
- Programmatically change to another key in object
- Chartjs Doughnut disappears
- How to push Firestore data to ChartJS?
- JS node chart from SQL Server not updated
- Can Chart.js combines Line Chart and Bar Chart in one canvas
- How to add an image to a slice of a donut chart in chart.js?
- Angular 6 with chart.js TypeError: item is null
- Scrollable x axis with chart.js 2.1.4
- Mobile page loading in "zoomed" state
- Chartjs Custom Legend with Time on Y-axis
- Chart.js stepsize with multiple yAxis scales
- chart.js Line chart with different background colors for each section