Graphin

4 min read

This is the API documentation for the <Graphin/> component.

Props

  PropertyTypeRequiredDescription
dataDatayesnode and edge data of graph
layoutLayoutnoconfiguration of layout
optionsOptionsnoconfiguration of G6
refRefnoRef of Graphin
extendExtendnoExtended Configuration
registerRegisternocustomize NodeShape, EdgeShape and behavior using the G6 API

Data

Node and edge data of graph

  PropertyTypeRequiredDescription
nodesNode[]yescollection of nodes
edgesEdge[]yescollection of edges

Node

Node

  PropertyTypeRequiredDescription
idstringyesunique id
dataNodeDatayessource data
shapestringnotype of the node (NodeShape), the default value is CircleNode.
styleNodeDefaultStylenostyle information corresponding to NodeShape
xnumbernothe x coordinate of the node
ynumbernothe y coordinate of the node
layoutNodeLayoutTypenolayout
[key:string]anynocustom property

NodeData

The key-value data that comes with the node. properties are typically returned from the backend, indicating some properties that describe the node.

  PropertyTypeRequiredDescription
idstringyesunique identifier of a node
labelstringnotext information of node
propertiesany[]nonode properties
[key:string]anynoOther Properties

NodeDefaultStyle

Style information corresponding to NodeShape

  PropertyDefaultDescription
nodeSize20size of node
primaryColor#9900EFmain color of node
fontSize12font size of text
fontColor#3b3b3bfont color of text
dark#eeecolor of the node when it is darkened

Edge

Edge

  PropertyTypeRequiredDescription
data{ properties: any[], [key: string]:any }yesdata of edge
sourcestringyesID of source node
targetstringyesID of target node
shapestringnoedge type, default value is LineEdge
labelstringnotext information of edge
styleanynostyle of edge
springnumbernospring length of the edge which is used when the layout is force layout
[key:string]anynocustom properties

Layout

Layout configuration, see Layout for details.

Extend

Extended configuration, see [Extend] (/zh/docs/api/extend) for details.

Register

Register is used to customize NodeShape, EdgeShape and behavior using the G6 API directly. See Register for details.

Options

See [G6 Options] (https://www.yuque.com/antv/g6/graph#VjayE) for details.

Ref

  PropertyTypeRequiredDescription
graphGraphyesgraph instance of G6
apisApisnoAPI provided by Graphin

Apis

  PropertyTypeDescription
search(words: string) => Node[ ]search for nodes, keywords can be id, label, or value of property
highlight(nodeIds: string[ ]) => voidhighlight Node
clear( ) => voidreset Graphin
getInfo{ layouts: { desc:string;icon:string;name:string}[ ], count: { nodes: number;edges:number; } }get rendering data
history{ redo: ( ) => void;undo: ( ) => void;save: ( ) => void;getInfo: ( ) => { currentStep:number;allStep:number;disableRedo:number;disableUndo:number;};}History of Operations