• Convert the given element to Graphviz model.

    Type Parameters

    Parameters

    • element: ReactElement<any, string | JSXElementConstructor<any>>
    • Optional container: T

    Returns T

    Example: Example of giving a cluster as a container with the second argument.

    import React, { FC } from 'react';
    import { digraph, toDot } from 'ts-graphviz';
    import { Node, Subgraph, render, Edge } from '@ts-graphviz/react';

    const Example: FC = () => (
    <>
    <Node id="a" />

    <Subgraph id="my_cluster">
    <Node id="b" />
    </Subgraph>
    <Edge targets={['b', 'a']} />
    </>
    );

    const G = digraph((g) => render(<Example />, g));
    console.log(toDot(G));
    // digraph {
    // "a";
    // subgraph "my_cluster" {
    // "b";
    // }
    // "b" -> "a";
    // }

Generated using TypeDoc