g6/plugins/layout.circle/index.js

30 lines
523 B
JavaScript
Raw Normal View History

2018-06-05 23:58:10 +08:00
/**
* @fileOverview 圆图布局
* @author huangtonger@aliyun.com
*/
2018-06-13 17:38:00 +08:00
const G6 = require('../../src/index');
2018-06-05 23:58:10 +08:00
const Layout = require('./layout');
G6.Layouts.Circle = Layout;
class Plugin {
constructor(options) {
this.options = options;
}
init() {
const graph = this.graph;
graph.on('beforeinit', () => {
const layout = new Layout({
graph,
...this.options
});
graph.set('layout', layout);
});
}
}
G6.Plugins['layout.circle'] = Plugin;
module.exports = Plugin;