我无法在控制器中为系列图表的“itemmouseup”事件创建侦听器。
控制器:
init: function () {
this.control({
'monthbalance > chart': {
render: this.onChartRendered,
itemmouseup : this.onChartClick
},
});
},
如果我插入 'mouseup' 事件而不是 'itemmouseup' 它工作正常。但我需要'itemmouseup'。我哪里错了?
谢谢。
使用视图提取更新:
},{
id: 'card-1',
xtype: 'chart',
store: 'MonthBalances',
title: 'This Year vs Previous Years',
theme: 'Category1',
legend: {position: 'right'},
shadow: true,
axes: [{
type: 'Numeric',
position: 'left',
fields: ['monthbalance','monthlastyear','monthpreviousyear'],
label: {
renderer: Ext.util.Format.numberRenderer('0,0')
},
grid: true,
minimum: 0
},{
type: 'Category',
position: 'bottom',
fields: ['month']
}],
series: [{
type: 'line',
title: 'this year',
itemId: 'lineone',
highlight: {
size: 7,
radius: 7
},
axis: 'left',
xField: 'month',
yField: 'monthbalance',
// listeners: {
// itemmouseup: function() {
// console.log('itemmouseup-thisyear');
// }
// },
},{
type: 'line',
title: 'one year ago',
itemId: 'linetwo',
highlight: {
size: 7,
radius: 7
},
axis: 'left',
xField: 'month',
yField: 'monthlastyear',
},{
type: 'line',
id: 'linethree',
name: 'linethree',
itemId: 'linethree',
alias: 'widget.linethree',
title: 'two years ago',
highlight: {
size: 7,
radius: 7
},
axis: 'left',
xField: 'month',
yField: 'monthpreviousyear',
}]
}];