Setting the series visbility

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
vani_hegde
Posts: 17
Joined: Tue Oct 11, 2005 9:27 pm

Setting the series visbility

Post by vani_hegde » Wed Nov 29, 2006 9:14 pm

Hi I want to show/hide the series in my graph and i am using

XYITemRenderer.setSeriesVisisble(int seriesNum, Boolean visible, true)

This works fine in case of line graphs, but in the case where we use the
StackedXYAreaRenderer2, it is not working, the series still shows, even when i set the setSeriesVisible to false.

Does anyone knows why? What is the solution?

thanks,
vani

jesse
Posts: 8
Joined: Fri Nov 17, 2006 7:16 pm

Post by jesse » Wed Nov 29, 2006 11:03 pm

I am having the same issue http://www.jfree.org/phpBB2/viewtopic.php?t=11819. However, I'm not getting much in the way of help.

jesse
Posts: 8
Joined: Fri Nov 17, 2006 7:16 pm

Post by jesse » Wed Dec 06, 2006 6:19 pm

I went through some of the code to see what happens when setSeriesVisible is changed. All of them inherit AbstactRenderer's setSeriesVisible. setSeriesVisible calls notifyListeners.

I don't see which objects are listed as listeners.

Can anyone shed some light on this???

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 » Wed Dec 06, 2006 6:29 pm

The listener notification is just a way of telling anyone that is interested that the chart's appearance is likely to have changed...the default setup triggers a chain of events that results in the chart itself firing a ChartChangeEvent. If you have your chart displayed in a ChartPanel, the panel listens for ChartChangeEvents and repaints the chart whenever such an event is received. There is nothing to fix in this part of the code (with respect to series visibility).

The series visibility flags *should* be observed by all renderers, but so far not all renderers do this. I've fixed a couple more in CVS (ready for the 1.0.4 release), but have to do more work to make the stacked renderers do this correctly (because making one series invisible can change the position in which the other series get rendered). There is also a subtle bug in the stacked area renderers that I'm working on...I think the fix for that should make it much easier to hide/display individual series, and I think this should be done for the 1.0.4 release (which will most likely be in January).
David Gilbert
JFreeChart Project Leader

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

jesse
Posts: 8
Joined: Fri Nov 17, 2006 7:16 pm

Post by jesse » Wed Dec 06, 2006 6:32 pm

Thanks for the info and the quick reply.

Locked