Extra value margin added to scale(s)

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Extra value margin added to scale(s)

Post by BeijerElectronics » Wed Nov 09, 2011 3:40 pm

There is an extra margin added to the scale compared to the configured scale min/max values.
See the attached picture.

Is there a way to configure that the scale min/max correspond to the min/max properties?
Attachments
min_max_scale.png
min_max_scale.png (363.5 KiB) Viewed 7190 times

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

Re: Extra value margin added to scale(s)

Post by Sandra » Thu Nov 10, 2011 10:00 am

Hello BeijerElectronics,

I have made a simple code that works fine for me. Can you tell if next code works as you expected?

Code: Select all

          Steema.TeeChart.Styles.Bar bar1 = new Bar (tChart1.Chart);
            tChart1.Aspect.View3D = false;
            Random rnd = new Random();
       
             for (int i = 0; i < 50; i  )
            {
                
                if (i > 0 && i < 25)
                {
                    bar1.Add(-i, rnd.Next(100));
                   
                }
                else if (i >=25)
                {
                    bar1.Add(i, rnd.Next(100));
                }
                else if (i == 0)
                {
                    bar1.Add(i, rnd.Next(100));
                }
              
            }

             bar1.SideMargins = false;
             tChart1.Axes.Left.SetMinMax(bar1.YValues.Minimum, bar1.YValues.Maximum-1);
             tChart1.Axes.Bottom.SetMinMax(bar1.XValues.Minimum-1, bar1.XValues.Maximum);

             tChart1.Axes.Bottom.Labels.Angle = 90;
         
        }
If previous code doesn't make as you want and your problem isn't appears try to arrange us a simple code so we can reproduce exactly your problem and try to give a good answer for it.

On the other hand, also may be your problem would appears, because your MinimumOffset i MaximumOffset of Axes, set differents to 0 and I recommend you change it to 0 as do in next code:

Code: Select all

    
           tChart1.Axes.Left.MaximumOffset = 0;
            tChart1.Axes.Left.MinimumOffset = 0;
            tChart1.Axes.Bottom.MaximumOffset = 0;
            tChart1.Axes.Bottom.MinimumOffset = 0;
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

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Extra value margin added to scale(s)

Post by BeijerElectronics » Fri Nov 11, 2011 11:25 am

Hello Sandra,

Thanks for your reply.

These minimum and maximum offset values on the Axes are default set to 0, so that does not help.
The problem is very easy to reproduce, simply add some Y values to a bar chart and set a maximum Y value to 100, then when running the application the chart will most often add some extra “offset” value to the maximum Y on the axis so that it states 110 for example, instead of 100 as wanted.

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

Re: Extra value margin added to scale(s)

Post by Sandra » Fri Nov 11, 2011 12:07 pm

Hello BeijerElectronics,

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

Code: Select all

 Steema.TeeChart.Styles.Bar bar1 = new Bar (tChart1.Chart);
            tChart1.Aspect.View3D = false;
            Random rnd = new Random();

            for (int i = 0; i < 50; i++)
            {
                bar1.Add(i,rnd.Next(100));
            }
            bar1.Add(50, 100);


            bar1.Marks.Visible = false;
}
Can you check if previous code works as you expected? And also, can you please, 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

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Extra value margin added to scale(s)

Post by BeijerElectronics » Fri Nov 11, 2011 1:06 pm

Hello,

We use 4.1.2011.10192

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Extra value margin added to scale(s)

Post by Narcís » Fri Nov 11, 2011 3:29 pm

Hi BeijerElectronics,

Does the code Sandra posted reproduces the problem at your end? If the problem persists please attach a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.
Best Regards,
Narcís Calvet / 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

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Extra value margin added to scale(s)

Post by BeijerElectronics » Wed Nov 16, 2011 2:32 pm

Hi,

The solution seems to be this row:

bar.Marks.Visible = false;

What does it do? Disables the "balloon" tooltips above each bar? So the only way to get the specific minimum and maximum value specified is when disabling the marks, is this a correct behavior?

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

Re: Extra value margin added to scale(s)

Post by Sandra » Thu Nov 17, 2011 2:28 pm

Hello BeijerElectronics,

I think can help you know bar series have property bar.Xvalues.MaxValue, bar.Xvalues.MinValue, bar.Yvalues.MaxValue, bar.Yvalues.MinValue that allow you to fix the size of Axes with specific values of Series. On the other hand, if it isn't a solution for you, please send us a simple project for us, so we can try to give you a good answer about 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

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Extra value margin added to scale(s)

Post by BeijerElectronics » Wed Nov 23, 2011 10:40 am

Hi,

The MinValue and MaxValue properties on XValues and YValues on a series are readonly and cannot be assigned.

This sample shows the problem, but disabling the Marks property solves the problem but what if I want the Marks visible also?

Code: Select all

           var bar = new Bar();
            tChart1.Series.Add(bar);

            tChart1.Axes.Left.Minimum = 0;
            tChart1.Axes.Left.Maximum = 100;

            Random rnd = new Random();

            double[] xValues = new double[51];
            double[] yValues = new double[51];

            for (int i = 0; i < 50; i++)
            {
                xValues[i] = i;
                yValues[i] = rnd.Next(100);
            }

            xValues[50] = 50;
            yValues[50] = 100;

            bar.Add(xValues, yValues);

            //bar.Marks.Visible = false;

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

Re: Extra value margin added to scale(s)

Post by Sandra » Wed Nov 23, 2011 12:25 pm

Hello BeijerElectronics,

Ok. I think you can solve your problem changing the MaximumOffset or MinimOffset. In your case I recommend change MaximumOffset from 0 to 1 as do in next example:

Code: Select all

        private void InitializeChart()
        {
              var bar = new Bar();
            tChart1.Series.Add(bar);

            tChart1.Axes.Left.Automatic = false;
            tChart1.Axes.Left.Minimum = 0;
            tChart1.Axes.Left.Maximum = 100;
            tChart1.Axes.Left.MaximumOffset = 1;

            Random rnd = new Random();

            double[] xValues = new double[51];
            double[] yValues = new double[51];

            for (int i = 0; i < 50; i++)
            {
                xValues[i] = i;
                yValues[i] = rnd.Next(100);
            }

            xValues[50] = 50;
            yValues[50] = 100;

            bar.Add(xValues, yValues);

       //     bar.Marks.Visible = false;
           // tChart1.Aspect.ClipPoints = false;
            
        }
Can you please, tell us if previous code works as you expect?

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