Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property '_adapters' of undefined #33

Open
dclark3774 opened this issue May 17, 2021 · 4 comments
Open

Comments

@dclark3774
Copy link

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.

@kurkle
Copy link
Member

kurkle commented May 17, 2021

In what order are you including the scripts?

@dclark3774
Copy link
Author

<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>

@kurkle
Copy link
Member

kurkle commented May 17, 2021

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

@dclark3774
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants