move chart series initialization into initComponent

with extjs 6.2 the charts are initialized differently, so that we can
not do this in the afterrender event, instead we do it in the
initComponent, after calling callParent

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-12-06 16:26:38 +01:00 committed by Dietmar Maurer
parent 094a179c8b
commit 64934c8314

View File

@ -25,7 +25,6 @@ Ext.define('PVE.widget.RRDChart', {
docked: 'bottom'
},
listeners: {
afterrender: 'onAfterRender',
animationend: 'onAfterAnimation'
},
@ -96,9 +95,27 @@ Ext.define('PVE.widget.RRDChart', {
'<br>' + new Date(record.get('time')));
},
onAfterRender: function(){
onAfterAnimation: function(chart, eopts) {
// if the undobuton is disabled,
// disable our tool
var ourUndoZoomButton = chart.tools[0];
var undoButton = chart.interactions[0].getUndoButton();
ourUndoZoomButton.setDisabled(undoButton.isDisabled());
},
initComponent: function() {
var me = this;
if (!me.store) {
throw "cannot work without store";
}
if (!me.fields) {
throw "cannot work without fields";
}
me.callParent();
// add correct label for left axis
var axisTitle = "";
if (me.percentArr.indexOf(me.fields[0]) != -1) {
@ -161,28 +178,6 @@ Ext.define('PVE.widget.RRDChart', {
}
});
});
},
onAfterAnimation: function(chart, eopts) {
// if the undobuton is disabled,
// disable our tool
var ourUndoZoomButton = chart.tools[0];
var undoButton = chart.interactions[0].getUndoButton();
ourUndoZoomButton.setDisabled(undoButton.isDisabled());
},
initComponent: function() {
var me = this;
if (!me.store) {
throw "cannot work without store";
}
if (!me.fields) {
throw "cannot work without fields";
}
me.callParent();
// enable animation after the store is loaded
me.store.onAfter('load', function() {