Change symbols in Legends

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

Change symbols in Legends

Post by BugHunter » Mon Nov 18, 2002 7:05 pm

Hello,

I want the symbols in the Legends to be equal to the symbol of the corresponding series. This is important in scatter plots. I know this is not already implemented, so is someone already doing this? If not I would like to start working on it.

Should I implement this directly in the StandardLegend.draw method? If so I would also create a boolean flag to indicate wheter the symbols should be boxes like now, or if they should correspond to the symbol of the series.

Or maybe I should first create a subclass of StandardLegend?

Thanks for any feedback...

PS:
sorry for the test posting before. I just wasn't sure about my email anymore...

Dave Gilbert

Re: Change symbols in Legends

Post by Dave Gilbert » Mon Nov 18, 2002 11:33 pm

The latest code includes a getLegendItem(...) method in the CategoryItemRenderer and XYItemRenderer interfaces. The LegendItem class has an attribute for recording the shape used for a series. The renderer needs to set this (if it is appropriate) in the getLegendItem(...) method, the idea being that the legend can then use this shape to draw the series color rather than the small square that it uses now.

The code is not quite complete, but it's almost there. I hope that the legend will display shapes in 0.9.5. I'm working on something else right now, so if you feel like finishing this off, feel free to jump in...

Regards,

DG

Locked