Page 1 of 1

Legend Positioning

Posted: Wed May 13, 2009 8:09 am
by 9092401
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.

Posted: Wed May 13, 2009 9:48 am
by 10050769
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,

Posted: Wed May 13, 2009 10:07 am
by 9092401
Isnt there anything automatic. something that is aligned to the top ?

Posted: Wed May 13, 2009 10:27 am
by 10050769
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,

Posted: Wed May 13, 2009 11:00 am
by 9092401
Hi
No I didnt mean that . I want it on the right side but aligned with the top of the back wall.
Thanks