Page 1 of 1

Sort order in legend

Posted: Fri Aug 20, 2004 1:06 pm
by 6923391
I have received a lot of great answer and help. Thank you!

However, here's another one! :)

I'd like to change the order in which the items in the legend appears. I have to add the items to the chart in a certain order otherwise they overlap and hides each other. But this makes the items appear on the legend in the same order that I add them, and not in the order I'd like.

Suggestions?

Thank you...

Posted: Mon Aug 23, 2004 4:42 pm
by Chris
Hi ..
I'd like to change the order in which the items in the legend appears. I have to add the items to the chart in a certain order otherwise they overlap and hides each other. But this makes the items appear on the legend in the same order that I add them, and not in the order I'd like.
How about using a dummy series and an extralegend tool, e.g.

Code: Select all

Random rnd = new Random();

Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line();

line1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
line1.YValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
line2.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
line2.YValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;

for(int i=0;i<10;++i) {
	line1.Add(rnd.Next(10), rnd.Next(100));
	line2.Add(line1[i].X, line1[i].Y);
}
tChart1.Series.Add(line2);

line2.Active = false;
line2.Color = line1.Color;
extraLegend1.Series = line2;
extraLegend1.Legend.Left = 50;
extraLegend1.Legend.Top = 50;