0

i would like to generate two bar charts into 2 different plots. Why not something like this http://www.java2s.com/Code/Java/Chart/JFreeChartMultiplePieChartDemo1.htm but for bar chart instead of pie one.

I'm using ServletUtilities.saveChartAsPng() which takes as (first) argument the JFreeChart object, but i don't see how to create my JFreeChart object which must hold 2 bar charts / 2 plots (and a common legend, but this is not my main problem currently)

I googled a lot, but i did not find what i'm still looking for.

Thanks in advance for helping.

paissad
  • 169
  • 1
  • 5
  • 15

1 Answers1

1

As suggested here, you can add an arbitrary number of ChartPanel instances to an enclosing panel. Override the panel's getPreferredSize() method, use a suitable layout and pack() the enclosing Window. Optionally, suppress the legend in all but one chart.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045