Automatic axis issue

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Automatic axis issue

Post by BenW » Tue Apr 10, 2007 2:51 pm

Hello.

When I configure an axis to be automatic, and the maximum and minimum values that comes in are say in the range of 23 to 78, then the axis will be scaled from 23 to 78. What we need is for the scale to be increased a littlebeyond the actual trace values, eg., 10 to 90, so that the upper and lower values of the trace are a little more clear.

Is this is possible using the Steema Teechart?

thanks,
Ben.

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

Post by Narcís » Tue Apr 10, 2007 3:10 pm

Hi Ben,

You have 2 options here:

1. Use axes SetMinMax method, for example:

Code: Select all

			tChart1.Axes.Bottom.SetMinMax(tChart1[0].MinXValue() - 10, tChart1[0].MinXValue() + 10);
or:

Code: Select all

tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum - 10, tChart1.Axes.Bottom.Maximum + 10);
2. Use axes offset properties, for example:

Code: Select all

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

Aaron Peronto
Newbie
Newbie
Posts: 38
Joined: Thu Feb 01, 2007 12:00 am

Post by Aaron Peronto » Tue Apr 10, 2007 3:24 pm

Is it possible at all to set the offset properties as a percentage of the range displayed on the axis itself?
I would prefer not to have to re-calc this every single time we plot something.

The reason I ask is that some of the plots we generate have a Y axis range of 0 to 1200 while others have a range of -0.1 to +0.1.
Obviously, setting an offset of 10 for the axis would not be appropriate in both of these cases but setting it as 10% might be better.

If we have to do the calc of that offset ourselves, where would you suggest doing that so that any time an item is added to a particular axis (left, right or custom or even the bottom [X] axis for that matter) we properly re-calc those offset values?

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Wed Apr 11, 2007 5:02 pm

Hi Narcís,

This all sounds very logical, but when I tried using the option that sets the MinimumOffset and MaximumOffset properties for my custom Y-axis (this option is the best fit for my use case), it doesn't have any effect. Note, I only enforce this when autoscaling (i.e. the automatic property) is set for the Y-axis (left).

Is there something else I might be doing to my Y-axis that may be disabling the use of the MinimumOffset and MaximumOffset properties?

this is how I'm creating my axis:

Code: Select all

       this.dnaAxis = new Steema.TeeChart.Axis(false, false, tChart.Chart);
       if (dnaAxis != null)
       {
            tChart.Axes.Custom.Add(this.dnaAxis);
       }
thanks,
Ben.

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

Post by Narcís » Thu Apr 12, 2007 7:41 am

Hi Ben,

Not that I can think of. Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Apr 13, 2007 3:16 am

Hey Narcís,

The issue was a coding error (race condition) on my part. It seems to be working now...

Regards,
Ben.

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Apr 13, 2007 4:12 pm

Hi Narcís,

Is it possible to essentially configure an automatic y-axis, such that the MaximumOffset/MinimumOffset values (or some other Axis property) are set to force the axis to draw one extra labelled tick at the top and bottom.

Perhaps there is some calculation that can be done from which the MaximumOffset/MinimumOffset values can be generated to facilitate this requirement.

Right now I'm calculating the MaximumOffset/MinimumOffset values as 3% of the tchart.Chart.Height property, which of course is not terribly accurate and doesn't always result in having the desired extra labelled tick drawn at the top and bottom of the automatic y-axis.

Regards,
Ben.

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 Apr 16, 2007 7:34 am

Hi Ben,

No, I can't think of any way to do this automatically. However, to improve what you are doing you'd better use ChartRect's height or axis's size as shown in the code below. Those properties have the exact value you are looking for and are different from chart's height.

Code: Select all

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			label1.Text = tChart1.Chart.Height.ToString();

			Rectangle Rect = tChart1.Chart.ChartRect;
			label2.Text = Rect.Height.ToString();

			int Height = tChart1.Chart.Axes.Left.IAxisSize;
			label3.Text = Height.ToString();
		}
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