Behavior
Reading needs 1 minutes
Get behaviors options
getBehaviors(): BehaviorOptions;
Returns:
Type: (string | CustomBehaviorOption | ((this:Graph) =>CustomBehaviorOption))[]
Description: 交互配置
Set behaviors
setBehaviors(behaviors: BehaviorOptions | ((prev: BehaviorOptions) => BehaviorOptions)): void;
The set behavior will completely replace the original behavior. If you need to add behavior, you can use the following method:
graph.setBehaviors((behaviors) => [...behaviors, { type: 'zoom-canvas' }]);
Parameter | Type | Description |
---|---|---|
behaviors | (string | CustomBehaviorOption | ((this:Graph) =>CustomBehaviorOption))[] | ((prev: (string | CustomBehaviorOption | ((this:Graph) =>CustomBehaviorOption))[]) => (string | CustomBehaviorOption | ((this:Graph) =>CustomBehaviorOption))[]) | 交互配置 |
Returns:
Update specified behavior options
updateBehavior(behavior: UpdateBehaviorOption): void;
If you want to update a behavior, you must specify the key field in the behavior options, for example:
{behaviors: [{ type: 'zoom-canvas', key: 'zoom-canvas' }];}graph.updateBehavior({ key: 'zoom-canvas', enable: false });
Parameter | Type | Description |
---|---|---|
behavior | UpdateBehaviorOption | 交互配置 |
Returns: