Page 1 of 1

Grouping of data in a legend

Posted: Fri Jul 27, 2007 12:42 pm
by 9640591
I have a requirement to group the data in the Legend. How can this be achieved.

Posted: Mon Jul 30, 2007 11:32 am
by narcis
Hi usc,

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

Thanks in advance.

Posted: Wed Aug 01, 2007 8:45 am
by 9640591
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]

Posted: Wed Aug 01, 2007 10:09 am
by 9348258
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.

Posted: Mon Aug 06, 2007 9:46 am
by 9640591
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

Posted: Mon Aug 06, 2007 10:19 am
by 9348258
Hi usc

You can sort the series, as below method:

Code: Select all

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

Posted: Tue Aug 07, 2007 6:04 am
by 9640591
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

Posted: Tue Aug 07, 2007 10:11 am
by narcis
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.