The data are : x, y1, y2, y3, ...
The purpose is to draw a graph on them (y1(x), y2(x), ...). So I have written a code for this:
DeletePlot(); CreatePlot(x, y1, n, 1, clRed); CreatePlot(x, y2, n, 2, clGreen); CreatePlot(x, y3, n, 3, clBlue); ...
void TForm2::CreatePlot(double * x, double * y, int n, int series, TColor cl)
{
if (x != NULL && y != NULL){
for (int i = 0 ; i < n; i++){
if (series == 1) Series1->AddXY(x[i], y[i], "", cl);
if (series == 2) Series2->AddXY(x[i], y[i], "", cl);
if (series == 3) Series3->AddXY(x[i], y[i], "", cl);
// and so on ...
}
}
}
void TForm2::DeletePlot()
{
Series1->Clear();
Series2->Clear();
Series3->Clear();
}
The problem is that the code above results in not desired graph. In the attached jpg' first graph is correct (I've done it with TImage) and the second is the result from code above. Do anybody happen to know why do these points mixe up?


Sign In
Create Account



Back to top









