Skip to main content

GraphEditor

A React component to create a Graph Editor easily, you can just pass data and render methods.

Examples#

function MyGraphEditor() {
const [data, setData] = React.useState({
nodes: [
{ id: "1", position: { x: 10, y: 10 } },
{ id: "2", position: { x: 300, y: 100 } },
],
edges: [{ id: "edge:1", source: "1", target: "2" }],
});
return (
<Graph
style={{ width: "100%", height: 250 }}
nodes={data.nodes}
edges={data.edges}
/>
);
}

Reference#

Props#

NameTypeDescription
actionBar?ActionBarConfigConfig for ActionBar
children?ReactNode-
config?GraphEditorConfigGraphEditor config data for all operations.
dataBar?DataBarPropsConfig for DataBar
drawLine?DrawLineThe function to draw line for edge connection vectors
edgesEdgeData[]Edge data list to render
eventHistory?EventHistoryEvent history will be displayed on SettingsBar
events?RecordedEvent[]Recorded events will be displayed on SettingsBar
extraData?anyTo rerender the graph when the extra data changes
graphConfig?GraphConfigAll graph config data for nodes and edges. It will supply the config data for the graph.
isFocusMode?booleanFocus mode for chunk stacked nodes
isLoading?booleanDisplay loading indicator
label?GraphLabelDataConfig for labels of nodes and edges
modals?ObjectModal components for displaying modal dialogs
modals.ElementSettings?ModalComponentProps-
mode?EditorModeEditor mode for changing actions and mouse icon
networkStatistics?NetworkStatisticsCalculated network statistics will be displayed on SettingsBar
nodesNodeData[]Node data list to render
onBoxSelection?OnBoxSelectionEvent handler for box selection event. It gives the selected nodes
onEvent?OnEventEvent handler for all events that are emitted by the graph editor.
playlists?Playlist[]Events playlist will be displayed on SettingsBar
preferencesModal?PreferencesModalPropsConfig for PreferencesModal
previousDataList?PreviousData[]Focus mode stack
renderClusterNode?RenderClusterNodeIt returns a PIXI.DisplayObject instance as React.Node for the cluster node
renderEdge?GraphEditorRenderEdge<RenderElementAdditionalInfo>It returns a PIXI.DisplayObject instance as React.Node for the edge
renderNode?GraphEditorRenderNode<RenderElementAdditionalInfo>It returns a PIXI.DisplayObject instance as React.Node for the node
selectedElementIds?string[]It gives the selected nodes. It is used for selected node highlighting and DataBar
settingsBar?SettingsBarPropsConfig for SettingsBar
style?ViewProps["style"]Style for graph container view
renderMoreAction?() => [ReactElement]<any, string | JSXElementConstructor<any>>-