chartjs/chartjs-plugin-deferred

Will this be updated to be compatible with ChartJS 3.0?

jackyaz opened this issue · 7 comments

Will this be updated to be compatible with ChartJS 3.0?

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

  • Plugin based on discussion from Chart.js issue #2745.
  • @see chartjs/Chart.js#2745
    */
    Chart.defaults.global.plugins.deferred = {
    xOffset: 0,
    yOffset: 0,
    delay: 0
    };

Cheers

Chartjs version: 3.3.2
Plugin version: 1.0.2

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

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

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

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

mloit commented

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.

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