Charts 使用ExtJS 4单击网格中的相关数据时高亮显示图表中的条形图
我的屏幕上有两个对象,一个网格和一个由同一个存储区填充的图表。 我需要做的是突出显示图表上与我在网格中单击的项目相关的列 在这个函数中,我用 Ext.getCmp('chart').series.get(0)。 但是不知道该怎么做才能到达系列的每个项目并突出显示它,因为getItemForPoint(x,y)一直返回空值 非常感谢,代码如下:Charts 使用ExtJS 4单击网格中的相关数据时高亮显示图表中的条形图,charts,grid,extjs4,connect,highlight,Charts,Grid,Extjs4,Connect,Highlight,我的屏幕上有两个对象,一个网格和一个由同一个存储区填充的图表。 我需要做的是突出显示图表上与我在网格中单击的项目相关的列 在这个函数中,我用 Ext.getCmp('chart').series.get(0)。 但是不知道该怎么做才能到达系列的每个项目并突出显示它,因为getItemForPoint(x,y)一直返回空值 非常感谢,代码如下: // Code for my grid { columnWidth: .25 ,xtype: 'grid' ,hideHeaders: true
// 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'
}
}]
}
}
//我的网格的代码
{
列宽:.25
,xtype:'网格'
,隐藏者:是的
,border:true
,styke:'填充顶部:60px;'
,身高:360
,商店:参与
,专栏:[{
数据索引:“ID”
,宽:24
},{
数据索引:“供应商”
,宽:204
}]
,听众:{
选择:函数(){
//函数突出显示图表上的列
}
}
}
//我的图表代码
{
边界:假
,布局:'列'
,项目:[{
列宽:.75
,xtype:'图表'
,动画:真
,身高:432
,shadow:false
,id:'图表'
,商店:参与
,轴:[{
键入:“数字”
,位置:'左'
,grid:true
,字段:“参与”
,标题:“共享”
,标签:{
渲染器:Ext.util.Format.numberRenderer('0.00'+“%”)
}
},{
类型:“类别”
,位置:'底部'
,字段:'ID'
}]
,系列:[{
类型:“列”
,轴:“左”
,突出显示:“真实”
,xField:'ID'
,yField:“参与”
,小贴士:{
轨迹鼠标:对
,宽:312
,最大宽度:360
,身高:36
,位置:true
,呈现器:函数(storeItem,item){
此.setTitle('Supplier:'+storeItem.get('Supplier')+'
'+'Share:'+Ext.util.Format.number(storeItem.get('Share'),“0.00”)+'%;
}
}
,款式:{
线宽:1
,笔划:“#666”
}
}]
}
}
看看ExtJS中的示例。该示例演示了您正试图实现的目标。请参阅图表和网格面板(selectionchange事件等)附带的侦听器