PDA

View Full Version : Problem with Grouped Chart...In extjs4



kantha.exe
12 Jun 2012, 11:46 PM
Hi Everybody....

Actually I am working with Grouped Bar-Chart in ext4 ...

in grouped chart i am displaying 3 series which of different values, What i want to do is i need to
get Click Event on each bar series and i should get value of that bar...(each BAR)....

my piece of code look like this...

// ----------- Chart Code -------------- //

{
id: 'chartCmp',
xtype: 'chart',
style: 'background:#fff',
animate: true,
shadow: true,
x: 200,
y: 250,

width: 700,
height: 500,
minHeight: 500,
minWidth: 500,

store: ChartStore,
legend: {
position: 'right bottom'
},

axes: [{
type: 'Numeric',
position: 'bottom',
fields: ['newCount','repeatedCount','deviationCount'],

minimum: 0,
label: {

},
grid: true,
title: 'Risk Catagory'
}, {
type: 'Category',
position: 'left',
fields: ['auditReportNum'],
title: 'Audit Report Number'
}],

series: [{
type: 'bar',
axis: 'bottom',
xField: 'auditReportNum',
yField: ['newCount','repeatedCount','deviationCount'],
highlight: true,

highlightCfg: {
fill: '#a2b5ca'
},

/* tips: {
trackMouse: true,
width: 140,
height: 100,
renderer: function(storeItem, item) {
this.setTitle('New '+storeItem.get('newCount'));

this.setTitle(' High :'+ Math.round(storeItem.get('highCount') / 4 * 100)
+'%'+ '</br>Low :'+Math.round(storeItem.get('lowCount')/4*100)
+'%'+'</br>Medium :'+Math.round(storeItem.get('mediumCount')/4*100)+'%'
+'</br> Recommended :'+Math.round(storeItem.get('recommendedCount')/4*100)+'%');
}
},*/
listeners: {
trackMouse: true,
'itemmouseup': function(storeItem, item) {


alert(item.get('newCount'));




//barChartStore.loadData(record.get('depBreakdown'));

/* var rec = ChartStore.getAt(o.index);
alert(" REcord "+rec+o.index);


alert(rec.get('newCount'));*/
// Ext.example.msg('Testing', 'You selected {0}.', rec.get('newCount'));
}
}
}]

// --------------- End : Chart Code ------------------ //


//------Store ------------ //

/** User Defined Store for Chart */
var ChartStore = Ext.create('Ext.data.SimpleStore',{

fields: ['auditReportNum', 'newCount','repeatedCount','deviationCount','newNameP']

});

36187


I hope i will get a soulution from Sencha....

Thank You.

hasimseo
13 Jun 2012, 1:07 AM
hi
if you want to just show the value , open the tips tag . the below will code work.
and use console.log() instead of alert to show valls

tips: {
trackMouse: true,
width: 140,
height: 100,
renderer: function(storeItem, item) {
this.setTitle('New '+storeItem.get('newCount'));
}
}

hasimseo
13 Jun 2012, 1:14 AM
or you can use like this ,
that will be better

tips: {
trackMouse: true,
width: 140,
height: 100,
renderer: function(storeItem, item) {
var myVal=item.value;
myVal=Ext.util.Format.number(myVal, '0,0')

this.setTitle(myVal);
}
}

kantha.exe
13 Jun 2012, 2:09 AM
is it possible to put this in listener....?

listeners: {
trackMouse: true,
'itemmouseup': function(storeItem, item) {
var myVal=item.value;
alert(myVal);
myVal=Ext.util.Format.number(myVal, '0,0')


alert(myVal);

}
}

but in alert i am getting blank.......:-?
ok i will try now....

hasimseo
13 Jun 2012, 8:20 AM
in tips it work properly but in listener i am not sure ...

kantha.exe
13 Jun 2012, 8:46 PM
Is there any other way for this....?

hasimseo
14 Jun 2012, 6:03 AM
did you try it in tips with second answer?

kantha.exe
14 Jun 2012, 11:55 PM
I tried not working....(:|