Upgrade to 3.x
Previous
Export
Next
Developer Tools
Loading...
Compared to 2.x, 3.x mainly focuses on plugin consolidation (unified export), optimized default interactions, introduces animation capabilities, and adds virtual rendering support. The upgrade cost is low.
@antv/x6-plugin-xxxx packages are merged into the main @antv/x6 package and exported from there.@antv/x6; the existing graph.use(new Xxx()) usage remains unchanged.panning is enabled by default.Scroller, virtual rendering is available via virtual: true for large graphs.3.x merges commonly used plugins into @antv/x6, so you no longer need to install separate @antv/x6-plugin-xxxx packages.
{"@antv/x6": "^3.0.0"}
Remove the following dependencies if present:
@antv/x6-plugin-selection@antv/x6-plugin-transform@antv/x6-plugin-scroller@antv/x6-plugin-keyboard@antv/x6-plugin-history@antv/x6-plugin-clipboard@antv/x6-plugin-snapline@antv/x6-plugin-dnd@antv/x6-plugin-minimap@antv/x6-plugin-stencil@antv/x6-plugin-exportStarting from 3.x, the plugins above are exported from @antv/x6. Usage remains the same; simply replace the import path:
// 2.ximport { Scroller } from '@antv/x6-plugin-scroller'import { Selection } from '@antv/x6-plugin-selection'graph.use(new Scroller())graph.use(new Selection())// 3.ximport { Scroller, Selection } from '@antv/x6'graph.use(new Scroller())graph.use(new Selection())
3.x introduces animate and removes the 2.x transition API, making it easier to add effects to nodes and edges.
See more: Animation Docs.
panning is enabled by default (enabled: true). To disable, set panning: false.panning conflicts with Selection rubberband triggers, Selection takes precedence.Scroller, graph panning is disabled by default to avoid interaction conflicts, and virtual rendering can be enabled via virtual: true.@antv/x6-react-shape@^3.x, @antv/x6-vue-shape@^3.x, and @antv/x6-angular-shape@^3.x.{"@antv/x6-react-shape": "^3.0.0","@antv/x6-vue-shape": "^3.0.0","@antv/x6-angular-shape": "^3.0.0"}
Change 2.x Portal.getProvider() to 3.x getProvider():
// 2.ximport { Portal } from '@antv/x6-react-shape'const Provider = Portal.getProvider()// 3.ximport { getProvider } from '@antv/x6-react-shape'const Provider = getProvider()