Jump to content
JasperReports Library 7.0 is now available ×

ktrinad

Recommended Posts

By: Mauro Chojrin - mchojrin

Charts

2003-04-03 05:57

Is there some way to add charts to the reports? (Pie charts or something like that).

 

Thanks

 

 

 

 

By: Giulio Toffoli - gt78

RE: Charts

2003-04-04 02:12

sure. There is different ways, but the most used is using JFreeChart library. With this lib you can store a chart to a java.awt.Image that will passed to the jasperreport. Adding charts to a report is equal to create an image and put it on the report. Please note that the jasperreports don't can create itself the chart.

 

Steps at design time:

1. Create a parameter of type java.awt.Image and name it i.e. myChart

2. Add an Imageelement to the report and set the

image expression to $P{myChart} and type to java.awt.Image

3.Compile it

 

Steps at run time

 

1. create the chart and store it in a java.awt.Image

2. put in tha parameters map to pass to jasperreports fill method a new parameter with "mychart" as key and your image as object

 

Please note that you can do this "runtime" steps using iReport.

 

You can find an chart example at

http://jasperreports.sourceforge.net/samples/index.html

 

I hope this helps you

 

Giulio

 

 

 

 

By: krrep - krrep

Charts

2004-08-31 10:53

Can someone post an example of a scriptlet that they have used to create a chart specifically on how the JFreeChart object is passed to convert it to an java.awt.Image?

 

Thanks

 

 

 

 

By: C-Box - c-box

RE: Charts

2004-08-31 22:37

Look at the ChartSample that comes with JasperReports full download package. There is a scriptlet (see "ChartScriptlet") that builds the chart and convert it to an image that is shown by JasperReport after the report is initialized.

 

hth

C-Box

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...