ts-graphviz
    Preparing search index...

    Function renderToDot

    • Converts the given React element to DOT language asynchronously.

      This function creates a Graphviz root, renders the element, and returns the DOT representation.

      Type Parameters

      Parameters

      Returns Promise<string>

      const dot = await renderToDot(
      <Digraph id="example">
      <Node id="a" />
      <Node id="b" />
      <Edge targets={['a', 'b']} />
      </Digraph>
      );
      console.log(dot);
      // digraph "example" {
      // "a";
      // "b";
      // "a" -> "b";
      // }
      const container = new DigraphModel('main');
      const dot = await renderToDot(
      <>
      <Node id="a" />
      <Subgraph id="cluster_sub">
      <Node id="b" />
      </Subgraph>
      <Edge targets={['a', 'b']} />
      </>,
      { container }
      );
      console.log(dot);
      // digraph "main" {
      // "a";
      // subgraph "cluster_sub" {
      // "b";
      // }
      // "a" -> "b";
      // }