2
votes

I would like to represent legend items' markers as lines for my Lineseries and not as boxes(by default) . I have managed it through setting markerWidth and markerHeight in a Legend tag. However, I have not only lineseries, but also plot series in my chart, which has diamond form marker. So, whenever I squeeze the box to a form of line in my legend, my plot series' marker is getting ugly.So, my questions:

1.Is there any way to control legend items separatly without creating a legend manually, item by item?

  1. if I add item by item, how can I get the same style for my marker as related series have? (e.g. same shape and color as item renderer)
1

1 Answers

1
votes

The way I'd do it is to create a custom LegendItem subclass that has a custom property with a getter/setter pair that takes a value of type function. Then I'd provide a ClassFactory that supplies the function as the LegendItem for your Legend. You'd call the function within the LegendItem to figure out what renderer to make based on the series.

I forget exactly when you'd do this in the Flex life-cycle--I've been out of Flex for almost 2 years. It's possible that there's a smarter/simpler way to do this that I've also forgotten. But it should work.