Hello,
In my application, I display a ChartPanel without a Title or a Legend. (The application displays this information elsewhere outside of the ChartPanel.)
However, when I print the ChartPanel, I'd like to be able to print it with ChartPanel's Title and Legend.
Is there someway to override the ChartPanel.createChartPrintJob() in order to add a title and legend?
Or simply create another instance of the Chart with a title and legend that is not displayed on screen and send that to the printer?
Other suggestions?
Thanks.
Print ChartPanel with modifications
Print ChartPanel with modifications
Ted Hill
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Print ChartPanel with modifications
You should be able to clone the chart that is being managed by the ChartPanel, then add a legend and a title to the clone, then print that. Cloning the chart will not clone the underlying dataset, although you can do that manually if it is something you need.
There are lots of JUnit tests that check the cloning, but I think most people don't ever use the cloning feature, so be sure to test your code thoroughly and report any bugs you encounter.
There are lots of JUnit tests that check the cloning, but I think most people don't ever use the cloning feature, so be sure to test your code thoroughly and report any bugs you encounter.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

