Axis auto scaling / several axes

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
rh12
Newbie
Newbie
Posts: 1
Joined: Tue Jan 11, 2005 5:00 am

Axis auto scaling / several axes

Post by rh12 » Mon Jun 26, 2006 12:51 pm

How does one turn off autoscaling? I would like to draw two different types of graphs in the same chart.
They should have two different y-axes, with fixed max and min values. However, setting Automatic to false on the axis does not work, the graphs are still autoscaled:

Code: Select all

Axis lAxis = new Axis(false, false, myChart);
lAxis.SetMinMax(0, 50);
lAxis.Automatic = false;
myChart.Chart.Axes.Custom.Add(lAxis);

Axis rAxis = new Axis(false, true, myChart);
rAxis.SetMinMax(0, 200);
rAxis.Automatic = false;
myChart.Chart.Axes.Custom.Add(rAxis);

for(int i=1; i<=2; i++)
{
   Line seriesLine = new Line();
   seriesLine.DataSource = table1;
   seriesLine.XValues.DataMember = "time";
   seriesLine.YValues.DataMember = "value";

   if(i == 1)
   {
      seriesLine.CustomVertAxis = lAxis;
   }   
   else
   {
      seriesLine.CustomVertAxis = rAxis;      
   }
   myChart.Series.Add(seriesLine);
}

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

Post by Narcís » Mon Jun 26, 2006 1:05 pm

Hi rh12,

It works fine for me using this code:

Code: Select all

    private void Form1_Load(object sender, EventArgs e)
    {
      Axis lAxis = new Axis(false, false, tChart1.Chart);
      lAxis.SetMinMax(0, 50);
      lAxis.Automatic = false;
      tChart1.Chart.Axes.Custom.Add(lAxis);

      Axis rAxis = new Axis(false, true, tChart1.Chart);
      rAxis.SetMinMax(0, 200);
      rAxis.Automatic = false;
      tChart1.Chart.Axes.Custom.Add(rAxis);

      for (int i = 1; i <= 2; i++)
      {
        Line seriesLine = new Line();
        seriesLine.FillSampleValues();

        if (i == 1)
        {
          seriesLine.CustomVertAxis = lAxis;
        }
        else
        {
          seriesLine.CustomVertAxis = rAxis;
        }
        tChart1.Series.Add(seriesLine);
      }
 
    }
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

Post Reply