Renderer not setting series invisible

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Fred
Posts: 38
Joined: Sat Dec 12, 2015 4:57 pm
antibot: No, of course not.

Renderer not setting series invisible

Post by Fred » Tue Jan 05, 2016 7:01 pm

Hello,

I have a XYItemRenderer that i have 2 series on. Ultimately, I will have multiple renderers (XYItemRenderer, Vector) but for now I cannot get a
series on this renderer to go invisible. I evaluate the "getItemVisible(series,item)" afterwards to determine if any of the items should be displayed.
The value returned is false but the series/items remain on the chart. I have placed s snibbit of the code below. Its embedded within a keyListener event.
The idea is that a user will click on the related series/item. Hit a hotkey that will issue the calls to make the series invisible.

Code: Select all

                        	seriesVal = Integer.parseInt(items2Change.substring(startP, endP));
                        	System.out.println("datasetVal="+datasetVal+"..seriesVal="+seriesVal);
                        	XYDataset dsVal = plot.getDataset(datasetVal);
                        	System.out.println("dsVal="+dsVal);
                        	//plot.getRendererForDataset(plot.getDataset(datasetVal)).setSeriesVisible(seriesVal, Boolean.FALSE, Boolean.TRUE);
                        	plot.getRenderer().setBaseSeriesVisible(Boolean.FALSE, Boolean.TRUE);
                        	boolean tVisible = plot.getRenderer().getItemVisible(seriesVal, 0);
                                System.out.println("tVisible="+tVisible);

Ideas?

Thanks

Fred
Posts: 38
Joined: Sat Dec 12, 2015 4:57 pm
antibot: No, of course not.

Re: Renderer not setting series invisible

Post by Fred » Wed Jan 06, 2016 12:05 am

All,

It seems that the renderer I have a sub-class of did not have the code to just return if the getItemVisible(series, item) was false.

Still looking at being able to hide items within a series/dataset.

Problem resolved.

Locked