diff options
| author | Cliff Click <cliffc@acm.org> | 2026-09-22 11:25:05 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-09-22 11:25:05 -0700 |
| commit | 29fb671e69f90ad3b04c6fa8d746caf857f89e77 (patch) | |
| tree | 2f39d082f8a6de6a2b60b66406f8c9f0190d25c2 /graph/web/legacy.js | |
| parent | 1d961838cff168a101069d08a8ab6594f49f0911 (diff) | |
| download | Simple-29fb671e69f90ad3b04c6fa8d746caf857f89e77.tar.gz Simple-29fb671e69f90ad3b04c6fa8d746caf857f89e77.zip | |
Add shared graph viewer to all chapters
Diffstat (limited to 'graph/web/legacy.js')
| -rw-r--r-- | graph/web/legacy.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/graph/web/legacy.js b/graph/web/legacy.js deleted file mode 100644 index 4c1b7ef8..00000000 --- a/graph/web/legacy.js +++ /dev/null @@ -1,25 +0,0 @@ -// Only earlier chapters need Graphviz. Load it on the first bare-DOT frame. -let dotView; -async function drawDot(dot) { - if (!dotView) { - dotView = (async () => { - for (const src of ["vendor/graphviz.umd.js", "vendor/d3-graphviz.js"]) { - await new Promise((resolve, reject) => { - const script = document.createElement("script"); - script.src = src; script.onload = resolve; - script.onerror = () => reject(new Error("Cannot load " + src)); - document.head.append(script); - }); - } - return new Promise((resolve, reject) => { - const view = d3.select("#dot").graphviz({useWorker: false, fit: true}) - .onerror(reject).on("initEnd", () => resolve(view)) - .transition(() => d3.transition("main").ease(d3.easeLinear).duration(500)); - }); - })(); - } - const view = await dotView; - const host = document.getElementById("dot"); - view.width(host.clientWidth).height(host.clientHeight); - await new Promise((resolve, reject) => view.onerror(reject).renderDot(dot, resolve)); -} |
