-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
56 lines (48 loc) · 1.19 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pluginConfig from './config';
import MultiPlotComponent from './components/sidebar/Multiplot.vue';
import Service from './service';
const { GUI } = g3wsdk.gui;
const { Plugin:BasePlugin} = g3wsdk.core.plugin;
new (class Plugin extends BasePlugin {
constructor() {
const {name, i18n} = pluginConfig;
super({
name,
service: Service,
i18n
});
this.service.once('ready', () => {
if (this.registerPlugin(this.config.gid)) {
this.setupGUI();
this.setReady(true);
}
});
this.service.init(this.config);
}
setupGUI() {
this.createSideBarComponent(MultiPlotComponent,
{
id: 'qplotly',
title: 'plugins.qplotly.title',
open: false,
collapsible: true,
iconConfig: {
color: 'red',
icon: 'chart-area',
},
mobile: true,
events: {
open: {
when: 'before',
cb: async bool => {
await this.service.showChart(bool);
}
}
},
sidebarOptions: { position: 1 }
});
};
unload() {
this.service.clear();
}
});