Legend items order


I want to achive a reverse order of the legend items within a chart especially a stacke bar chart. The last item in the Legend should be the lowest bar in the stacked bar. Hence. the order in the Legend should corresponse to the order in the chart (bottom up).


In DrawLegend procedure it uses the points order.
I'm afraid the best option would be submit a feature request for a TTMSFNCChartSerie.Legend.ReverseOrder property, or a LegendIndex property at Series or Point level, depending on the chart type.

If that's too urgent and your subscription includes source code, you could create this property, change the for..to loop in DrawLegend procedure and XYToLegendItem function, and beware that you'd have to do it again after a new version install.

Basically you'd need to encapsulate the code inside the loop in a new local nested procedure, and make something like:

if Legend.ReverseOrder then
  for I := cnt - 1 downto 0 do
  for I := 0 to cnt - 1  do

PS: at your own risk :smiley:

Also should check if this reverse order would affect someway the drawn positions & rects' dimensions, but it looks like none of them depends on the loop variable.