Grouping of data in a legend

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Grouping of data in a legend

Post by usc » Fri Jul 27, 2007 12:42 pm

I have a requirement to group the data in the Legend. How can this be achieved.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jul 30, 2007 11:32 am

Hi usc,

Could you please give us some more detailed information on what you are trying to achieve?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Wed Aug 01, 2007 8:45 am

Hi Narcis

I am sorry I guess my question was wrong as I had understood the requirement of my project wrongly.

The exact question I would like to ask you is:
Can I sort the text in the chart legend in a custom manner(say for example alphabetically or in a group.

For example : I have the text in the legend as
Grp1:well1:Production
Grp1:well2:Support
Grp2:well1:Production
Grp2:well1:Support


I would want to sort the legend text as:
Grp1:well1:Production
Grp2:well1:Production
Grp1:well2:Support
Grp2:well1:Support

I hope I have made myself clear. You can refer to the image Chart_Legend for any reference or get back to me in case you have any clarifications.

Thanks and Regards
Usc



[/img]

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Wed Aug 01, 2007 10:09 am

Hi usc

The values of the legend are sorting with the order which have been added. If you want to order alphabetically then the solution is drawing a custom legend on TeeChart's canvas using its Rectangle and TextOut methods. You can also add checkboxes to this custom legend.

You can find examples on how to custom draw on TeeChart's canvas at All Features\Welcome !\Canvas\ in TeeChart's features demo. The demo is available at TeeChart's program group.
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Mon Aug 06, 2007 9:46 am

Hi Edu

Hwnecer I am adding a series to the chart, the series name is added to the Legend and it gets sorted in the Legend automatically.

Can I prevent the text in the legend from sorting when I add a series to the chart.

Regards
Usc

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Mon Aug 06, 2007 10:19 am

Hi usc

You can sort the series, as below method:

Code: Select all

 tChart1.Series.Exchange(0, 1);
The legend will be sorted too.
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Tue Aug 07, 2007 6:04 am

Hi Edu

Please find the document Legend Ordering.Doc
for your reference to the sorting problem I am facing in my project.

I have specified, how the data is currently being sorted and what is my requirement in the document.

Also, I have a query. Can I stop sorting of the series in the legend.Whenever i add a series to the chart, it gets added and sorted to the legend automatically.

Request you to kindly help me out in this problem,

Thanks and Regards,
Usc

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Aug 07, 2007 10:11 am

Hi usc,

Series are displayed in the legend in the order they are added to the chart. Have you tried sorting them changing series order on the chart using Exchange method Edu suggested?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply