2013-11-22 11 views
3

我正在使用MVC的ExtJS 4。我有兩個系列的圖表:行和列。當點擊一列時,我需要觸發一個事件。使用ComponentQuery匹配圖表中的系列

在控制器中,我使用以下查詢來匹配列系列,但不起作用。

this.control({ 
    '#companyChartItemId[series[type=column]]': { 
     itemmouseup:this.onItemMouseUp 
    } 
}); 

任何想法我怎麼能匹配它?

下面是我的代碼:

應用程序/視圖/公司/ chart.js之

Ext.define('Market.view.company.Chart', { 
    extend: 'Ext.chart.Chart', 
    xtype: 'companyChart', 
    requires: ['Market.store.HistoricalMarketData'], 
    theme: 'Category1', 
    store:'HistoricalMarketData', 
    initComponent: function() { 
     this.callParent(); 
    }, 
    axes: [{ 
     type: 'Numeric', 
     position: 'left', 
     fields: ['close'], 
     title: 'Price', 
     grid: true 
    }, { 
     type: 'Numeric', 
     position: 'right', 
     fields: ['volume'], 
     title: 'Volume', 
     grid: true 
    }, { 
     type: 'Category', 
     position: 'bottom', 
     fields: ['time'], 
     title: 'Month of the Year' 
    }], 

    series: [{ 
     type: 'column', 
     axis: 'right', 
     xField: 'time', 
     yField: 'volume', 
     highlight: true, 
     markerConfig: { 
      type: 'cross', 
      size: 3 
     } 
    }, { 
     type: 'line', 
     axis: 'left', 
     smooth: false, 
     fill: false, 
     fillOpacity: 0.8, 
     xField: 'time', 
     yField: 'close' 
    }] 
}); 

應用程序/控制器/ ChartController.js

Ext.define('Market.controller.ChartController', { 
    extend:'Ext.app.Controller', 
    stores:['MarketData'], 
    init: function() { 
     this.control({ 
      '#companyChartItemId[series[type=column]]': { 
       itemmouseup:this.onItemMouseUp 
      } 
     }); 
    }, 

    onItemMouseUp: function (item) { 
     //do something 
    } 
}); 

回答