dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.84k stars 587 forks source link

d3v3 Backward Compatibility #313

Closed alpercakan closed 6 years ago

alpercakan commented 6 years ago

About

Due to the breaking changes of d3v4, some versions of dagre-d3 does not work with d3v3. However, with some small changes, it can be made compatible with v3, at least for the basic use cases. (I am not sure if these changes solve all compatibility issues; however, it does solve the issues for basic usage).

Related Issue: #309

Changes

Here are the excerpts from the d3 documentation and changelog which explain the changes:

From the v3 -> v4 changelog

d3.svg.line ↦ d3.line

The line.interpolate and area.interpolate methods have been replaced with line.curve and area.curve.

In 3.x, the selection.enter and selection.exit methods were undefined until you called selection.data, resulting in a TypeError if you attempted to access them. In 4.0, now they simply return the empty selection if the selection has not been joined to data.

From the v4 doc:

If no element matches the specified selector for the current element, or if the selector is null, the group at the current index will be empty.