Page 1 of 1

Assigning series objects

Posted: Tue Nov 10, 2009 12:10 am
by 14045174
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).

Re: Assigning series objects

Posted: Fri Nov 13, 2009 9:23 am
by narcis
Hi UserLS,

Your issues are being reviewed. We will postback to this thread when more information is available.

Re: Assigning series objects

Posted: Tue Dec 01, 2009 9:01 am
by narcis
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.

Re: Assigning series objects

Posted: Tue Dec 01, 2009 4:13 pm
by 14045174
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).