Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.19 KB

embedded.md

File metadata and controls

31 lines (23 loc) · 1.19 KB

Embedded Figures

You may wish to embed figures produced with Blast Radius in other documents. You will need the following:

  1. An svg file and json document representing the graph and its layout. These are produced with Blast Radius, as follows
[...]$ terraform graph | blast-radius --svg > graph.svg
[...]$ terraform graph | blast-radius --json > graph.json
  1. javascript and css. You can find these in the .../blastradius/server/static directory. Copy these files to an appropriate location, and ammend the following includes to reflect those locations.
<script src="/static/js/d3.v4.js"></script>
<script src="/static/js/d3-tip.js"></script>
<script src="/static/js/blast-radius.js"></script>
<script src="/static/js/categories.js"></script>
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
  1. A uniquely identified DOM element, where the <svg> should appear, and a call to blastradius(...) somewhere after (usually at the end of the <html> document.
<div id="graph"></div> 
<script>
blastradius('#graph', '/graph.svg', '/graph.json');
</script>

That's it. Ideas to simplify this process are strongly desired.