我正在阅读“TeeChart VCL中的实时图表:添加大量点的另一种方法是使用直接动态数组”,并想询问如何跳过X轴缓冲区(节省浪费的内存空间) ),虽然它简单包含一个简单的红衣主教1 .... n = Num点序列。虽然Num将在> 1 mio地区。
答案 0 :(得分:1)
我认为避免使用XValues数组的最简单方法是使用TCustomTeeFunction,如下例所示:
var Series1: TFastLineSeries;
CustFunci: TCustomTeeFunction;
MyValues: array of double;
procedure TForm1.FormCreate(Sender: TObject);
var i, nValues: Integer;
begin
//data
nValues:=10000;
SetLength(MyValues, nValues);
MyValues[0]:=Random(10000);
for i:=Low(MyValues)+1 to High(MyValues) do
MyValues[i]:=MyValues[i-1]+Random(10)-4.5;
//chart
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Series1:=Chart1.AddSeries(TFastLineSeries) as TFastLineSeries;
CustFunci:=TCustomTeeFunction.Create(Self);
Series1.FunctionType:=CustFunci;
CustFunci.NumPoints:=nValues;
CustFunci.OnCalculate:=CustFunciCalculate;
CustFunci.ReCalculate;
end;
procedure TForm1.CustFunciCalculate(Sender:TCustomTeeFunction; const x:Double; var y:Double);
begin
y:=MyValues[Round(x)];
end;