1

I have X / Y coordinates stored in a file:

1A  0,2770  0,2570
1B  0,2870  0,2730
1C  0,2950  0,2680
1D  0,2850  0,2520
2A  0,2870  0,2730
2B  0,2970  0,2890
2C  0,3050  0,2840
2D  0,2950  0,2680
...

The coordinates are read out and stored in an array:

type
  TXYPoint = record
    name: string;
    X: double;
    Y: double;
  end;

var
    XYPointList: array of TXYPoint;

I try to display the rectangles in the TeeChart Standard 4.04 with Delphi 7 from these coordinates, in order to be able to tell whether a measuring point lies in this range.

How can I draw multiple rectangles using the given coordinates in the chart? The help from: How To Draw Polygon/Rectangle In TChart doesn't work or I do anything wrong.

Thanks in advance.

Meanwhile I have the following:

function GetChartSeries(von, bis : integer): TLineSeries;
var
    i: integer;
begin
    result:= TLineSeries.Create(nil);
  for i:= von to bis do
  begin
    result.AddXY(XYPointList[i].X,XYPointList[i].Y);
  end;
end;

and

 l:= Length(XYPointList);
  SetLength(s1,l);

  for i:= 0 to l- 2 do
  begin
    s1[i]:= TLineSeries. Create (nil);
    s1[i].ParentChart:= Chart1;
    s1[i].Assign(GetChartSeries(i,i+1));

  end;

But the picture isn't good...enter image description here

Community
  • 1
  • 1
genakust
  • 89
  • 9

1 Answers1

0
var 
   s1: array of TLineSeries;
begin
  l:= Length(XYPointList);
  SetLength(s1,l);
  z:= 0;
  for i:= 0 to l-2 do
  begin

    s1[i]:= TLineSeries. Create (nil);
    s1[i].ParentChart:= Chart1;
    if z < 3 then
    begin
        s1[i].Assign(GetChartSeries(i,i+1));
      inc(z);
    end else
    begin
      s1[i].Assign(GetChartSeries(i-2,i+1-2));
      z:=0;
    end;

  end;

The function GetChartSeries Is described above in the question.

genakust
  • 89
  • 9