Is there a problem using coloreach property?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
cw
Newbie
Newbie
Posts: 1
Joined: Wed Feb 23, 2005 5:00 am

Is there a problem using coloreach property?

Post by cw » Tue Apr 18, 2006 7:01 pm

I have a chart with several series on it. I use the coloreach property to specify a color for each point on a few of these series to highlight the data. Occasionally, the lines with the coloreach property set seem to go bad (random colors and spikey data). Then all of a sudden it starts working again like nothing happened. The lines without the coloreach property set are not affected. I was curious if this is a known problem and if there is a fix for it.

Thanks.

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

Post by Narcís » Wed Apr 19, 2006 8:52 am

Hi cw,

Can you please send us an example we can run "as-is" or the steps we should follow to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.
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

cw
Newbie
Newbie
Posts: 2
Joined: Wed Feb 23, 2005 5:00 am

Post by cw » Wed Apr 19, 2006 1:25 pm

Here is a snippet of code showing how I add the data and color to the series. This works for very long periods of time with now problems, but will occasionally go strange for a little while and then start working again.

There is scrolling code at the bottom of this logic. This is real time data display and I only keep around a fixed amount of data in the series. I was worried about eating up memory if this was left running for long periods of time. I also have an up/down control where the user can select how many of seconds to display on the plot. That is the series may contain a minute of data, but the user may zoom in and only display 20 seconds across the bottom axis.

This code is called each time new samples are received.

Code: Select all

for (i = 0; i < mNumSamples; i++)
{
  DataChart.Series[0].Add(SampleNum, mSamplesData1[i], 
                                       DataChart.Series[0].Color);
  DataChart.Series[1].Add(SampleNum++, 
	                        mSamplesData2[i],
                                        DataChart.Series[1].Color);
}
if ((mFlags & 1) != 0)
{
   DataChart.Series[0].Color = Color.Red;
}
else
{
   DataChart.Series[0].Color = Color.Blue;
}
if ((mFlags & 2) != 0)
{
   DataChart.Series[1].Color = Color.Red;
}
else
{
   DataChart.Series[1].Color = Color.Green;
}

// now scroll the data by removing old data
int SamplesOnChart = (int)numUDChartSeconds.Value * 10;
int MaxSamplesOnChart = (int)numUDChartSeconds.Maximum * 10;
DataChart.Axes.Bottom.SetMinMax(mSampleNumber - SamplesOnChart, 
					mSampleNumber);
while (DataChart.Series[0].XValues[0] < 
                                            (mSampleNumber - MaxSamplesOnChart))
{
   DataChart.Series[0].Delete(0);
}
while (DataChart.Series[1].XValues[0] < 
	                   (mSampleNumber - MaxSamplesOnChart))
{
   DataChart.Series[1].Delete(0);
}

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

Post by Narcís » Thu Apr 20, 2006 10:34 am

Hi cw,

Thanks for the code but it is very difficult to see which the problem is without being able to reproduce the problem here. Could you please arrange an example we can run "as-is" to reproduce the problem here?

Thanks in advance.
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