Skip to content

Instantly share code, notes, and snippets.

@magjac
Last active September 21, 2024 15:56
Show Gist options
  • Save magjac/a23d1f1405c2334f288a9cca4c0ef05b to your computer and use it in GitHub Desktop.
Save magjac/a23d1f1405c2334f288a9cca4c0ef05b to your computer and use it in GitHub Desktop.
d3-graphviz Basic Example
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v7.min.js"></script>
<script src="https://unpkg.com/@hpcc-js/wasm@2.20.0/dist/graphviz.umd.js"></script>
<script src="https://unpkg.com/d3-graphviz@5.6.0/build/d3-graphviz.js"></script>
<div id="graph" style="text-align: center;"></div>
<script>
d3.select("#graph").graphviz()
.renderDot('digraph {a -> b}');
</script>
@PollRobots
Copy link

The d3 src doesn't work for me, I replaced with

<script src="https://unpkg.com/d3@5.16.0/dist/d3.min.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment