PDA

View Full Version : howto get the data from stacked bar chart?



kodak
23 Jun 2012, 5:44 AM
Hey!

I have I stacked bar chart with three colors: blue, red and grey.
I want to get the color and value of the bar which was clicked.

How can I get this?
Which value do I have to pass to the onclick listener?
And for the future: Where can I find this in the API docs?

Thanks!

scottmartin
23 Jun 2012, 7:58 AM
Have a look at the series events:




series: [{
type: 'bar',
axis: 'bottom',
gutter: 80,
xField: 'year',
yField: ['comedy', 'action', 'drama', 'thriller'],
stacked: true,
tips: {
trackMouse: true,
width: 65,
height: 28,
renderer: function(storeItem, item) {
this.setTitle(String(item.value[1] / 1000000) + 'M');
}
},
axis: 'left',
listeners: {
'itemmousedown': function(series) {
console.log(series);
}
},
}]


Regards,
Scott.

kodak
23 Jun 2012, 8:05 AM
Perfect, thanks.