Page 1 of 1

Custom position API for Header Footer and Sub Footer

Posted: Fri Sep 24, 2010 5:01 am
by 15657203
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.

Re: Custom position API for Header Footer and Sub Footer

Posted: Mon Sep 27, 2010 9:35 am
by 10050769
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,

Re: Custom position API for Header Footer and Sub Footer

Posted: Wed Nov 10, 2010 3:59 pm
by 15657203
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.

Re: Custom position API for Header Footer and Sub Footer

Posted: Wed Nov 10, 2010 5:49 pm
by 10050769
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,

Re: Custom position API for Header Footer and Sub Footer

Posted: Mon Jul 25, 2011 7:06 pm
by 15657203
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?

Re: Custom position API for Header Footer and Sub Footer

Posted: Mon Jul 25, 2011 7:10 pm
by 15657203
Example does not appear to work...

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

Regards.

Re: Custom position API for Header Footer and Sub Footer

Posted: Wed Jul 27, 2011 10:39 am
by 10050769
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 495 times
Thanks,

Re: Custom position API for Header Footer and Sub Footer

Posted: Tue Aug 02, 2011 2:35 pm
by 15657203
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?

Re: Custom position API for Header Footer and Sub Footer

Posted: Wed Aug 03, 2011 9:03 am
by 10050769
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,