Problem with Series.Add method?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Problem with Series.Add method?

Post by DCG » Mon Nov 06, 2006 5:32 pm

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.

DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Post by DCG » Mon Nov 06, 2006 5:34 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 07, 2006 11:42 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply