chartjs/chartjs-adapter-moment

Uncaught TypeError: Cannot read property '_adapters' of undefined

dclark3774 opened this issue · 4 comments

Hello maintainers!

I am working with Chart.js and Chartjs-adapter-moment to display a historical trend of up to 19 datasets using Flask. I am running into the issue where the adapter is returning the below error:

Uncaught TypeError: Cannot read property '_adapters' of undefined
at chartjs-adapter-moment.min.js:formatted:29
at chartjs-adapter-moment.min.js:formatted:8
at chartjs-adapter-moment.min.js:formatted:9

As well as this additional chart.js error:

Uncaught TypeError: Cannot read property 'left' of undefined
at _isPointInArea (chart.js:1339)
at getNearestItems (chart.js:1775)
at nearest (chart.js:1858)
at Chart.getElementsAtEventForMode (chart.js:6857)
at Chart._handleEvent (chart.js:7091)
at Chart._eventHandler (chart.js:7074)
at listener (chart.js:6971)
at Chart.event (chart.js:2431)
at chart.js:34

Versions:
Chart.js 3.2.0
Moment.js 2.29.1
Chartjs-adapter-momentjs 1.0.0

The time format is ISO 8601, and I had the implementation working on Chart.js version 2.6.0 but I needed to upgrade to get the zoom plugin to work. And now the chart will not build with the two above errors.

In what order are you including the scripts?

<script src="public/momentjs/moment.js"></script>
<script src="public/momentjs/chartjs-adapter-moment.min.js"></script>
<script type="text/javascript" src="public/chartjs/chart.js"></script>
<script type="text/javascript" src="public/hammerjs/hammer.js"></script>
<script type="text/javascript" src="public/chartjs/chartjs-plugin-zoom.min.js"></script>

move the chartjs-adapter-moment after chart.js
readme

That solved the major issue here, I am now getting this warning:

DevTools failed to load SourceMap: Could not load content for http://192.168.0.3:5000/public/momentjs/chartjs-adapter-moment.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

I can not find the source for the SourceMap file, and even if I change to the link provided in the readme I get the same result.
DevTools failed to load SourceMap: Could not load content for https://cdn.jsdelivr.net/npm/chartjs-adapter-moment.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE