Line Series and Axes Automatic Scaling

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JonM
Newbie
Newbie
Posts: 23
Joined: Tue Sep 14, 2004 4:00 am
Location: UK

Line Series and Axes Automatic Scaling

Post by JonM » Thu Jan 28, 2016 10:39 am

Hi There

I'm adding a Styles.Line series to a chart which has the axes scaling set to Automatic.

Adding the series is causing the X axis scaling to change with undesirable results.

I would like to keep the Automatic scaling as it works well for the data series - is there a way to prevent it from changing the scale when certain Line series are added to the chart?

Many Thanks

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

Re: Line Series and Axes Automatic Scaling

Post by Christopher » Mon Feb 01, 2016 1:35 pm

Hello Jon,
JonM wrote: I would like to keep the Automatic scaling as it works well for the data series - is there a way to prevent it from changing the scale when certain Line series are added to the chart?
One way to do this would be to disable Automatic scaling when adding in certain line series, e.g.

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(typeof(Line)).FillSampleValues();
    }

    private void button4_Click(object sender, EventArgs e)
    {
      tChart1.Axes.Bottom.Automatic = false;

      Random rnd = new Random();
      tChart1.Series.Add(typeof(Line));
      for (int i = 0; i < 100; i++)
      {
        tChart1[1].Add(i, rnd.Next(2000));
      }
    }
however, what this does mean is that when you turn Automatic back to true, the bottom axes will readjust to fit all the values on the next repaint. The only way to maintain control of axes min and max, when wanting all series visible, is to control the values manually (Maximum, Minimum properties, or SetMinMax() method).
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