Today (yesterday indeed) I am happy, I finally found the problem with the charts api in my code.
Some time ago (some years) I was working with JasperReports version 1.1.0. we (the team in my work) has implemented a web front end for reports, the user can configure his reports with the front end, i.e. select columns included in the report, grouping columns, totalizators, configure a chart and so on (obviously without knowledge of databases or sql, all in a web application).
As lead of the report engine, I used the JasperReports API, a really interesting technology, but not perfect yet.
The problem arise when we upgrade to the version 2.0.5 of JR, when the user want to generate a Chart in the first page (title band) of the report, the chart was correctly generated but only a few data of the report was generated (e.g. one page of three). Otherwise when the user want to generate the chart in the last page (summary band) then all the data of the report was correctly generated, but the chart was wrong rendered (only the title).
See the last below:
I posted in the JR forums without results. I has tried some changes in the code (evaluation times, reset types, etc), without results. I have updated to the version 3 of JR, but the problem continues and I can´t found something related in the release notes.
Finally today I start to review the problem again from the basics, I start to create a chart with a JRXML, then I found finally the problem.
I implemented a chart using a subDataSet and a dataSetRun, when the dataSetRun has the dataSourceExpression set to the report data source the problem arise.
<chart isShowLegend="true" evaluationTime="Report">
<reportElement x="50" y="0" width="200" height="200"/>
<titleExpression>"My Pie chart"</titleExpression></chartTitle>
<dataset incrementType="None" >
Removing the dataSourceExpression from the chart definition solved the problem. In the code with the problem, I was passing all the parameters from the report parameters list (jasperDesign.getParametersList) including the REPORT_DATA_SOURCE, avoiding it, the problem was solved.
See below the correct chart:
I don´t expect to have a complete documentation for OSS libraries, but in this case should be a good time saver to get this chage log in some text file, I think this problem can be a side effect, but the JR guys know it (I suspect😉.