English 中文(简体)
点击 ExtJS 4 的网格中相关数据时在图表中加亮栏
原标题:Highlighting Bars in a chart when clicking on the related data in a grid with ExtJS 4

I have two objects on my screen, a grid and a chart being populated by the same store. What I need to do is highlight the Column on the chart related to the item I clicked in the grid.

In the function I ve figured half way to do it using Ext.getCmp( chart ).series.get(0). But don t know what to do to get to each item of the series and highlight it, as the getItemForPoint(x,y) keeps returning null values...

非常感谢,下面的代码:

// 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 
        }
    }]
  }
 }
最佳回答

请在 ExtJS 示例中查看 < a href=" http://docs.sencha.com/ext-js/4-1/#!/example/charts/FormDashboard.html" rel=“nofollow” > Dynamic Form, Grid and Charts 。示例演示您想要实现的目标。 参考图表和网格板上的听众( 选择变更事件等 ) 。

问题回答

暂无回答




相关问题
How to draw a vertical bar on every 4th space in Vim?

I d like (g)Vim to draw a pipe symbol | on each 4th space of indentation to show something like vertical indentation line. I found this plugin: http://vim.sourceforge.net/scripts/script.php?script_id=...

using jquery highlight effect

I would like to use jquery highlight effect to highlight a paragraph with background orange, then when completed, turn on orange background permanently. In this code the second task does not work. ...

How can I highlight a portion of the text of a UITextView?

What I would like to do is, if my detailed view gets called I would like to highlight just a part of the text of the UITextView element. Let s say the text within the UITextView is: blatextbla. Then ...

热门标签