Created
May 23, 2018 16:58
-
-
Save Capstan/57b8ba0dde7c65839125f37d7a22cb1f to your computer and use it in GitHub Desktop.
Render loaded .dot file (!useWorker)
This file contains hidden or 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
license: Apache-2.0 |
This file contains hidden or 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)); | |
} | |
</script> | |
</body> |
This file contains hidden or 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