Custom position API for Header Footer and Sub Footer

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
elby
Newbie
Newbie
Posts: 11
Joined: Fri Sep 10, 2010 12:00 am

Custom position API for Header Footer and Sub Footer

Post by elby » Fri Sep 24, 2010 5:01 am

I was hoping that the positioning of the Header and Footer would be as simple as positioning the Legend with the LegendAlignments.

We are trying to mimic the same behavior options for the Header and Footer as the Legend, but the API is much more flexible with the Custom Positioning option.

We will need the header and footer to move appropriately when the user changes the position from Bottom Left, Bottom Right, Bottom Center for example .
(these are options we are customizing for our user)

I have turned off the autosize and turned on the custom positioning and it appears to read my values when I set Left, Bottom, Top and Right. But I must be setting them incorrectly.

How should I be specifying the position of the SubFooter for example if I want it to be on the Bottom Right of the chart, it should remain in the relative position as the chart resizes. (therefore no fixed values)

Any help is appreciated.

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

Re: Custom position API for Header Footer and Sub Footer

Post by Sandra » Mon Sep 27, 2010 9:35 am

Hello elby,

When you use custom position of Header or Footer and you want change TextAling you need modify its left and top position, because text have been aligned to right, center or left. I have made a simple example that I think you can use in your application:

Code: Select all

  private void InitializeChart()
        {
            Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            comboBox1.Items.AddRange(new object[] { "Center","Left","Right"});																							
            bar1.FillSampleValues();
            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.Panel.MarginBottom = 10;
            tChart1.Panel.MarginTop = 10;
            comboBox1.SelectedIndex = 0;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.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 = StringAlignment.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 = StringAlignment.Far;
                        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 = StringAlignment.Near;
                        break;
            }
        }
Could you please, tell us if previous code works 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

elby
Newbie
Newbie
Posts: 11
Joined: Fri Sep 10, 2010 12:00 am

Re: Custom position API for Header Footer and Sub Footer

Post by elby » Wed Nov 10, 2010 3:59 pm

What version of TChart was used for this implementation.

The version I have has Header.TextAlign as a TextAlignment not a StringAlignment?

I am using TeeChartNET2010VSNET2010_4.1.2010.08043.

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

Re: Custom position API for Header Footer and Sub Footer

Post by Sandra » Wed Nov 10, 2010 5:49 pm

Hello elby,
What version of TChart was used for this implementation.
I have been used for implementation my code, the last maintenance release TeeChart for .NET v2010 [28 SEP 2010] RELEASE 4.1.2010.09280, please see this post.
The version I have has Header.TextAlign as a TextAlignment not a StringAlignment?I am using TeeChartNET2010VSNET2010_4.1.2010.08043

Ok, I have checked that version with you are working, use StringAlignment, as next line:

Code: Select all

tChart1.Header.TextAlign = StringAlignment.Near;
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

elby
Newbie
Newbie
Posts: 11
Joined: Fri Sep 10, 2010 12:00 am

Re: Custom position API for Header Footer and Sub Footer

Post by elby » Mon Jul 25, 2011 7:06 pm

Hi.,

We are currently referencing following assembly TeeChart.WPF.dll version 4.1.2011.4191.

I am still unable to see such an enum StringAlignments for positioning the Header and Footer to left/center/right...

Can you attach a complete example (Zipped) so that I compare references?

elby
Newbie
Newbie
Posts: 11
Joined: Fri Sep 10, 2010 12:00 am

Re: Custom position API for Header Footer and Sub Footer

Post by elby » Mon Jul 25, 2011 7:10 pm

Example does not appear to work...

I am attached a running sample that demonstrates the problem i see.

Regards.
Attachments
SteemaHeaderFooterAlignmentIssue.zip
(46.42 KiB) Downloaded 491 times

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

Re: Custom position API for Header Footer and Sub Footer

Post by Sandra » Wed Jul 27, 2011 10:39 am

Hello elby,

Ok. I have modified your project and works fine for me, using TextAlign. Can you please, check if your problem still appears with modifications. If problem still appears, please explain exactly,step to step how we can reproduce it here, so we can try to help you to find a solution for you.
SteemaHeaderFooterAlignmentIssue1.zip
(23.19 KiB) Downloaded 497 times
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

elby
Newbie
Newbie
Posts: 11
Joined: Fri Sep 10, 2010 12:00 am

Re: Custom position API for Header Footer and Sub Footer

Post by elby » Tue Aug 02, 2011 2:35 pm

Hi. Sandra,

Your updated project does not have an TeeChart reference. So it does not compile?

When I reference the TeeChart.WPF.dll version we have it does not work!

Is there a different package we should be using?

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

Re: Custom position API for Header Footer and Sub Footer

Post by Sandra » Wed Aug 03, 2011 9:03 am

Hello elby,

I inform you, there is a new release of TeeChart.Net and I recommend you update your versio. You can download in Custom download Page. On the other hand, I have attached again the project and you need know that I have removed my reference of TeeChart to decrease the size of the file. To compile and run the project, you only have to follow next steps:

- Open the project
- Add your TeeChart.Wpf.dll.
- Rebuild the project and run.

If this still works please let me know.

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