Skip to main content
Module

x/graphviz/render_dot.ts>renderDot

🦕 Simple Graphviz library for Deno.
Latest
function renderDot
import { renderDot } from "https://deno.land/x/graphviz@v0.2.1/render_dot.ts";

Run dot command and output result to the specified path.

import * as path from "https://deno.land/std/path/mod.ts";
import { digraph, attribute, renderDot } from "https://deno.land/x/graphviz/mod.ts";
const G = digraph("G", (g) => {
  const a = g.node("aa");
  const b = g.node("bb");
  const c = g.node("cc");
  g.edge([a, b, c], {
    [attribute.color]: "red",
  });
  g.subgraph("A", (A) => {
    const Aa = A.node("Aaa", {
      [attribute.color]: "pink",
    });
    const Ab = A.node("Abb", {
      [attribute.color]: "violet",
    });
    const Ac = A.node("Acc");
    A.edge([Aa.port({ compass: "c" }), Ab, Ac, "E"], {
      [attribute.color]: "red",
    });
  });
});
const __dirname = new URL(".", import.meta.url).pathname;
await renderDot(G, path.resolve(__dirname, "./callback.svg"), {
  format: "svg",
});

Requires allow-write, allow-run permission.

Parameters

dot: Dot
output: string
optional
unnamed 2: { format?:
| "png"
| "svg"
| "json"
| "jpg"
| "pdf"
| "xdot"
; dotCommand?: string; }
= [UNSUPPORTED]

Returns

Promise<void>