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

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

Closed
robertvunabandi opened this issue May 3, 2020 · 1 comment
Closed

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

robertvunabandi opened this issue May 3, 2020 · 1 comment

Comments

@robertvunabandi
Copy link

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

nvd3/src/core.js

Lines 85 to 107 in 447cce8

// When all queued charts are done rendering, nv.dispatch.render_end is invoked.
nv.render = function render(step) {
// number of graphs to generate in each timeout loop
step = step || 1;
nv.render.active = true;
nv.dispatch.render_start();
var renderLoop = function() {
var chart, graph;
for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) {
chart = graph.generate();
if (typeof graph.callback == typeof(Function)) graph.callback(chart);
}
nv.render.queue.splice(0, i);
if (nv.render.queue.length) {
setTimeout(renderLoop);
}
else {
nv.dispatch.render_end();

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
Copy link
Author

I didn't notice there was already a migration going on (#2217). I'll close this one.

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

1 participant