magjac / d3-graphviz

Graphviz DOT rendering and animated transitions using D3
BSD 3-Clause "New" or "Revised" License
1.68k stars 103 forks source link

Did Transitions change? #236

Closed Vithanco closed 2 years ago

Vithanco commented 2 years ago

I try to use a transition as seen in https://bl.ocks.org/magjac/28a70231e2c9dddb84b3b20f450a215f However, when I try the code

.transition(function () {
        return d3.transition()
          .delay(100)
          .duration(1000)
      })

then I get the error

image

Did something change from the time the example was created towards the latest versions? D3 made a version jump from v5 in the example to v7.6.1 if I understand this correctly. Does the example need an adjustment?

magjac commented 2 years ago

You have the same example at https://github.com/magjac/d3-graphviz/blob/master/examples/demo-delete-nodes-and-edges.html. It works fine with this patch:

diff --git a/examples/demo-delete-nodes-and-edges.html b/examples/demo-delete-nodes-and-edges.html
index d593f12..74c4a94 100644
--- a/examples/demo-delete-nodes-and-edges.html
+++ b/examples/demo-delete-nodes-and-edges.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
 <body>
-<script src="../node_modules/d3/dist/d3.js"></script>
+<script src="//d3js.org/d3.v7.min.js"></script>
 <script src="../node_modules/@hpcc-js/wasm/dist/index.js" type="javascript/worker"></script>
 <script src="../build/d3-graphviz.js"></script>
 <div id="graph" style="text-align: center;"></div>

So there's probably no problem with D3 v7 in this case although d3-graphviz is only guaranteed to be compatible with D3 v6.