how to add data to the end of the rttrend?

As rttrendchangedata() and rttrendchanetrenddata() are both to replace the samples in the trends,is there any function that can add data to the end of the trend so that the trend change can be showed contiuously?3X!

use Rt_ARG_TREND_DATA to add data,
an example …

[code]#include <Pt.h>
#include <math.h>

#define START_X .0
#define WIDTH 628
#define SAMPLES 628
#define TRENDS 2
#define HEIGHT 200
#define STEP (2. / HEIGHT)
#define TIMER_PERIOD 40 // milliseconds
#define STEP_SAMPLES 4 // number of samples added when timer expires

struct trenddata_t
{
PtWidget_t *trend_wgt;
short *trend_data;
int trend_count;
int samples;

int step_samples;
int current_pos;
double current_x;

};

void generate_trend_data (int n, double x, short *data, int samples)
{
int i;

if (n == 0)
{
	for (i = 0; i < samples; i++, x += STEP)
		data[i] = sin (x) / STEP;
}
else if (n == 1)
{
	for (i = 0; i < samples; i++, x += STEP)
		data[i] = sin (4 * x) / STEP / 4;
}
else
{
	// undefined
}

}

int timer_cb (PtWidget_t *wgt, void *data, PtCallbackInfo_t *cbinfo)
{
int i;
struct trenddata_t *trend;
PtArg_t arg;

trend = data;

for (i = 0; i < trend->trend_count; i++)
{
	generate_trend_data(i, trend->current_x, trend->trend_data + (trend->step_samples * i), trend->step_samples);
}

PtSetArg(&arg, Rt_ARG_TREND_DATA, trend->trend_data, trend->trend_count * trend->step_samples);
PtSetResources(trend->trend_wgt, 1, &arg);
	
trend->current_pos += trend->step_samples;
trend->current_x += (trend->step_samples * STEP);

return 0;

}

int main ()
{
int i;
double x, y;
PtWidget_t *window, *trend, *timer;
PtArg_t arg[10];
PhDim_t dim;
short trend_min, trend_max, trend_count;
unsigned timer_initial, timer_repeat;
PtCallback_t callback;
struct trenddata_t trenddata;

if (PtInit(NULL) == -1)
	return -1;

dim.w = WIDTH;
dim.h = HEIGHT;
PtSetArg(&arg[0], Pt_ARG_DIM, &dim, 0);

if ((window = PtCreateWidget(PtWindow, NULL, 1, &arg[0])) == NULL)
	return -1;

trend_min = -(HEIGHT / 2);
PtSetArg(&arg[1], Rt_ARG_TREND_MIN, trend_min, 0);
trend_max = HEIGHT / 2;
PtSetArg(&arg[2], Rt_ARG_TREND_MAX, trend_max, 0);
trend_count = TRENDS;
PtSetArg(&arg[3], Rt_ARG_TREND_COUNT, trend_count, 0);

if ((trend = PtCreateWidget(RtTrend, window, 4, &arg[0])) == NULL)
	return -1;

trenddata.trend_wgt = trend;
trenddata.trend_data = malloc(STEP_SAMPLES * TRENDS * sizeof(short));;
trenddata.trend_count = TRENDS;
trenddata.samples = SAMPLES;
trenddata.step_samples = STEP_SAMPLES;
trenddata.current_pos = 0;
trenddata.current_x = .0;

timer_initial = TIMER_PERIOD;
PtSetArg(&arg[0], Pt_ARG_TIMER_INITIAL, timer_initial, 0);
timer_repeat = TIMER_PERIOD;
PtSetArg(&arg[1], Pt_ARG_TIMER_REPEAT, timer_repeat, 0);
callback.event_f = timer_cb;
callback.data = &trenddata;
PtSetArg(&arg[2], Pt_CB_TIMER_ACTIVATE, &callback, 1);

if ((timer = PtCreateWidget(PtTimer, window, 3, &arg[0])) == NULL)
	return -1;

PtRealizeWidget(window);
PtMainLoop();

return 0;

}[/code]

Thanks!Got it!