series references

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

series references

Post by Diego Garber » Mon Jan 27, 2003 4:49 pm

Dave, I need to have more control over the series references (especially hidding them), is there any news about new functionality?, or could you give some pointers on how could I solve this problem?
Thanks,

Diego.

David Gilbert

Re: series references

Post by David Gilbert » Mon Jan 27, 2003 9:21 pm

Hi Diego,

If you mean the appearance of the series in the chart legend...there's no code for hiding them. I think the easiest way to achieve this would be to override the getLegendItems() method in the Plot class, and only return the items you want to display.

Regards,

Dave Gilbert

Diego Garber

Re: series references

Post by Diego Garber » Tue Jan 28, 2003 4:04 pm

Hi Dave,
I've been looking at getLegendItems() method and the thing is that it gets the LegendItem from the renderer, and the renderer creates the LegendItem on request. Can I assume that the getLegendItem() method in the renderer class is called by whatever the class draws the legends in the chart, when it needs to?.
Maybe that way I can hide by not returning any legend or something, what do you think?

David Gilbert

Re: series references

Post by David Gilbert » Wed Jan 29, 2003 12:27 am

The renderer is used to construct an item because the renderer has access to the paint, stroke, and shape used to draw the series. But if you've overridden getLegendItems, you can just call the renderer to get the LegendItem for each series that you want to display...ignore the others.

Regards,

Dave Gilbert

Diego Garber

Re: series references

Post by Diego Garber » Wed Jan 29, 2003 2:20 pm

Dave, you said:

"you can just call the renderer to get the LegendItem for each series that you want to display"

I don´t quite understand you, the legends are displayed "by them selves" without me calling getLengendItems. I don't know which class (in jfreechart) is responsible for calling it, but that would be another aproach for hiding legends.
Another one, how can I remove a subPlot that was added to a CombinedPlot?

Locked