【问题标题】:How to draw multiple rectangles using the given coordinates in the chart如何使用图表中的给定坐标绘制多个矩形
【发布时间】:2016-10-25 10:16:57
【问题描述】:

我将 X / Y 坐标存储在一个文件中:

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
...

坐标被读出并存储在一个数组中:

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

var
    XYPointList: array of TXYPoint;

我尝试使用 Delphi 7 从这些坐标显示 TeeChart Standard 4.04 中的矩形, 为了能够判断一个测量点是否在这个范围内。

如何使用图表中的给定坐标绘制多个矩形? 来自以下方面的帮助: How To Draw Polygon/Rectangle In TChart 不起作用或我做错了什么。

提前致谢。

同时我有以下内容:

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;

 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;

但是画面不好...

【问题讨论】:

    标签: delphi delphi-7 teechart


    【解决方案1】:
    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;
    

    函数GetChartSeries在问题上面有描述。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-18
      • 1970-01-01
      • 1970-01-01
      • 2017-12-16
      • 1970-01-01
      • 2019-08-27
      • 2018-10-24
      • 1970-01-01
      相关资源
      最近更新 更多