cristic83 Posted December 2, 2010 Share Posted December 2, 2010 Hello,I have tried to use JasperReports and followed the tutorials on the project website,but I'he ran into problems when trying to create a report which contains charts and uses XML datasource files for filling the report.I am trying to create a report that contains a chart and is using an XML datasource to fill the report, but when the report is generated one chart is generated for every record from my XML datasource.The steps I took using iReport Designer 3.7.6 were:1) Create an empty report2) Add an XML datasource to the report. The query language I selected is XPath, the record node: /genericSingleReport/data/data and the fields were: count and timestamp. The XML datasource file looks like this:<genericSingleReport><data><data><count>388.0</count><timestamp>1288864800000</timestamp></data></data></genericSingleReport>3) I added a BArChart(or Pie Chart or XY chart) to the detail section of the report , selected the main report dataset in the first step in the wizard, the the value: DateFormat.getDateInstance().format(new Date(Long.valueOf($F{timestamp}))) for the Category expressionand: Double.valueOf($F{count}) for the value expressionWhen I preview the report I get as many charts as data records in the XML datasource file and each chart represent the first entry in the XML file, so I have n entries for the 388 value in hte above example. This, of course, is not what I need, because I want one chart which displays all the values.Thanks for your help,Cristi Link to comment Share on other sites More sharing options...
cristic83 Posted December 3, 2010 Author Share Posted December 3, 2010 I managed to make it work by putting the chart in teh summary section of the report, instead of the detail section. Link to comment Share on other sites More sharing options...
hozawa Posted December 17, 2010 Share Posted December 17, 2010 Detail section is repeated for each record in the data source. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now