Axis.Automatic with a margin

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ctusch
Newbie
Newbie
Posts: 11
Joined: Tue Sep 25, 2007 12:00 am
Contact:

Axis.Automatic with a margin

Post by ctusch » Thu Oct 28, 2010 8:06 am

Hi,

when I have Axis.Automatic = true and there are two lines assigned to this axis and the first runs at y=1 and the second at y=3 then my axis min will be 1 and my max will be 3. The problem is when my series are just straight lines they are not visible because they are exactly at the borders of the chart. So i would need some kind of margin so that the min/max of the axis is always some pixels more than the actual min/max.

How can I do this? Is there a build-in functionality for this?

ctusch
Newbie
Newbie
Posts: 11
Joined: Tue Sep 25, 2007 12:00 am
Contact:

Re: Axis.Automatic with a margin

Post by ctusch » Thu Oct 28, 2010 9:01 am

Okay, I've found it! :) Axis.MinimumOffset & Axis.MaximumOffset do the job perfectly.

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

Re: Axis.Automatic with a margin

Post by Sandra » Thu Oct 28, 2010 10:26 am

Hello ctusch,

I am glad that you found a solution for your problem :).

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

ctusch
Newbie
Newbie
Posts: 11
Joined: Tue Sep 25, 2007 12:00 am
Contact:

Re: Axis.Automatic with a margin

Post by ctusch » Tue Dec 21, 2010 9:21 am

Hello,

seems like I was too hasty. Axis.MinimumOffset & Axis.MaximumOffset work only when Axis.Automatic is set to false. That's a big problem as one of our customers needs automatic axis scaling. What can I do about this?

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

Re: Axis.Automatic with a margin

Post by Sandra » Tue Dec 21, 2010 1:03 pm

Hello ctusch,

I couldn't reproduce your problem using last version of TeeChart.Net and next code:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private Steema.TeeChart.Styles.Line line1, line2;
        Steema.TeeChart.TChart tChart1;
        Steema.TeeChart.ChartController ChartController;
        private void InitializeChart()
        {
           this.tChart1 = new Steema.TeeChart.TChart();
           
           this.ChartController = new Steema.TeeChart.ChartController();
            this.Controls.Add(tChart1);
            this.Controls.Add(ChartController);
            this.tChart1.Left = 100;
            this.tChart1.Top = 50;
            ChartController.Chart = tChart1;
            tChart1.Aspect.View3D = false;
            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            Random rnd = new Random();
            for (int i = 0; i < 10; i  )
            {
                line1.Add(i, rnd.Next(10));
                line2.Add(i, rnd.Next(10));
              
            }

            tChart1.Axes.Left.MinimumOffset = 50;
            tChart1.Axes.Left.MaximumOffset = 70;
Please, check if previous code works as you want? If it doesn't work for you could you tell us which version of TeeChart.Net are you using.

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

ctusch
Newbie
Newbie
Posts: 11
Joined: Tue Sep 25, 2007 12:00 am
Contact:

Re: Axis.Automatic with a margin

Post by ctusch » Tue Dec 21, 2010 1:23 pm

It doesn't work here, it looks like this:
tchart.png
tchart.png (16.78 KiB) Viewed 6583 times
I'm using version 3.5.3700.30575.

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

Re: Axis.Automatic with a margin

Post by Sandra » Tue Dec 21, 2010 2:55 pm

Hello ctusch,

Your problem is solved in last version of TeeChart.Net (version 4) and in it version works correctly. For version 3 there are a workaround using StartPosition and EndPosition:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private Steema.TeeChart.Styles.Line line1, line2;
        Steema.TeeChart.ChartController ChartController;
        private void InitializeChart()
        {
            this.tChart1 = new Steema.TeeChart.TChart();
            this.ChartController = new Steema.TeeChart.ChartController();
            this.Controls.Add(tChart1);
            this.Controls.Add(ChartController);
            this.tChart1.Left = 100;
            this.tChart1.Top = 50;
            ChartController.Chart = tChart1;
            tChart1.Aspect.View3D = false;
            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            Random rnd = new Random();
            for (int i = 0; i < 10; i++)
            {
                line1.Add(i, rnd.Next(10));
                line2.Add(i, rnd.Next(10));

            }
            tChart1.Axes.Left.StartPosition = 10;
            tChart1.Axes.Left.EndPosition = 95;
        }
    
Could you please, tell us if previous code is a good solution for you?

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

ctusch
Newbie
Newbie
Posts: 11
Joined: Tue Sep 25, 2007 12:00 am
Contact:

Re: Axis.Automatic with a margin

Post by ctusch » Tue Dec 21, 2010 3:18 pm

Hello Sandra,

your workaround works, thanks for your help!

Post Reply