-
Notifications
You must be signed in to change notification settings - Fork 94
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
Support D3 4.x #62
Comments
I almost think Mike Bostock got a kick out of making the upgrade to D3 v4.x as painful and under-documented as possible. For some reason, all of the examples assume that the d3 has been loaded in a General APIGenerally, anything that was previously accessible from // Old
import d3 from 'd3';
d3.range(0, 10);
// New
import * as d3 from 'd3';
d3.range(0, 10); Multi-attributesAs documented, // Old
import d3 from 'd3';
d3.select('#a').attr({ class: 'b'});
// New
import { select } from 'd3-selection';
import 'd3-selection-multi'; // Will NOT work on `import * as d3 from 'd3';`
select('#a').attrs({ class: 'b' }); EventsEvents have been overhauled to support ES6 arrow functions, which is good. What's not good is the lack of documentation. The new behavior is weakly mentioned in an issue. What is not mentioned is that // Old
import d3 from 'd3';
d3.select('#target').on('mouseover', () => {
const node = d3.event.target;
});
// New
import { select } from 'd3-selection';
select('#target').on('mouseover', (data, groupIndex, nodes) => {
const node = nodes[0];
}); DOM NodesIn D3 v3.x, there was no good way to get the individual nodes from a // Old
import d3 from 'd3';
const node = d3.select('#target')[0];
const nodes = d3.selectAll('#target path')[0];
// New
import { select, selectAll } from 'd3-selection';
const node = select('#target').node();
const nodes = selectAll('#target path').nodes(); |
D3 4.x is out, but includes a variety of backwards-incompatible changes. Will still need to support 3.x for a while.
The text was updated successfully, but these errors were encountered: