Jasper Reports: JRBeanCollectionDataSource cannot be resolved to a type

心不动则不痛 提交于 2019-12-03 08:49:17

In the .jrxml the data source for the chart is defined as:

<![CDATA[new net.sf.jasperreports.engine.JRBeanCollectionDataSource($F{chartData.xAxis})]]>

This come from the iReports 4.7.0 autofill when you select Use datasource expression under Connection/Datasource exp in the details pane, the default expression from iReports is:

 new net.sf.jasperreports.engine.JREmptyDataSource(1)

But this expression is wrong because .data is missing. It should read:

 new net.sf.jasperreports.engine.data.JREmptyDataSource(1)

and then I changed the JREmptyDataSource(1) to JRBeanCollectionDataSource($F{chartData}) of course

This fixes the compile time error and then I had to reorganize and redefine my Lists and POJO's so that I could easily access the data point pairs in my List of ChartData objects. Essentially this meant that instead of a single ChartData object with two lists of doubles (one for X-Axis and one for Y-Axis), I now have a list of ChartData objects, each with just one XY point. This seems to work well for now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!