PDA

View Full Version : How to call series' function from its label click event



zlfpeak
29 Jan 2013, 3:44 PM
I already have the function that chart series can react the click event to show some data, I tried to add a click reaction to its label to, but it seems that it can not call its parent series' function.
The series is like here:

series: [ {
type: 'column',
axis: 'left',
//highlight: true,
highlightCfg: {
fill: '#BCE954'
},
label: {
display: 'insideEnd',
'text-anchor': 'middle',
field: this.yaxis_fieldNames[0] ,
//renderer: Ext.util.Format.numberRenderer('0'),
// renderer:this.formatURL,
orientation: 'vertical',
color: '#333',
listeners: {

"click":function(){
Ext.Msg.alert('zlf','Hello');
this.itemMouseUp;

}



}
},
xField: this.xaxis_fieldNames,
yField: this.yaxis_fieldNames,
listeners: {
'itemmouseup': this.itemMouseUp
},
tips: {
trackMouse: true,
width: this.tipsWidth,
height: this.tipsHeight,
renderer: this.tipsRenderer
}
} ],

The series's click event function is as following:

onSeriesClicked: function(item, event, table, fieldName, fieldTitle, binWidth,ownerId) {

...
}

The chart is added to as:

container.add({
xtype: 'Histogram',
sim_tableName: tableName,
sim_FieldName: fieldName,
sim_xAxisTitle: xTitle,
sim_yAxisTitle: yTitle,
sim_binWidth: binWidth,
tipsWidth: 160,
tipsHeight: 50,
tipsRenderer: function(storeItem, item) {
this.setTitle('X: ' + item.value[0] + '<br />Y: ' + item.value[1] + '<br />Click to show the detail');
},
onSeriesItemMouseUp: Ext.bind(this.onSeriesClicked, this, [table, field, xTitle, binWidth,ownerId], true)
});


I can see the message box is pop up, but the function is not executed. How to call them? Do I need to use some parent pointer from label?

Thanks

HyGy
10 Jun 2013, 7:16 AM
Did you found a solution for this problem?

I have one type of solution, but little bit buggy with IE, in chrome if I click a label it is working, But in IE i need to click exactly on the font. :(