0

我的屏幕上有两个对象,一个网格和一个图表,由同一家商店填充。我需要做的是突出显示图表上与我在网格中单击的项目相关的列。

在函数中,我想出了使用 Ext.getCmp('chart').series.get(0) 的一半方法。但是不知道如何获取系列的每个项目并突出显示它,因为 getItemForPoint(x,y) 不断返回空值......

非常感谢,代码如下:

// Code for my grid
{
 columnWidth: .25
 ,xtype: 'grid'
 ,hideHeaders: true
 ,border: true
 ,styke: 'padding-top: 60px;'
 ,height: 360
 ,store: participation
 ,columns: [{
      dataIndex: 'ID'
      ,width: 24
 },{
      dataIndex: 'Supplier'
      ,width: 204
}]
 ,listeners: {
      select: function() {
           // function to highlight the column on my chart
      }
 }
}

// Code for my chart
{
 border: false
 ,layout: 'column'
 ,items: [{
    columnWidth: .75
    ,xtype: 'chart'
    ,animate: true
    ,height: 432
    ,shadow: false
    ,id: 'chart'
    ,store: participation
    ,axes: [{
        type: 'Numeric'
        ,position: 'left'
        ,grid: true
        ,fields: 'Participation'
        ,title: 'Share'
        ,label: {
            renderer: Ext.util.Format.numberRenderer('0.00'+"%")
        }
    },{
        type: 'Category'
        ,position: 'bottom'
        ,fields: 'ID'
    }]
    ,series: [{
        type: 'column'
        ,axis: 'left'
        ,highlight: 'true'
        ,xField: 'ID'
        ,yField: 'Participation'
        ,tips: {
            trackMouse: true
            ,width: 312
            ,maxWidth: 360
            ,height: 36
            ,constrainPosition: true
            ,renderer: function(storeItem, item) {
                this.setTitle('Supplier: ' + storeItem.get('Supplier')+'<br/>'+'Share: ' + Ext.util.Format.number(storeItem.get('Share'),"0.00")+'%');
            }
        }
        ,style: {
            lineWidth: 1
            ,stroke: '#666'
        }
    }]
  }
 }
4

1 回答 1

0

查看 ExtJS 示例中的动态表单、网格和图表。该示例准确演示了您要实现的目标。请参阅附加到图表和 gridPanel 的侦听器(selectionchange 事件等)。

于 2012-05-24T05:57:05.760 回答