Legend Positioning

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Legend Positioning

Post by qcrnd » Wed May 13, 2009 8:09 am

Hi
My Legends Symbols are position on the right side of the graph.
By default the Symbols TopLeftPos property is 10.
I would like my Symbols Top to aligned with the top part of the back wall (the top part of the actual graph). I found TopLeftPos == 0 is too high because the offset is from the begining of the chart title. I want the symbols top position to be aligned with the top position of the chart itself (the top position of the back wall)
Is there any way to calculate this (assuming that the chart title font size can be changed by the user)
Thanks.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Wed May 13, 2009 9:48 am

Hello gcrnd,

If you want change legend Position I recomend that use CustomPosition. I make a simple example, that you could use with a similar code.


Code:

Code: Select all

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.Box box1 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
            Steema.TeeChart.Styles.Box box2 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
            Steema.TeeChart.Styles.Box box3 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
            box1.FillSampleValues();
            box2.FillSampleValues();
            box3.FillSampleValues();

            box1.Position = 1;
            box2.Position = 2;
            box3.Position = 3;
            
            box1.Color = Color.Blue;
            box2.Color = Color.Red;
            box3.Color = Color.Orange;

            tChart1.Draw();

            Rectangle rect = tChart1.Chart.ChartRect;

            tChart1.Legend.CustomPosition = true;
            tChart1.Legend.Top = rect.Top;

            tChart1.Panel.MarginRight = 20;

            tChart1.Axes.Bottom.SetMinMax(0.5, 3.5);
        }
Thanks,
Best Regards,
Sandra Pazos / 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

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Wed May 13, 2009 10:07 am

Isnt there anything automatic. something that is aligned to the top ?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Wed May 13, 2009 10:27 am

Hello gcrnd,
Isnt there anything automatic. something that is aligned to the top ?
If you want position automatic you can use:

Code: Select all

Chart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Top;
But, this property puts the legend in the top of the Chart.



Thanks,
Best Regards,
Sandra Pazos / 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

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Wed May 13, 2009 11:00 am

Hi
No I didnt mean that . I want it on the right side but aligned with the top of the back wall.
Thanks

Post Reply