Blame view

js/app/views/PlotlyContainer.js 1.4 KB
3ccb373f   furkan   #6899 - Done
1
2
Ext.define('amdaUI.PlotlyContainer', {
    extend: 'Ext.container.Container',
0dd3cab3   Benjamin Renard   Fix bug with visu...
3
4
    
    alias: 'widget.PlotlyContainer',
3ccb373f   furkan   #6899 - Done
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

    constructor: function(config) {
            this.init(config);
            this.callParent(arguments);
    },

    plot : function(data,layout) {
        Plotly.newPlot( this.getEl().dom, data,layout,{displaylogo: false,modeBarButtonsToRemove: ['lasso2d','select2d']});
    },

    init : function(config) {
            var me = this;

            var myConf = {
                    width: 200,
                    height: 200,
                    listeners: {
                            afterrender: function(container, eOpts) {
                                    if (config.data) {
                                            me.plot(config.data, config.layout);
                                    }
                            },
                            resize: function(container, eOpts) {
0dd3cab3   Benjamin Renard   Fix bug with visu...
28
                                   var update = {
3ccb373f   furkan   #6899 - Done
29
30
31
32
33
34
35
36
37
38
39
40
                                            width: me.getEl().getWidth(),
                                            height: me.getEl().getHeight()
                                    };
                                if (config.data)
                                    Plotly.relayout(me.getEl().dom, update);
                            }
                    }
            };

            Ext.apply (this , Ext.apply (arguments, myConf));
    }
});