Analysis component

4 min read

<ContextMenu />

Props:

  PropertyTypeRequiredDescription
bindType'node' | 'edge' | 'canvas'notype of the monitor target and the default value is node
graphGraphnoG6 Instance
optionsMenuItemType[]noconfiguration of menu
render(props: RenderProps) => React.ReactElementnorendering function of custom menu
onContextmenu(e: G6Event, graph: Graph) => boolean;noThe hook function of the right-click menu. Return false if you want to prevent appearing of the menu

注意:options 和 render 必须提供一个。

RenderProps

Argument of render function which extends Props of ContextMenu:

  PropertyTypeRequiredDescription
onClose( ) => void;noCalled when closing menu

configuration of MenuItem

  PropertyTypeRequiredDescription
keystringyeskey of React component
visiblebooleannoWhether the item is visible or not
iconTypestringnoantd icon Type
titlestringnotext of item
widthnumbernowidth of item
heightnumbernoheight of item
onClick(props: ContainerProps) => void;noCalled when clicking item
render(props: ContainerProps) => ReactElement;nocustom rendering function

ContainerProps

arguments of Clicking and rendering MenuItem

  PropertyTypeRequiredDescription
graphGraphnoG6 instance
menuMenuItemType[ ]noconfiguration of menu
onClose( ) => void;noCalled when closing menu

<Toolbar /> component

Props:

  PropertyTypeRequiredDescription
graphDOMHTMLElementyesMounted DOM of G6 which will be injected to children of Graphin automatically
graphGraphnoG6 instance
apisApisnoGraphin API
classNamestringnoclassName
graphVars{ width?: number; height: number; }nograph infomation of G6
directionhorizontal | verticalnoDirection of Toolbar
render(props: RenderProps) => MenuItem[ ]nocustom rendering function of menu
  PropertyTypeRequiredDescription
idstringyesUnique identifier
namestringyesdisplay text of menu
iconstringyesicon Type(antd) of menu
actionhorizontal | verticalyesCalled when clicking items
disabledbooleannoWhether disabled select
styleCSSPropertiesnocustom style
renderTooltip() => ReactElement;nocustom rendering function of tooltip

RenderProps

  PropertyTypeRequiredDescription
toolbarCfgMenuItem[]yesDefault configuration of toolbar
graphGraphnoG6 instance
apisApisnoGraphin API
graphVars{ width?: number; height: number; }noGraph infomation of G6
directionhorizontal | verticalnoDirection of Toolbar

<Legend />

Props:

  PropertyTypeRequiredDescription
optionsOption[]yesitem config
onchange(checked: Option, newOptions: Option[], props: LegendProps) => any;noCalled when clicking item
graphGraphnoG6 instance
apisApisnoGraphin API

Option

  PropertyTypeRequiredDescription
labelstringyeslabel name
colorstringyesdot background
valuestring | numberyesevery Item's key
checkedbooleannoWhether selected