Assigning series objects

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Assigning series objects

Post by UserLS » Tue Nov 10, 2009 12:10 am

This is another one, which used to work in earlier builds of version 3.

I have my TeeChart (MasterChart) object with some series. I also have another TeeChart (TempChart) object in memory with just one series. I have a line of code like:

Code: Select all

    MasterChart[seriesIndex].Assign(TempChart[0]);

With latest builds, after I run this code, first, not all the properties are assigned (I assign Line series with Pointer.Visible = true to another Line series and Pointer.Visible stays false). Second, if I write the following code:

Code: Select all

    MasterChart[seriesIndex].Marks.Visible = true;
or just try to set MasterChart[seriesIndex].Color by using your editor - at best nothing happens (but usually I am getting "Object reference not set to an instance of an object" error).

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

Re: Assigning series objects

Post by Narcís » Fri Nov 13, 2009 9:23 am

Hi UserLS,

Your issues are being reviewed. We will postback to this thread when more information is available.
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

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

Re: Assigning series objects

Post by Narcís » Tue Dec 01, 2009 9:01 am

Hi UserLS,

We have fixed this issue (TF02014555) for next v3 and 2009 releases. Please notice that you should use Clone instead of Assign, for example:

Code: Select all

			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.Pointer.Visible = true;
			line1.FillSampleValues();

			Steema.TeeChart.Styles.Line line2 = line1.Clone() as Steema.TeeChart.Styles.Line;
			line2.FillSampleValues();

			tChart1.Series.Remove(line2);
			tChart2.Series.Add(line2);
We could also reproduce the Marks.Visible error (TF02014577), which has also been fixed.

Regarding the color issue, it works fine for me here.
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Re: Assigning series objects

Post by UserLS » Tue Dec 01, 2009 4:13 pm

The problem I had: I already had my series added to different charts and Clone() did not like it, when I tried to add it to a different chart... Anyway, I have written my own Assign() method, which actually works and assigns all the properties (not just a subset) and makes sure that all of them make sense for the target series type (since I can assign a bar series to a pie, for example).

Post Reply