g6/plugins/layout.grid/index.js

26 lines
475 B
JavaScript
Raw Normal View History

2018-06-05 23:58:10 +08:00
/**
* @fileOverview 栅格布局
* @author huangtonger@aliyun.com
*/
2018-06-14 11:50:35 +08:00
const G6 = require('@antv/g6');
2018-06-05 23:58:10 +08:00
const Layout = require('./layout');
G6.Layouts.Grid = Layout;
class Plugin {
constructor(options) {
this.options = options;
}
init() {
const graph = this.graph;
graph.on('beforeinit', () => {
const layout = new Layout(this.options);
graph.set('layout', layout);
});
}
}
G6.Plugins['layout.grid'] = Plugin;
module.exports = Plugin;