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,218
  • 37
  • 121
  • 201

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
  • 200,320
  • 28
  • 229
  • 974
GenericJon
  • 8,286
  • 4
  • 36
  • 49
  • 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