renderDot does not trigger callback
See original GitHub issueThis works (renders the graph in data
):
d3.select("#graph").graphviz().renderDot(data);
So does this (as above, with an anonymous callback function), except that I don’t get a console message; renderDot does not trigger the callback:
d3.select("#graph").graphviz().renderDot(data, function(){console.log("Ended")});
I’m interested in using a callback function because I want to zoom the graph to fit the viewport. That’s what I want to do in the callback (although, I’m still working out the “zoom to fit” function).
I’m using latest Google Chrome on Windows 10.
In case it’s related, the Chrome console shows the following error (which doesn’t seem to affect the rendering):
Invalid asm.js: Function definition doesn’t match use - viz.js:37
Software versions:
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/viz.js@1.8.0/viz.js" type="javascript/worker"></script>
<script src="https://unpkg.com/d3-graphviz@1.0.1/build/d3-graphviz.min.js"></script>
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
d3-graphviz: incorrect rendering if I use same ... - Stack Overflow
Use renderDot() function with specific callback. Call renderDot() again to draw another one, with multi-line, bold font label; Render again with ...
Read more >click/selection event callbacks from GraphViz/DOT SVGs?
I am working with graph data models that are very nicely visualizable ... The closest was Hyperlink in Graphviz node doesn't work which...
Read more >Events - backbonejs - Google Sites
Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks....
Read more >d3-graphviz/README.md - UNPKG
91, This will always work, but will not be optimal if the script is used in a ... [<>](https://github.com/magjac/d3-graphviz/blob/master/src/renderDot.js ...
Read more >How to useMemo and useCallback: you can remove most of ...
If you're not completely new to React, you're probably already at least familiar with useMemo and useCallback hooks. And if you work on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you! I’m now using a
.renderDot
callback successfully in v1.1.0I’ll look into this issue in the nearest couple of days. I the meantime, you can use:
d3.select("#graph").graphviz().renderDot(data).on("end", function() {console.log("Ended")});
See this example.
Regarding the “zoom to fit” function, you might want to use the
.attributer()
method instead of a callback. See https://github.com/magjac/d3-graphviz/issues/7Thanks for submitting this issue. If you are using this library, don’t forget to “Watch” it to stay tuned for updates or even “Star” it if you like it.
You can also use Stack Overflow tags d3.js & graphviz to ask for help. Although I make an effort to assist everyone that asks, I am not always available to provide help promptly or directly.