2

I have an application with some JFreeCharts. When I right-click them, one of the default options is "Print", so I can print the chart in paper.

I want to replicate that option in my application main menu, File/Print, but I don't know what function of the chart does this, and when I try to look for this information in the JFreeChart Developer Guide, I get hundreds of System.PRINTln when searching.

Any help?

Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207

1 Answers1

3

I believe that would be the createChartPrintJob() method within ChartPanel. (Or perhaps the print() method, depending on what you want to do.)

Details are here.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
GenericJon
  • 8,746
  • 4
  • 39
  • 50
  • 1
    +1 Conveniently, `ChartPanel ` implements `Printable`. It also hosts other context menu functions, some of which are shown [here](http://stackoverflow.com/questions/5522575/how-can-i-update-a-jfreecharts-appearance-after-its-been-made-visible). – trashgod Oct 06 '11 at 15:53
  • +1 The createChartPrintJob() is exactly what's its print action does. – Reverend Gonzo Oct 06 '11 at 16:19
  • What about including the chart in an already-existing `PrintJob`? – Matthieu Aug 26 '20 at 09:31