Make a TimeSeries invisible, then visible again

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dustman
Posts: 6
Joined: Tue Aug 14, 2007 3:35 pm
Contact:

Make a TimeSeries invisible, then visible again

Post by dustman » Tue Aug 14, 2007 3:42 pm

Hello!

I'm new to JFreeChart, so sorry about my noobish questions. Well, here goes: I have a TimeSeries object, that I want to make invisible (so it won't appear on the chart), and when I click a button to make it visible again. During the time the TimeSeries is invisible, I still want data to be added to it, so when I make it visible, the whole series to be showed, as it was never invisible. Think this is possible? If so, every suggestion is most welcome :D.


Thanks in advance!

Radu

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 Aug 15, 2007 11:24 am

The renderer has a setSeriesVisible() method that you can use to hide a series temporarily.
David Gilbert
JFreeChart Project Leader

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

dustman
Posts: 6
Joined: Tue Aug 14, 2007 3:35 pm
Contact:

True, true...

Post by dustman » Thu Aug 16, 2007 7:21 am

Hello!

Thanks for the quick answer David! Yeah, I've noticed that today when I played around to make a dotted series instead of a line series.



Cheers!


Radu

dustman
Posts: 6
Joined: Tue Aug 14, 2007 3:35 pm
Contact:

Hello again :|

Post by dustman » Tue Aug 21, 2007 7:22 am

Hi

I changed the renderer from StandardXYItemRenderer to XYDotRenderer, and now the timeseries doesn't become invisible when using:

Code: Select all

((XYDotRenderer)subplot1.getRendererForDataset(subplot1.getDataset(0))).setSeriesVisible(0, false);		((XYDotRenderer)subplot2.getRendererForDataset(subplot2.getDataset(0))).setSeriesVisible(0, false);
I have 2 XYPlots, each having it's own renderer and timeseries.


P.S. even if i use the renderers as global variables, and write something like this:

Code: Select all

plotRenderer1.setSeriesVisible(0,false);
i still don't get the expected result.


Cheers,
Radu

dustman
Posts: 6
Joined: Tue Aug 14, 2007 3:35 pm
Contact:

Possible bug in XYDotRenderer?

Post by dustman » Thu Aug 23, 2007 3:04 pm

Hello!

Just today I have succeeded in making my series invisible. I needed a series formed by dots, so I used XYLineAndShapeRenderer, set a rectangle ( new Rectangle(1,1) ) as shape, and set the series lines invisible ( setSeriesLinesVisibile(false) ) ; and it works! My series becomes invisible when calling:

Code: Select all

(subplot1.getRendererForDataset(subplot1.getDataset(0))).setSeriesVisible(0, false, true);
I think that XYDotRenderer has a bug, so that it doesn't make the series invisible, even though this feature works fine with StandardXYItemRenderer and XYLineAndShapeRenderer.


Cheers,
Radu
“First they ignore you, then they laugh at you, then they fight you, then you win.” - Gandhi

Locked