Neilos / bihisankey

A d3 javascript library/plugin for drawing bi-directional hierarchical sankey diagrams
68 stars 24 forks source link

Not compatible with D3 v4? #9

Open northam opened 7 years ago

northam commented 7 years ago

When I use the latest version of D3 with the tag: <script src="https://d3js.org/d3.v4.min.js"></script> I have an error in app.js line 70: d3.scale is undefined.

Neilos commented 7 years ago

Thanks @northam. d3 v4 has split out the functionality into separate libraries. You can include the additional and now separate library as follows:

<script src="https://d3js.org/d3-scale.v1.min.js"></script>

There are lots of other separate libraries as well, so if you run into any other similar issues you can solve in the same way

<script src="https://d3js.org/d3-array.v1.min.js"></script>
<script src="https://d3js.org/d3-collection.v1.min.js"></script>
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="https://d3js.org/d3-format.v1.min.js"></script>
<script src="https://d3js.org/d3-interpolate.v1.min.js"></script>
<script src="https://d3js.org/d3-time.v1.min.js"></script>
<script src="https://d3js.org/d3-time-format.v2.min.js"></script>
...
etc
northam commented 7 years ago

Nope. Default bundle of v4 combines all microlibraries. Error in your library is due to d3.scale.ordinal() has become d3.scaleOrdinal() in v4, and d3.behavior.drag has been renamed to d3.drag. There are more changes, which require revise the code.

Neilos commented 7 years ago

Ahh. I was totally wrong. Sorry. Might not have time to change this for a while.

northam commented 7 years ago

Compatibility with the latest D3 would be nice. I did some modifications to your plugin to enhance styling and customization in my forked branch (with examples): https://github.com/northam/styled_sankey

mkpasala commented 5 years ago

@northam or @Neilos how can I customize the node shape to a polygon as shown in the below link . https://www.wikibudgets.org/sankey?id=2gamvvoaf