Get plugin instance
getPluginInstance<T extends Plugin>(key: string): T;
Some plugins provide API methods for calling, such as the full-screen plugin can call the request
and exit
methods to request and exit full-screen
const fullscreen = graph.getPluginInstance('fullscreen');fullscreen.request();fullscreen.exit();
Parameter | Type | Description |
---|---|---|
key | string | 插件 key(在配置 plugin 时需要手动传入指定) |
Returns:
Type: T
Description: 插件实例
Get plugins options
getPlugins(): PluginOptions;
Returns:
Type: (string | CustomPluginOption | ((this:Graph) =>CustomPluginOption))[]
Description: 插件配置
Set plugins options
setPlugins(plugins: PluginOptions | ((prev: PluginOptions) => PluginOptions)): void;
The set plugin will completely replace the original plugin configuration. If you need to add a plugin, you can use the following method:
graph.setPlugins((plugins) => [...plugins, { key: 'grid-line' }]);
Parameter | Type | Description |
---|---|---|
plugins | (string | CustomPluginOption | ((this:Graph) =>CustomPluginOption))[] | ((prev: (string | CustomPluginOption | ((this:Graph) =>CustomPluginOption))[]) => (string | CustomPluginOption | ((this:Graph) =>CustomPluginOption))[]) | 插件配置 |
Returns:
Update plugin options
updatePlugin(plugin: UpdatePluginOption): void;
If you want to update a plugin, you must specify the key field in the plugin options, for example:
{plugins: [{ key: 'grid-line' }];}graph.updatePlugin({ key: 'grid-line', follow: true });
Parameter | Type | Description |
---|---|---|
plugin | UpdatePluginOption | 插件配置 |
Returns: