Blame view

js/app/views/PlotlyContainer.js 1.36 KB
3ccb373f   furkan   #6899 - Done
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
Ext.define('amdaUI.PlotlyContainer', {
    extend: 'Ext.container.Container',

    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) {
                                    var update = {
                                            width: me.getEl().getWidth(),
                                            height: me.getEl().getHeight()
                                    };
                                if (config.data)
                                    Plotly.relayout(me.getEl().dom, update);
                            }
                    }
            };

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