Hi there again,
I have an array with two fields x,y which I call it tpnt.
type
tpnt = record
x : TFloat;
y: TFloat;
end;
and as I put some values in it is not sorted. The thing is that I must sort it to the x field.
the code I use is simple and after that I draw it as well
n := High(PositionArray);
repeat
newn := 0;
for i := 1 to n do
begin
if PositionArray[i-1].x > PositionArray[i].x then
begin
tempx := PositionArray[i-1].x;
tempy := PositionArray[i-1].y;
PositionArray[i-1].x := PositionArray[i].x;
PositionArray[i-1].y := PositionArray[i].y;
PositionArray[i].x:= tempx;
PositionArray[i].y:= tempy;
newn := i;
end;
end ;
n := newn;
until n = 0;
for i := Low(PositionArray) to High(PositionArray) do
begin
xaxis := PositionArray[i].x;
yaxis := PositionArray[i].y;
newlineXTHsorted.AddXY(xaxis, yaxis);
end;
Is there something in order not to sort the array myself and leave this sorting for the lineseries?
I mean if this can hapen with the tachart itself.