I am trying to put variable as value of pie chart series. Unfortunelly, I don't know how to do that, even though example of pie chart suggests its possible.
My problem is following:
I extract from database some records, which includes column "Type". I would like to make a pie chart with this types as a key and without adding extra Count() columns to my query. Is that possible?
then I would get pie chart with 1/3 labeled by TYPE2 and rest labeled with TYPE1
I am using jasperreports 3.5.3 (the newest as far).
I am looking for solution, ideas or any clues, which can help me to find solution
Post Edited by pawel_r at 08/24/2009 21:35
I have got another question related to the previous one. I would like to put two charts in single report and each of them would present the same data, but put in different categories (one for groups, one for system).
I added additional report group for system and put systemType_Count as value for chart, but it gives me wrong results (seems like it sums up each next category - I include picture).
Second question - I get ResultSet which contains some duplicated data (in sense that single id can be multiple times and I want to treat it as single instance in chart). I tried making reportGroup on id, but the result (group count) gives incorrect result. Am I missing sth?
Keep in mind that the chart itself does not perform any sums/calculations, you need to sum the values using report variables. So if the chart does not show the value that you expect, then you must be passing the wrong value to it. Create a sum variable for the group that you want to sum, and make sure you set appropriate incrementType/Group for the chart.
The second thing to keep in mind is that grouping assumes that the data is already sorted by the same criteria. So if you group by ID and want to have a single group per ID, you'll have to provide data sorted by ID.
Thanks a lot.
If I understood you correctly then I need another query for my report (or possibly a new subreport with chart), because I cannot order by two different fields (group and systems are not connected anyhow). As far as I know groups do not provide mechanism for sorting so I simply need another query (datasource).