The initialization of Graph is instantiated through new
, and the parameter object needs to be passed in when instantiated. The currently supported parameters are as follows:
new G6.Graph(options: GraphOptions) => Graph
boolean Default:
false
whether to auto resize canvas
Automatically adjust the canvas size based on the window.onresize event
string
canvas background color
This color is used as the background color when exporting images
CanvasConfig
canvas config
The related configuration items under GraphOptions are shortcut configuration items, which will be converted to canvas configuration items
string | HTMLElement | Canvas
canvas container
Cursor
cursor style
number
device pixel ratio
Device pixel ratio for high-definition screens, default is window.devicePixelRatio
number
canvas height
If not set, the container height will be automatically obtained
(layer: 'background' | 'main' | 'label' | 'transient') => IRenderer
manually set renderer
G6 adopts a layered rendering method, divided into four layers: background, main, label, transient. Users can set the renderer of each layer canvas separately through this configuration item
number
canvas width
If not set, the container width will be automatically obtained
whether to auto fit
Every time render
is executed, it will be adapted according to autoFit
number | number[]
canvas padding
Usually, it will be adapted according to the padding when auto-fitting
number Default:
0
rotation angle
number
viewport x coordinate
number
viewport y coordinate
number Default:
1
zoom ratio
[number, number] Default:
[0.01, 10]
zoom range
Enable or disable global animation
When it is an animation options, the animation will be enabled, and the animation configuration will be used as the basic configuration of the global animation
(string | CustomBehaviorOption | ((this:Graph) =>CustomBehaviorOption))[]
Enable interactions
Combo options
See Combo
Data
See Data
Edge options
See Edge
BuiltInLayoutOptions | BaseLayoutOptions | BaseLayoutOptions[]
Layout options
See Layout
Node options
See Node
(string | CustomPluginOption | ((this:Graph) =>CustomPluginOption))[]
Enable plugins
false | 'light' | 'dark' | string
Theme
TransformOptions
Data transforms