File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Generate Charts with JasperReport Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Generate Charts with JasperReport" Watch "Generate Charts with JasperReport" New topic
Author

Generate Charts with JasperReport

Alice Wong
Greenhorn

Joined: Oct 12, 2004
Posts: 22
Hi,

I'm new to JasperReport. I'm now making use of JasperReport in a Servlet to generate a chart with data from an external DataSource(say from Oracle). I also use iReport to design my report.

I have found out two approaches to generate charts:
1. i. Query the database in the Servlet, generate the chart and render into an java.awt.Image object.
ii. Define a parameter of type java.awt.Image. Create an Image object in the report template and set its image expression as the parameter defined previously.
iii. Pass the image created in the Servlet as parameter to the report.

2. i. Define the database query in iReport.
ii. Create a Chart object in the report template. Set the data series of the Chart object to be the Report Fields generated by the query.
iii. Include the scriptlet class generated by iReport in the webapp.

Which approach is better? Thanks in advance!
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
Your second approch is better thru iReport.
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
hi,

is there a better way then including the scriptlet in the webapp? i cant rebuild my project every time, if a chart has changed. to put it in the classpath dont work, the classloader of the webapp dont find the scriptlet this way.

thanks!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Generate Charts with JasperReport
 
Similar Threads
Windward Java Engine Review
How do I use a servlet instead of jsp as the view for returning binary image data?
Tools using XML(sent from server) containing data to generate image on client side
JasperReports and databases
Data for JFreeChart