Options
All
  • Public
  • Public/Protected
  • All
Menu

Graph powered by ngx-charts library.

Example of usage

Simple graph

export const component: DraymanComponent = async ({ forceUpdate }) => {

    const links = [{
        id: 'a',
        source: 'first',
        target: 'second',
        label: 'is parent of'
    }, {
        id: 'b',
        source: 'first',
        target: 'third',
        label: 'custom label'
    }];

    return () => (
        <div style={{ height: '300px', width: '300px' }}>
            <button
                onClick={async () => {
                    links.push({
                        id: `new-link-${links.length}`,
                        source: 'first',
                        target: 'third',
                        label: 'new link'
                    })
                    await forceUpdate();
                }}
            >Add link</button>
            <drayman-ngx-graph
                showMiniMap
                links={links}
                nodes={[{
                    id: 'first',
                    label: 'A'
                }, {
                    id: 'second',
                    label: 'B'
                }, {
                    id: 'third',
                    label: 'C',
                    data: {
                        customColor: 'orange'
                    }
                }]}
            />
        </div>
    );
}

Hierarchy

Index

Properties

Optional autoCenter

autoCenter: boolean

Center the graph in the viewport when the graph is updated.

Optional autoZoom

autoZoom: boolean

Automatically zoom the graph to fit in the avialable viewport when the graph is updated.

Optional clusters

clusters: any

List of cluster nodes.

Optional draggingEnabled

draggingEnabled: boolean

Enable dragging nodes.

Optional links

links: any[]

List of graph edges.

Optional nodes

nodes: any[]

List of graph nodes.

Optional onLinkClick

onLinkClick: ElementEvent<{ sourceNodeId: any; targetNodeId: any }>

Executed when user clicks on a link. Emits IDs of the source and target nodes.

Optional onNodeClick

onNodeClick: ElementEvent<{ nodeId: any }>

Executed when user clicks on a node.

Optional ref

ref: string

Optional showMiniMap

showMiniMap: boolean

Show/hide minimap.

Optional style

style: CSS