PDA

View Full Version : [INFOREQ]Ext JS 4.0 Beta 3, Chart added event



aleksejs.goremikins
21 Apr 2011, 4:58 AM
Ext.chart.Chart does not fire added event. This code does not work:

initComponent : function() {
....
this.on('added', function() {
alert('added');
}, this);
....
}

evant
21 Apr 2011, 4:13 PM
I can't reproduce this:



Ext.onReady(function(){

var p = Ext.create('Ext.chart.Chart', {
id: 'chartCmp',
animate: true,
store: store1,
shadow: true,
legend: {
position: 'right'
},
insetPadding: 60,
theme: 'Base:gradients',
series: [{
type: 'pie',
field: 'data1',
showInLegend: true,
tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function(storeItem, item){
//calculate percentage.
var total = 0;
store1.each(function(rec){
total += rec.get('data1');
});
this.setTitle(storeItem.get('name') + ': ' + Math.round(storeItem.get('data1') / total * 100) + '%');
}
},
highlight: {
segment: {
margin: 20
}
},
label: {
field: 'name',
display: 'rotate',
contrast: true,
font: '18px Arial'
}
}]
});
p.on('added', function(){
console.log('added');
});

Ext.create('Ext.container.Viewport', {
renderTo: document.body,
width: 200,
height: 200,
layout: 'fit',
items: p
});

});