Page 1 of 1

Clearing data in a series, including Null indexes

Posted: Thu Jun 07, 2007 7:51 pm
by 9794096
I have a chart with a series added to it.
One of the indexes in this series is set to Null using the Series.SetNull(index) call.

I then wish to clear the series of all data and re-populate my series.
I do NOT wish to clear my color settings for this series or other line properties.
I call the Series.XValues.Clear() and Series.YValues.Clear() methods.

When I re-populate my series with data, I am NOT calling the .SetNull() method on any of the indexes in the series and yet I am still seeing holes in the graph at the location of the index that was originally set to be a Null point.

Does the Clear() method on XValues and YValues not clear the null settings for the indexes in those series?

How can I clear the list of indexes that are treated as Nulls?

What I am trying to avoid is destroying the Series completely and having to rebuild that Series from the ground up. I wish to keep the properties that have been assigned to this series but simply clear out all of the data.

We have not yet upgraded to v3 of the .NET controls so we are still on TeeChart v2 for .NET.

Thanks for your help once again.

Aaron

Posted: Fri Jun 08, 2007 7:55 am
by narcis
Hi Aaron,

This is because what SetNull(ValueIndex) method does is setting the point color to transparent, for example:

Code: Select all

			line1.SetNull(ValueIndex);
is equivalent to:

Code: Select all

			line1.Colors[ValueIndex]=Color.Transparent;
So when you are clearing your series data, if you want to reset null points you should assign a color to them, for example:

Code: Select all

			for (int i = 0; i < line1.Count; i++)
			{
				if (line1.Colors[i] == Color.Transparent)
					line1.Colors[i] = line1.Color;				
			}

Posted: Fri Jun 08, 2007 1:00 pm
by 9794096
Thanks for the quick response.

That actually answers another question that I was going to ask this morning.
I was going to check to see how I could undo the null settings on points within my data series without affecting the actual data.
That shows me how to do both.

So what else besides the data and the Color settings for that data will the Series.Clear() method reset? I did not use that initially because the description of it talks about removing the data, the text and Color for the series. I wasn't sure which Color that meant but now I understand a little better.

Thanks again.

Posted: Fri Jun 08, 2007 1:18 pm
by narcis
Hi Aaron,

Clear method will basically clear x values, y values, labels, color and marks of a series.