Page 1 of 1

Footer Alignment in Silverlight

Posted: Tue Mar 27, 2012 9:17 am
by 13045482
Hi,

I'm using Silverlight version of TeeChart v 4.1.2012.1033. By default footer is positioned in center. There is no way to align it on the right side of chart.
In Windows.NET we can achieve the same by using the following statment.
TeeChart.Footer.Alignment = StringAlignment.Far

But in silverlight we don't have Footer.Alignment property. Please let me know if there is any way to align footer.

Re: Footer Alignment in Silverlight

Posted: Tue Mar 27, 2012 3:09 pm
by 10050769
Hello Nelam,

If you want align your footer in Silverlight, you must use the property TextAlign instead of Alignment as do in next line of code:

Code: Select all

tChart1.Footer.TextAlign = TextAlignment.Right; 
Can you confirm us if my suggestion works as you expect?

I hope will helps.

Thanks,

Re: Footer Alignment in Silverlight

Posted: Tue Mar 27, 2012 5:00 pm
by 13045482
No, its not working. It alignes the footer text and not the footer itself.

Re: Footer Alignment in Silverlight

Posted: Wed Mar 28, 2012 4:48 pm
by 10050769
Hello Neelam,

I suggest you do something as next to change the position of footer:

Code: Select all

 public MainPage()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            Steema.TeeChart.Silverlight.Styles.Bar bar1 = new Steema.TeeChart.Silverlight.Styles.Bar(tChart1.Chart);
            positions.Items.Add("Center");
            positions.Items.Add("Left");
            positions.Items.Add("Right");
            //tChart1.Height = 320;
            //tChart1.Width = 520;
            tChart1.Chart.Aspect.View3D = false;
            bar1.FillSampleValues();
          
            tChart1.Panel.MarginBottom = 10;
            tChart1.Panel.MarginTop = 10;
            //Draw before calculate positions header and footer. 
            positions.SelectedIndex = 0;
            BitmapSource bmp = tChart1.Chart.Bitmap(tChart1.Chart.Width,tChart1.Chart.Width);
            positions.SelectionChanged += new SelectionChangedEventHandler(positions_SelectionChanged);
        
        }

        void positions_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            switch (positions.SelectedIndex)
            {
                case 0:
                    tChart1.Header.Left = (int)tChart1.Axes.Left.Maximum;
                    tChart1.Header.Left = (int)tChart1.Axes.Bottom.IAxisSize / 2;
                    tChart1.Header.Top = 0;
                    tChart1.Footer.Top = tChart1.Axes.Left.CalcPosValue(0) + 20;//You choose where is drawn.
                    tChart1.Footer.Left = (int)tChart1.Axes.Bottom.IAxisSize / 2;
                    tChart1.Header.TextAlign = TextAlignment.Center;
                    break;
                case 1:
                    tChart1.Header.Left = (int)tChart1.Axes.Left.Maximum;
                    tChart1.Header.Left = (int)tChart1.Axes.Bottom.CalcPosValue(0);
                    tChart1.Header.Top = 0;
                    tChart1.Footer.Top = tChart1.Axes.Left.CalcPosValue(0) + 20;//You choose where is drawn.
                    tChart1.Footer.Left = (int)tChart1.Axes.Bottom.CalcPosValue(0);
                    tChart1.Header.TextAlign = TextAlignment.Left;
                    break;
                case 2:
                    tChart1.Header.Left = (int)tChart1.Axes.Left.Maximum;
                    tChart1.Header.Left = (int)tChart1.Axes.Bottom.IAxisSize;
                    tChart1.Header.Top = 0;
                    tChart1.Footer.Top = tChart1.Axes.Left.CalcPosValue(0) + 20;//You choose where is drawn.
                    tChart1.Footer.Left = (int)tChart1.Axes.Bottom.IAxisSize;
                    tChart1.Header.TextAlign = TextAlignment.Right;
                    break;
            }
           
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //Initialize to 0;
            tChart1.Footer.Visible = true;
            tChart1.Footer.CustomPosition = true;
            tChart1.Header.CustomPosition = true;

            tChart1.Footer.Text = "TeeChart for .net version 4";
            tChart1.Header.Text = "My Chart";

            tChart1.Header.Left = (int)tChart1.Axes.Left.Maximum;
            tChart1.Header.Left = (int)tChart1.Axes.Bottom.IAxisSize / 2;
            tChart1.Header.Top = 0;
            tChart1.Footer.Top = tChart1.Axes.Left.CalcPosValue(0) + 20;//You choose where is drawn.
            tChart1.Footer.Left = (int)tChart1.Axes.Bottom.IAxisSize / 2;
            tChart1.Header.TextAlign = TextAlignment.Center;
        }
    }
}
Can you tell if previous example help you to achieve as you want?
I hope will helps.

Thanks,