Extra value margin added to scale(s)
-
- Newbie
- Posts: 30
- Joined: Tue Sep 13, 2011 12:00 am
Extra value margin added to scale(s)
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?
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 (363.5 KiB) Viewed 7209 times
Re: Extra value margin added to scale(s)
Hello BeijerElectronics,
I have made a simple code that works fine for me. Can you tell if next code works as you expected?
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:
I hope will helps.
Thanks,
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;
}
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;
Thanks,
Best Regards,
Sandra Pazos / 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: 30
- Joined: Tue Sep 13, 2011 12:00 am
Re: Extra value margin added to scale(s)
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.
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.
Re: Extra value margin added to scale(s)
Hello BeijerElectronics,
I couldn't reproduce your problem using last release of TeeChart.Net 2011 and next simple code:
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,
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;
}
Thanks,
Best Regards,
Sandra Pazos / 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: 30
- Joined: Tue Sep 13, 2011 12:00 am
Re: Extra value margin added to scale(s)
Hello,
We use 4.1.2011.10192
We use 4.1.2011.10192
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Extra value margin added to scale(s)
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.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 30
- Joined: Tue Sep 13, 2011 12:00 am
Re: Extra value margin added to scale(s)
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?
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?
Re: Extra value margin added to scale(s)
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,
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 30
- Joined: Tue Sep 13, 2011 12:00 am
Re: Extra value margin added to scale(s)
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?
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;
Re: Extra value margin added to scale(s)
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:
Can you please, tell us if previous code works as you expect?
Thanks,
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;
}
Thanks,
Best Regards,
Sandra Pazos / 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 |