Board index JavaServer Faces General Chart ItemSelectEvent series and item index possibly wrong

Chart ItemSelectEvent series and item index possibly wrong

Components, Ajax Framework, Utilities and More.


Posts: 17
Hi all,

I am running a test based on the sample provided on http://www.primefaces.org:8080/prime-showcase/ui/stackedBarChart.jsf and added an itemSelectListener as follows:
itemSelectListener="#{chart.itemSelect}"

with the following backing bean method:
public void itemSelect(ItemSelectEvent event) {
     System.out.println(event.getItemIndex() + " " + event.getSeriesIndex());
}

The thing is it does not matter if I click on boys or girls on 2004 data it always prints:
09:07:26,351 INFO [STDOUT] 0 0
The same happens when I click on any series of 2005 it always prints:
09:07:46,617 INFO [STDOUT] 1 1

Shouldn't it be printing 0 0 and 0 1, respectively, when I click on boys 2004 and girls 2004 and also print 1 0 and 1 1 if I had clicked on the same series order but on 2005?

best regards,
Rafael Ribeiro


Posts: 15115
Location: Cybertron

Hi Rafael,

It seems to be a bug, can you please create an issue in our issue tracker and post the link here.

This seems quite easy to fix as well.

Thank you.
PrimeFaces Lead


Posts: 17
Done!
http://code.google.com/p/primefaces/issues/detail?id=569

In the meantime I'll try to download and check if I can fix it myself then I submit you a patch!


Posts: 15115
Location: Cybertron

It should be trivial yes, itemSelectListener in charts.js file is the key. Problem is that on javascript side, I guess we are sending the wrong value.
PrimeFaces Lead


Posts: 17
I guess some js optimizer is run on charts.js so the change on the jar for the release is:
D.seriesIndex=C.index;

becomes:
D.seriesIndex=C.seriesIndex;


Or in case of charts.js on sources jar:
params['seriesIndex'] = event.index;

becomes:
params['seriesIndex'] = event.seriesIndex;


Posts: 15115
Location: Cybertron

Yes, in production all js are compressed.

Can you create an svn patch for this and attach to the issue.
PrimeFaces Lead



Return to General