PDA

View Full Version : Combining JFreeCharts and JFreeReports



Anonymous
08-05-2003, 01:34 PM
Is there a way to include a JFreeChart in a JFreeReport?

Taqua
08-06-2003, 09:10 AM
Hi,

we are working on that at the moment ...
Until our implementation is ready, the only reliable solution is to generate Images from the chart and to include these images in the report.

Have more fun,
said Thomas

Anonymous
08-18-2003, 10:57 AM
Hi again,

It is possible to produce a PDF document which
has a JPEG chart generated by JFreeChart -
by using the Save in PDF option in JFreeReport.

Is there any way to do the same for Excel or
the other formats (i.e., it need not be JPEG)?
The documentation does not indicate whether
or not this is possible.

What is the best long-winded way of creating
a report in Excel that incorporates a chart in
JPEG format that is produced by JFreeChart?

Thanks again!

Taqua
08-18-2003, 11:55 AM
Hi,

the excel export can't handle images, so this is not possible there. RTF, XML, CSV and plain text are also unable to handle images.

The POI library does not support images yet, so there is no opensource way, maybe a commercial solution (or the COM-Bridge of JDK1.3) may help you. The COM bridge can be used to access COM-Objects on windows systems, but is no longer included in JDK 1.4.

Have more fun,
said Thomas

Anonymous
08-18-2003, 03:01 PM
Thanks for the response. Would JasperReport work better
for this purpose (than JFreeReport) - i.e., for incorporating
graphs from JFreeChart into Excel-accessible reports?

Thanks again!

Taqua
08-18-2003, 03:12 PM
Hi,

no, as Jasper also uses the POI library. So you will have the same restrictions ...

Have more fun,
said Thomas

Anonymous
09-17-2003, 06:21 AM
Would JasperReport work better
for this purpose (than JFreeReport) - i.e., for incorporating
graphs from JFreeChart into Excel-accessible reports?

your Answer:No
---------------------------------------------------
A slight twist to the above question...

Is your answer valid for only excel-accessible reports?
how abt pdf, xml, formats?

here's my question again:

Would JasperReport work better
for this purpose (than JFreeReport) - i.e., for incorporating
graphs from JFreeChart into pdf, xml, html formats?

thanks

Taqua
09-19-2003, 04:49 PM
Hi,

it will work as good (or as bad) as JFreeReport, as in JasperReports Charts will also be precomputed and included as graphics.

The required steps to perform the task are the same for both projects, there is no difference :)

Once you've created a report definition that contains the chart as image, your report engine will to the rest. For both engines, this report definition has no charts, it has an image, and we would not act different if the image shows "Darkwing Duck" :)

Which one you prefer, is up to your personal preference; from the technical point of view there is no difference.

Have more fun,
said Thomas

Anonymous
09-21-2003, 09:34 AM
Hi,

we are working on that at the moment ...
Until our implementation is ready, the only reliable solution is to generate Images from the chart and to include these images in the report.

Have more fun,
said Thomas

Hi,
What it the progress with the above ?
I haven't heard about this in any of the recent releases.

Thanks.

Taqua
09-21-2003, 12:36 PM
Hi,

the chart integration consists of several sub-projects:

The first task is to write an xml definition for the chart, so that we can load/define chart definitions easily.

The second part is to create report functions, which build datasets from the report data.

And the last task would be to write a nice interface and to make this stuff useable from JFreeReport.

At the moment, the chart parser classes are able to use a predefined plot to fill the chart and to define all titles. Defining the plots is the next step ...

I wasn't able to work on these classes since several weeks, as the next release had to be completed, so that the 0.8.3-branch of JFreeReport could be closed. Now I have more time and restarted working on this topic ...

Usable results should be visible in three or four weeks.

Have more fun,
said Thomas

Anonymous
09-24-2003, 01:59 AM
Hi,

My problem is one of output quality of JFreeCharts in JFreeReports. Creating an Image as part of the TableModel is OK quality-wise at best and of course, this gets rendered as a bitmap in my PDFs. Using the iText lib directly and getting the chart to draw on a Graphics2D (from pdfcontent/pdfwriter) gives a nice vector output.

So, is there a way to allow JFreeReport to call back to my JFreeChart wrapper with a Graphics object?

I guess what I'm getting at is Is there a way to callback do do some on the fly drawing?

Anonymous
09-24-2003, 04:29 AM
Hi,

My problem is one of output quality of JFreeCharts in JFreeReports. Creating an Image as part of the TableModel is OK quality-wise at best and of course, this gets rendered as a bitmap in my PDFs. Using the iText lib directly and getting the chart to draw on a Graphics2D (from pdfcontent/pdfwriter) gives a nice vector output.

So, is there a way to allow JFreeReport to call back to my JFreeChart wrapper with a Graphics object?

I guess what I'm getting at is Is there a way to callback do do some on the fly drawing?


I think I've answered my own question... Based on the drawable example, I created a Drawable class that gets called back to render the chart:-



public void draw(final Graphics2D graphics, final Rectangle2D bounds)
{
//Create a demo chart and render...

CategoryDataset dataset = DemoDatasetFactory.createCategoryDataset();
JFreeChart chart = createChart(dataset);
chart.draw(graphics, bounds);
}


Beautiful vector output in my PDF :D

And my next question is, Is there a way to do this without using the BSH? Writing a custom tag maybe that extends drawable-field? (I've no idea where to start with this one!)

Taqua
09-24-2003, 10:57 AM
Hi,

the JFreeChart class is already a drawable, you can put that directly into the report.

It was JFreeChart where the drawable idea comes from, to all fame and glory goes to them :)

Have more fun,
said Thomas

Anonymous
09-25-2003, 11:19 PM
Hi,

the JFreeChart class is already a drawable, you can put that directly into the report.

It was JFreeChart where the drawable idea comes from, to all fame and glory goes to them :)

Have more fun,
said Thomas

How cool is this?



URL in = getClass().getResource("charttest.xml");
JFreeReport report = parseReport(in);

CategoryDataset dataset = getDataSet();
JFreeChart chart = createChart(dataset);

report.setProperty("chart", chart);
report.setPropertyMarked("chart",true);



And in the report...



<drawable-field x="0" y="0" width="500" height="500" fieldname="chart"/>


Very very nice.... thanks guys