ScrollPager and Custom axis, problem with margins

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

ScrollPager and Custom axis, problem with margins

Post by acastro » Fri Feb 14, 2014 12:05 pm

When I have in my chart scrollpager and also custom axis it is not possible to set the margin. Although I go to the chart editor and I put a very big margin it doesn't do anything.

Please find here an example. Press button1 to add scrollpager, and button4 to add custom margin
http://193.145.251.126/pnp/files/pycecb ... Scroll.zip

Thanks

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: ScrollPager and Custom axis, problem with margins

Post by Christopher » Fri Feb 14, 2014 3:27 pm

wakeup wrote:When I have in my chart scrollpager and also custom axis it is not possible to set the margin. Although I go to the chart editor and I put a very big margin it doesn't do anything.
This can be ameliorated by code such as the following:

Code: Select all

        private void button4_Click(object sender, EventArgs e)
        {
            Steema.TeeChart.Axis customAxis = new Steema.TeeChart.Axis(tChart1.Chart);

            customAxis.Title.Visible = true;
            customAxis.Visible = true;
            customAxis.Automatic = true;

            tChart1.Axes.Custom.Add(customAxis);
            tChart1.Series[0].CustomVertAxis = customAxis;

            //one possibility
            //tChart1.Chart.CustomChartRect = false;
            //tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
            //tChart1.Panel.MarginLeft = 100;
            //tChart1.Panel.MarginRight = 100;
            //tChart1.Panel.MarginBottom = 200;

            //another possibility
            tChart1.Chart.CustomChartRect = true;
            Rectangle rect = tChart1.Chart.ChartRect;
            rect.X += 100;
            tChart1.Chart.ChartRect = rect;
        }
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: ScrollPager and Custom axis, problem with margins

Post by acastro » Fri Feb 14, 2014 3:59 pm

With the CustomChartRect = true; solution the chart is not resized automatically when the window is resized...

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: ScrollPager and Custom axis, problem with margins

Post by Christopher » Fri Feb 14, 2014 4:26 pm

wakeup wrote:With the CustomChartRect = true; solution the chart is not resized automatically when the window is resized...
This is expected behaviour - when the tChart.Chart.ChartRect is not calculated automatically, that is, when CustomChartRect = true, the size of the chart remains at the size specified by tChart.Chart.ChartRect.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: ScrollPager and Custom axis, problem with margins

Post by acastro » Fri Feb 14, 2014 4:29 pm

Where is CustomChartRect property in the chart editor?
Do you have any code to calculate the margins , and taking into account if the scrollpager is there or not?

Thanks

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: ScrollPager and Custom axis, problem with margins

Post by Christopher » Fri Feb 14, 2014 4:37 pm

wakeup wrote:Where is CustomChartRect property in the chart editor?
It isn't the Chart Editor because it is considered an advanced property for use by the internal TeeChart code and experienced TeeChart developers. If you like, you could add it as an enhancement to http://bugs.teechart.net/.
wakeup wrote: Do you have any code to calculate the margins , and taking into account if the scrollpager is there or not?
Recalculating the margins can be done in the Resize event, as has been discussed in another recent thread.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply