mirror of
https://gitee.com/antv/g6.git
synced 2024-12-16 02:21:25 +08:00
339f28c564
* feat: fix plugin demo with extensions * Chore:check translate (#4886) * feat: check plugins * chore: update docs
28 lines
604 B
TypeScript
28 lines
604 B
TypeScript
import { Graph as BaseGraph, Extensions, Util, extend } from '@antv/g6';
|
|
|
|
const Graph = extend(BaseGraph, {
|
|
plugins: {
|
|
toolbar: Extensions.Toolbar,
|
|
},
|
|
});
|
|
|
|
const container = document.getElementById('container') as HTMLElement;
|
|
const width = container.scrollWidth;
|
|
const height = (container.scrollHeight || 500) - 110;
|
|
const data = Util.mock(6).circle();
|
|
const layout = {
|
|
type: 'grid',
|
|
};
|
|
|
|
new Graph({
|
|
container: 'container',
|
|
width,
|
|
height,
|
|
data,
|
|
layout,
|
|
modes: {
|
|
default: ['drag-canvas', 'drag-node', 'zoom-canvas'],
|
|
},
|
|
plugins: [{ type: 'toolbar', key: 'toolbar-1' }],
|
|
});
|