Welcome to the JavaScript feedback portal. We’re happy you’re here! If you have feedback on how to improve the JavaScript, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

0
Votes

I note that the legend item order is always the order of the series on the internal property seriesCollection of the chart and that zOrder doesn't merely influence render stacking order but the order of series in seriesCollection.

This means that, as far as I can tell, it's impossible to have a different stacking order for series to legend order. I have a use case where I want to plot multiple series and need to have one column series plotted below scatter series (and take precedence for tooltip) but appear part way through the list of legend items. At the moment that is impossible (other than me using code in the loaded event to reorder the g elements in the svgObject after each render, which is not ideal).

The simplest fix would seem to be to not have zOrder impact seriesCollection sort order (so zOrder is only used when actually rendering the series elements for the render order).

Ideally it would be useful to be able to specify legend order specifically (with e.g. a legendOrder property on the series) but I note that several bits of code in the chart rely on legendCollection indexes being matching seriesCollection indexes (or the reverse if legend order is reversed) so understand this would be non-trivial (although I see LegendOption has an unused seriesIndex property so I assume there is a plan to remove this dependency on the indexes matching).