chartjs / chartjs-plugin-deferred

Chart.js plugin to defer initial chart updates
https://chartjs-plugin-deferred.netlify.app/
MIT License
109 stars 21 forks source link

Will this be updated to be compatible with ChartJS 3.0? #15

Closed jackyaz closed 2 years ago

gregh3269 commented 3 years ago

v3.1.0 I get Uncaught TypeError: Chart.defaults.global is undefined /**

Cheers

john-rock commented 3 years ago

Chartjs version: 3.3.2 Plugin version: 1.0.2

I'm getting - e.defaults.global is undefined

gregh3269 commented 3 years ago

Would be good to get this fixed as @2.9.4 is the last version plug-in works on.

cysieks commented 3 years ago

I was able to make it work with chart js 3: Here is fork: https://github.com/cysieks/chartjs-plugin-deferred

gregh3269 commented 3 years ago

@cysieks great, works now, but load does not seem to be deferred and loads immediately? (rechecked)

mloit commented 3 years ago

The parameter lists for the beforeInit, and beforeDatasetsUpdate are incorrect. As coded they are (chart, options), but they need to be (chart, args, options) for the options to be seen, without it it is defaulting to 0 because it thinks they are undefined.. Changing that seems to have made it work for me. I had to make some other changes to get it to load, but once i did that, it all seems to work now. @cysieks thanks for the fork!

I'm still chasing down another issue. Using the plugin seems to trigger an onComplete event for the chart immediately on load, which causes a problem for me as I have some other code dependent on that event happening when the chart is drawn. But thanks to this fork, things are moving forward.

simonbrunel commented 2 years ago

Version 2.0.0-beta.1 has been released and is compatible with Chart.js v3.