Is there anything similar to the multiPiePlot Chart but for xy plots? I have an application that needs to print two or three xy plots on one page. I know you can put multiple data sets on the same plot, but the requirements specify that each must be a separate chart on the same page.
Share
I used the solution trashgod used, but I’ve extended the solution to support the sort of printing I wanted to be able to do with my application.
I wanted to be able to print like JFreechart usually does, but put multiples of its graphs on each page in a grid and have it stretch and expand to the page nicely. Using this function, I was able to generate a print that matches the image below:
Basically I extended JPanel and implemented the Printable interface. to make a panel that will contain all the JFreecharts I may want to display/print. The panel will arrange them in a grid fashion based on some layoutinstructions you provide.
The print function for the panel basically takes a page format like normal, but then sub divides the page into the grid specified before. It then takes each of these cells and makes a pageformat for each of them. Then it will tell each JFreeChart ChartPanel to print to each of those PageFormat cells.
CustomChartPanel:
ChartLayoutInstructions:
I have plans to extend this class for my own purposes for defining more advanced behaviors. that’s why I use this class rather than just having rows and columns defined in the constructor of the CustomChartPanel Class.