Multiple renderes on one chart?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
hector

Multiple renderes on one chart?

Post by hector » Wed Mar 20, 2002 5:37 pm

Is there an easy way to set up multiple renderers on one XYChart?
For example, I have 2 series of time series data but I want one with lines and one with shapes only. I know I can change the XYItemRenderer on the chart itself but this will affect both series.

Thanks for any help

hector

Re: Multiple renderes on one chart?

Post by hector » Wed Mar 20, 2002 6:04 pm

Just a quick note, I realize that this is possible using a combined plot (which is what I am currently using), but I wanted to check if it is doable without the extra overhead of a combined chart.

Thanks again!

David Gilbert

Re: Multiple renderes on one chart?

Post by David Gilbert » Wed Mar 20, 2002 6:40 pm

You have to use the combined plot at the moment. But I have been thinking about setting the plot up to have multiple renderers...so it may be possible in a future version.

Regards,

DG.

Stacey

Post by Stacey » Tue Dec 16, 2003 10:47 pm

Does anyone know if multiple renderers for same axis are available yet. I wasn't able to find any code for this. Only found a "hack"(maybe) of adding several secondary axis at differnt indexes and then giving each one of those it's own renderer.
Thanks!
Stacey

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 » Tue Dec 16, 2003 10:53 pm

Yes it is possible. For an example, take a look at OverlaidXYPlotDemo.java in the src/org/jfree/chart/demo directory.
David Gilbert
JFreeChart Project Leader

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

Stacey

Post by Stacey » Tue Dec 30, 2003 6:12 pm

I realize the primary and secondary dataset features are there. But what about when I have, for example, 5 series on the same axis and the only thing different about them is what type of renderer they will use. One will be line, one will be bar, one will be shapes, etc. Am I to use multiple secondary axis at different indexes? This doesn't seem very intuitive. I'm confused as to the purpose of the primary and secondary axis. It seems as they they are the same thing with just different indices?
Thanks again,
Stacey

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 Jan 01, 2004 10:53 pm

Each secondary dataset needs to have a secondary renderer, but the primary axis will be used by default...you need to call the mapSecondaryDatasetToRangeAxis(...) to get the dataset to plot against a secondary axis.

But you also seem to be asking whether it would be possible for the primary and secondary axes to be "just axes", with the primary axis being axis[0], and the secondary axes being axis[1], axis[2], ... axis[N]. Originally I steered away from that approach, because I wanted to ensure that developers that are not using secondary axes don't need to specify an axis index (to keep the simple things simple). But thinking about it, that could probably be achieved easily enough by assuming '0' in methods that don't specify an axis index, but also providing similar methods where an axis index can be specified, for example:

Code: Select all

public void setDomainAxis(ValueAxis axis); // assume index = 0
public void setDomainAxis(int index, ValueAxis axis);  // use supplied index
It is something I will investigate further when I have some time.
David Gilbert
JFreeChart Project Leader

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

Stacey
Posts: 15
Joined: Tue Jan 27, 2004 5:09 pm

Post by Stacey » Thu Jun 16, 2005 4:53 pm

Any advancements with the previous question?
But what about when I have, for example, 5 series on the same axis and the only thing different about them is what type of renderer they will use. One will be line, one will be bar, one will be shapes, etc
I am still trying to put multiple series, say one line and step-line, on the same axis. Is there a way to map the renderers this way?

Thanks!
Stacey

Jii
Posts: 128
Joined: Thu Apr 21, 2005 11:17 am

Post by Jii » Fri Jun 17, 2005 7:11 am

You could do what i did and just wrap each TimeSeries into it's own TimeSeriesCollection.

Because TimeSeriesCollection is an XYDataset, you can map as many of them as you want to any axis you wish and have them use the renderer of your choice.

Guest

Post by Guest » Wed Jun 22, 2005 2:53 pm

But does this allow me to have multiple renderers on only one defined axis?

Thanks,
Stacey

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 23, 2005 6:28 am

Yes. By default, all datasets will map to the primary range axis. If you want to change that, you can use the mapDatasetToRangeAxis(int, int) method.
David Gilbert
JFreeChart Project Leader

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

Locked