When a chart is placed in the detail band and the datasource used in the chart is populated dynamically by a collection of java beans (sent by a java application using JRBeanCollectionDataSource class), the chart data is only displayed in the first record.
Debugging the JasperReport source code, the collection of java beans is handled by it's iterator and the collection is fully read to populate the chart data for the first record. Since jasper is using an iterator, when the next record of the report is processed the iterator is still pointed to it's end. It seems the method JRBeanCollectionDataSource.moveFirst() should be called as a new record is processed.
As a temporarily fix, the code below was put in the java application. The class JRFillDatasetRun was overridden to have the code below after a datasource is initialized:
if (dataset.dataSource instanceof JRRewindableDataSource) {
((JRRewindableDataSource) dataset.dataSource).moveFirst();
}
Recommended Comments