how to print multiple graphs in one page

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
anup

how to print multiple graphs in one page

Post by anup » Fri Apr 12, 2002 3:40 am

so how do i implement multiple charts printing in one page?? I mean what should i do to the code, do i have to implement my own class or do i have to just change some lines of code, Some detail would be highly appreciated.
thanks
anup

David Gilbert

Re: how to print multiple graphs in one page

Post by David Gilbert » Fri Apr 12, 2002 9:34 am

If your application has multiple charts that you want to print on one page, then you need to write some code in the print(...) method in whatever class you use to implement the Printable interface (part of the standard Java printing API).

If you look in the print(...) method for JFreeChartPanel, you will see that it just calculates a rectangle for the whole page, and then draws the chart in that rectangle. But if you have a class that has references to four charts (say) then you could calculate rectangles for each quarter page, and then draw each chart in it's own quarter. Each chart can occupy any area you want on the page...it is up to you to make sure they don't overlap.
Hope that helps,

DG.

Locked