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.
Automatic axis issue
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Ben,
You have 2 options here:
1. Use axes SetMinMax method, for example:
or:
2. Use axes offset properties, for example:
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);
Code: Select all
tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum - 10, tChart1.Axes.Bottom.Maximum + 10);
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 38
- Joined: Thu Feb 01, 2007 12:00 am
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?
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?
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:
thanks,
Ben.
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);
}
Ben.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
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.
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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |