Last active
February 12, 2024 19:56
-
-
Save magjac/e35164b35463f42dc7c273858148bf53 to your computer and use it in GitHub Desktop.
Render loaded .dot file (!useWorker)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="https://d3js.org/d3.v5.js"></script> | |
<script src="https://unpkg.com/[email protected]/viz.js" type="application/javascript"></script> | |
<script src="https://unpkg.com/[email protected]/build/d3-graphviz.js"></script> | |
<div id="graph" style="text-align: center;"></div> | |
<script> | |
<!-- This is a (failed) attempt to inhibit stack overflow. --> | |
Error.stackTraceLimit = Infinity | |
var graphviz = d3.select("#graph").graphviz(useWorker=false) | |
<!-- Increase memory available to avoid OOM --> | |
.totalMemory(Math.pow(2, 27)) | |
.transition(function () { | |
return d3.transition("main") | |
.ease(d3.easeLinear); | |
}) | |
.logEvents(true) | |
.on("initEnd", readDotAndRender); | |
function readDotAndRender() { | |
var filename = "simple.dot" | |
// var filename = "really_large_not_in_this_gist.dot" | |
fetch(filename, {mode:'no-cors'}) | |
.then(response => response.text()) | |
.then(text => graphviz.renderDot(text)); | |
} | |
readDotAndRender(); | |
</script> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph m { a; b; a->b; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment