Page 1 of 1

Chart ItemSelectEvent series and item index possibly wrong

Posted: 02 Mar 2010, 14:09
by rafaelri
Hi all,

I am running a test based on the sample provided on http://www.primefaces.org:8080/prime-sh ... rChart.jsf and added an itemSelectListener as follows:

Code: Select all

itemSelectListener="#{chart.itemSelect}"
with the following backing bean method:

Code: Select all

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

Re: Chart ItemSelectEvent series and item index possibly wrong

Posted: 03 Mar 2010, 12:56
by cagatay.civici
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.

Re: Chart ItemSelectEvent series and item index possibly wrong

Posted: 03 Mar 2010, 14:54
by rafaelri
Done!
http://code.google.com/p/primefaces/iss ... ail?id=569

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

Re: Chart ItemSelectEvent series and item index possibly wrong

Posted: 03 Mar 2010, 14:58
by cagatay.civici
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.

Re: Chart ItemSelectEvent series and item index possibly wrong

Posted: 03 Mar 2010, 15:29
by rafaelri
I guess some js optimizer is run on charts.js so the change on the jar for the release is:

Code: Select all

D.seriesIndex=C.index;
becomes:

Code: Select all

D.seriesIndex=C.seriesIndex;
Or in case of charts.js on sources jar:

Code: Select all

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

Code: Select all

params['seriesIndex'] = event.seriesIndex;

Re: Chart ItemSelectEvent series and item index possibly wrong

Posted: 03 Mar 2010, 18:15
by cagatay.civici
Yes, in production all js are compressed.

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

Re: Chart ItemSelectEvent series and item index possibly wrong

Posted: 04 Mar 2010, 16:22
by rafaelri