Page 1 of 1

Can several series be concatenated to form a series?

Posted: Thu Mar 24, 2005 1:38 pm
by 8122852
Or, can a series be drawn by several Add() action?

Hi,
I am writing a realtime data processig application with TeeChart series graphs. In my application, the typical horizontal axis range is 10 sec, while the data for the series are supplied from the data acquisition system every second. That necessitates the piecewise drawing of the series.
One series for 10sec time period could be completed by succession of 10 times of 1sec data drawing.

Alas! I do not know how to acomplish this kind of successive drawing.
What I tried to do is like this:

Code: Select all

static int callCount=0;
void handlerOf_Event(object sender, System.EventArgs e)
{
	int N=10;
	double[] x=new double[N];
	double[] y=new double[N];
	for(int i=0;i<N;i++)
	{
		x[i]=(double)( i + N*callCount );
		y[i]=Math.Sin(x[i]*0.1)*10;
	}
	this.tChart1.Series[0].Add(x,y);

	callCount++;
	if(callCount>=10)
	{
		callCount=0;
		this.tChart1.Series[0].Delete(0,this.tChart1.Series[0].Count);
		this.tChart1.Refresh();
	}

}

The above code results in the drawing of only one 1-sec-piece of the series on every call of the event handler.

So, how should I do to get the sereis drawing like this?
On the 1st call: 0-1sec piece drawn.
On the 2nd call: 0-1sec piece + 1-2sec piece drawn.
On the 3rd call: 0-1sec piece + 1-2sec piece + 2-3sec piece
etc.

Posted: Tue Mar 29, 2005 9:30 am
by narcis
Hi HotSteemar,

Which type of series are you using? Maybe having a look at this technical article about real time charting helps you with this issue. The article uses Delphi but you shouldn't have much problems porting it to .NET.