我的
TChart
加了很多分
series.AddXY
方法。每秒钟添加一个点(但如果没有数据,也可能会有很长的周期)。更改图表后(添加点),当我使用图表转到选项卡时,大约需要5秒钟才能重新绘制。
我认为使用聚合函数有助于更快地绘制图表:
ser1: TFastLineSeries;
ser2: TPointSeries;
ser3: TFastLineSeries;
utc: TDateTime;
ser1.SetFunction(TAverageTeeFunction.Create(Self));
ser1.FunctionType.Period := 100;
ser1.FunctionType.PeriodStyle := psRange;
ser2.SetFunction(TAverageTeeFunction.Create(Self));
ser2.FunctionType.Period := 100;
ser2.FunctionType.PeriodStyle := psRange;
ser3.SetFunction(TAverageTeeFunction.Create(Self));
ser3.FunctionType.Period := 100;
ser3.FunctionType.PeriodStyle := psRange;
for i := 0 to 30000 do begin
.....
ser1.AddXY(utc, 0, utcStr);
ser2.AddXY(utc, deviation, utcStr);
ser3.AddXY(utc, trend, utcStr);
.....
end;
但它仍然很慢。
如何更快地绘制图表?
更新
这是3小时数据的不可缩放图表。”现在“在右边”,左边是-3h。积分不断地到达右边,从左边删除。通过设置移动视图框架
chart.BottomAxis.Minimum
和
chart.BottomAxis.Maximum
属性。我会满足于平均值的绘制,其中平均值是图表上水平像素的数量。