Multiple charts in one chartpanel?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
hotwingz
Posts: 10
Joined: Fri Apr 01, 2005 11:06 pm

Multiple charts in one chartpanel?

Post by hotwingz » Wed Jun 14, 2006 8:51 pm

Hello,
Is it possible to have multiple JFreeCharts added to one ChartPanel such that all graphs are visible. I need this because I need to simultaneously graph multiple XYSeriesCollections.

I apologize if I've missed something obvious, but would appreciate a pointer.

Thanks again.

Bflo hotwingz

cringe
Posts: 54
Joined: Wed May 10, 2006 10:39 am
Location: Germany
Contact:

Post by cringe » Thu Jun 15, 2006 9:41 am

Do you want to plot the data into a single chartpanel? You should use multiple Datasets then. If you supply more details about the classes you use, we could perhaps point you to the right methods.

Ivoryn
Posts: 8
Joined: Tue Apr 04, 2006 2:01 pm

Post by Ivoryn » Thu Jun 15, 2006 3:11 pm

i have the same problem. i want to display up to four pie charts in one chart panel. they all have independent datasets.

private void createPieChart(Dataset.Parameter p)
{
try
{
PieChart pieChart = new PieChart(p);
setPanel(pieChart.getChartPanel(), frame.getchartPanel());
}
catch (Exception e) ...
}

this is for creating one single pie chart in th chartpanel. the parameters p contains data for creating the piedataset. what can i do?

i need help very fast.

hotwingz
Posts: 10
Joined: Fri Apr 01, 2005 11:06 pm

Multiple charts in one chartpanel?

Post by hotwingz » Thu Jun 15, 2006 4:42 pm

Hello again,

Yep, I'm using multiple XYDatasets. Right now I see how to create one XYLIneChart from one (XYDataset)XYSeriesCollection. The chart is then added to one ChartPanel, right? What I need to do is add multiple charts to one ChartPanel and have them all be visible.

Is there such a thing or does it break the semantic of the plot/chartpanel ?

Thanks in advance.

hotwingz

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Jun 15, 2006 4:53 pm

It sounds like you should just add multiple ChartPanels to a JPanel, using a standard Swing layout manager (GridLayout?).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

hotwingz
Posts: 10
Joined: Fri Apr 01, 2005 11:06 pm

Post by hotwingz » Thu Jun 15, 2006 6:32 pm

Sorry,
I guess I was unclear. All the graphs have to be in one plot. Or, if you think in layers, they should all overlay each other.

The data are orgainzed as follows:

one peak(looks like a normal distribution curve) = one XYSeries.
series of peaks =one xySeriesCollection.
One experiment = set of peaks in one color.

Imagine wanting to compare experiments. We want to see peaks in different colors but all on the same plot so we can visually compare peak height, peak area, etc.

Thanks for all the help.

hotwingz

Ivoryn
Posts: 8
Joined: Tue Apr 04, 2006 2:01 pm

Post by Ivoryn » Fri Jun 16, 2006 8:49 am

For me it worked. Thanks David.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Jun 19, 2006 4:34 pm

hotwingz wrote:Imagine wanting to compare experiments. We want to see peaks in different colors but all on the same plot so we can visually compare peak height, peak area, etc.
No problem. You can add multiple datasets to a chart, each with its own renderer. For the general approach, check out OverlaidXYPlotDemo1 and OverlaidXYPlotDemo2 in the JFreeChart demo collection.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked