novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.14k forks source link

d3.js uses `dispatch.call` instead of `dispatch.<myevent>` #2221

Closed robertvunabandi closed 4 years ago

robertvunabandi commented 4 years ago

I was today trying to use nvd3, but I ran into a ton of issues and ended up giving up trying to fix all of them at once. I figured I may submit an issue. Here's a very simple issue that it has with the newer d3.js version (still on version 3 though, specifically version 5.16.0).

https://github.com/novus/nvd3/blob/447cce8c180a92fcabd571cca410760deb3a2c1d/src/core.js#L85-L107

This section of the code calls utils.dispatch.render_start and utils.dispatch.render_end, but instead it must call utils.dispatch.call('render_start') and utils.dispatch.call('render_end'), as the documentation says:

# dispatch.call(type[, that[, arguments…]]) <> Like function.call, invokes each registered callback for the specified type, passing the callback the specified arguments, with that as the this context. See dispatch.apply for more information.

This is my first time ever trying this tool, so I am assuming this change was made in newer versions of d3.js. That's why this was a bug.


Other issues I ran into were mainly calling d3.scale.<something>. Seems like all the scale.<something> were removed for simpler notations using d3.scale<something> (also this). I also ran into an issue with the axis stuff. See here. I expect there are more issues.

robertvunabandi commented 4 years ago

I didn't notice there was already a migration going on (https://github.com/novus/nvd3/issues/2217). I'll close this one.