Page 1 of 1

Problem with Series.Add method?

Posted: Mon Nov 06, 2006 5:32 pm
by 9642155
I think I have found a problem with the .Add method of Steema.TeeChart.Styles.Series.

The following code throws a runtime error from TeeChart.dll:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitChart();
		}

		private void InitChart()
		{
			tChart1.Aspect.View3D = false;
			tChart1.Legend.Visible = false;
		
			int[] XVals = { 0, 2, 4, 6, 8 };
			int[] YVals = { 0, 1, 4, 9, 16};
			object[] YVals2 = { 0, 1, 4, 9, 16};

			Line line1 = new Line();

			line1.Add(XVals, YVals2);
			
			tChart1.Series.Add(line1);
		}
The error I get is:

"An unhandled exception of type 'System.NullReferenceException' occurred in TeeChart.dll

Additional information: Object reference not set to an instance of an object."

Please note that the code above works just fine when I use int[] instead of object[].

I'm using C# .NET 2005 and TeeChart Pro Version 2.0.2306.26232.

Thanks in advance.

Posted: Mon Nov 06, 2006 5:34 pm
by 9642155
I should also add that I have tried the code with a number of different series types (i.e. Area, Line, FastLine, and LinePoint to name a few), so i believe that the problem lies in the implementation of the base Series class.

Posted: Tue Nov 07, 2006 11:42 am
by narcis
Hi DCG,

This is because there's no Add method overload that allows a parameter being an array of objects. We can't allow this because then any kind of object could be passed to the add method and this would create many more problems. The types of arrays allowed are: DateTime, int, Int16, float, Decimal and double.