Footer Alignment in Silverlight

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Footer Alignment in Silverlight

Post by Neelam » Tue Mar 27, 2012 9:17 am

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.

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

Re: Footer Alignment in Silverlight

Post by Sandra » Tue Mar 27, 2012 3:09 pm

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,
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Re: Footer Alignment in Silverlight

Post by Neelam » Tue Mar 27, 2012 5:00 pm

No, its not working. It alignes the footer text and not the footer itself.

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

Re: Footer Alignment in Silverlight

Post by Sandra » Wed Mar 28, 2012 4:48 pm

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,
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

Post Reply