Sort order in legend

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MMP
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: Sweden
Contact:

Sort order in legend

Post by MMP » Fri Aug 20, 2004 1:06 pm

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...

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Aug 23, 2004 4:42 pm

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;
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply