Incorrect bottom axis range for Error series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
AuerAhellwig
Newbie
Newbie
Posts: 5
Joined: Wed Mar 25, 2015 12:00 am

Incorrect bottom axis range for Error series

Post by AuerAhellwig » Fri May 08, 2015 9:44 am

I'm trying to add an Error series to a chart.
Here's a simple example:

Code: Select all

tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Minimum = 0.0;
tChart1.Axes.Bottom.Maximum = 10.0;
var error1 = new Steema.TeeChart.Styles.Error(tChart1.Chart);
error1.SideMargins = false;
error1.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.LeftRight;
error1.Add(1.0, 5.0, 0.5);
tChart1.Series.Add(error1);
However, the range of the bottom axis is changed from the specified values (0 ... 10 in this example) to some arbitrary values (-12.5 ... 22.5 in this case).
I need to use a fixed axis minimum/maximum in my application.
How can I get a correct behaviour of the bottom axis?

I'm using TeeChart v4.1.2015.3113

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

Re: Incorrect bottom axis range for Error series

Post by Christopher » Mon May 11, 2015 8:41 am

Hello,

The situation can be ameliorated by using manual values for the axis minimum and maximum values, e.g.

Code: Select all

		private void InitializeChart()
		{
			tChart1.Axes.Bottom.Automatic = false;
			tChart1.Axes.Bottom.Minimum = 0.0;
			tChart1.Axes.Bottom.Maximum = 10.0;
			var error1 = new Steema.TeeChart.Styles.Error(tChart1.Chart);
			error1.SideMargins = false;
			error1.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.LeftRight;
			error1.Add(1.0, 5.0, 0.5);
			tChart1.Series.Add(error1);

			tChart1.Axes.Bottom.SetMinMax(error1.ErrorValues[0] * -1, error1.ErrorValues[0]);
		}
Unfortunately, as highlighted in this thread, there is a limitation in the Error series for bottom axis precision because the series itself modified minimum and maximum values in order to be able to draw itself, however, steps can be taken to redress this, e.g.

Code: Select all

		private void InitializeChart()
		{
			var error1 = new Error(tChart1.Chart);
			error1.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.LeftRight;
			error1.Add(1.0, 5.0, 0.5);
                        tChart1.Series.Add(error1);

			error1.CustomBarWidth = 200;

			tChart1.Axes.Bottom.MaximumOffset = -(error1.CustomBarWidth / 10);
			tChart1.Axes.Bottom.MinimumOffset = -(error1.CustomBarWidth / 10);
			tChart1.Axes.Bottom.SetMinMax(0, 10);
		}
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

AuerAhellwig
Newbie
Newbie
Posts: 5
Joined: Wed Mar 25, 2015 12:00 am

Re: Incorrect bottom axis range for Error series

Post by AuerAhellwig » Tue May 12, 2015 2:28 pm

Hello,
just setting CustomBarWidth indeed seems to do the trick, thanks.

Post Reply