paissad
paissad

Reputation: 169

JFreechart two bar charts in one image but not superimposed

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.

Upvotes: 0

Views: 818

Answers (1)

trashgod
trashgod

Reputation: 205885

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.

Upvotes: 1

Related Questions