Last active
May 23, 2018 16:50
-
-
Save Capstan/a3279ce28fbe2dffa6219847f2761fd4 to your computer and use it in GitHub Desktop.
Render loaded .dot file
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
license: Apache-2.0 |
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/viz.js@1.8.1/viz.js" type="javascript/worker"></script> | |
<script src="https://unpkg.com/d3-graphviz@2.1.0/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() | |
<!-- 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 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