Page 1 of 1

Incorrect bottom axis range for Error series

Posted: Fri May 08, 2015 9:44 am
by 15673386
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

Re: Incorrect bottom axis range for Error series

Posted: Mon May 11, 2015 8:41 am
by Christopher
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);
		}

Re: Incorrect bottom axis range for Error series

Posted: Tue May 12, 2015 2:28 pm
by 15673386
Hello,
just setting CustomBarWidth indeed seems to do the trick, thanks.