Extend

2 min read

The property extend of component <Graphin/> is used to extend layout, NodeShape and Marker of Graphin.

  PropertyTypeRequiredDescription
layout(graphin: Graphin, prevProps: GraphinProps) => ExtendLayout[ ]nocustom Layout
nodeShape(node: Node) => ExtendNodeShape[ ]nocustom Node
marker( ) => ExtendMarker[ ]nocustom Icon

ExtendLayout

Configuration of custom layout

  PropertyTypeRequiredDescription
namestringyesname of the layout
descstringyesname of the layout
iconstringyesantd icon type
layout(data: Data, options: LayoutOption) => { data: Data; forceSimulation?: ForceSimulation;}yesa function for calculating the layout which accept nodes as arguments and return nodes with location

ExendNodeShape

Configuration of custom node

  PropertyTypeRequiredDescription
shapestringyesname of custom NodeShape
shapeComponentsShapeComponent[ ]yes构成 Shape 的组件数组

ShapeComponent

  PropertyTypeRequiredDescription
shapestringyesname of built-in nodeShape in G6
attrsAttrsyesProperty of shape

ExendMarker

Configuration of custom marker

  PropertyTypeRequiredDescription
namestringyesicon type
pathstringyessvg path