本文介绍了在Delphi 7中优化TCHart绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我的有一些很好的建议,但是它对我不起作用,因为我的问题似乎与Delphi 7有关。

My previous question had some great input, but it didn't work for me because my problem seems to be Delphi 7 related.

我有一个带有单个序列(TFastLineSeries)和3,600个数据点的图表要45秒才能绘制。其他人则说它应该快如闪电,所以谁能提供帮助,请牢记我正在使用Delphi 7和标准的TChart组件。

I have a chart with a single series (TFastLineSeries) and 3,600 datapoints which is taking up to 45 seconds to draw. Others have said that it should be lightning fast, so who can help, bearing in mind that I am using Delphi 7 and the standard TChart component.

我怀疑不是调用AddXY()3,600次我应该先准备数据,然后一次添加所有数据。

I suspect that instead of calling AddXY() 3,600 times I should be preparing the data first, then adding it all at once.

更新:在D7中,AddXy()函数签名为 function AddXY(Const AXValue,AYValue :Double; Const AXLabel:String; AColor:TColor):Longint;其中 timeLabel 是代表MM:SS的字符串。但是对于

Update: in D7 the AddXy() function signature is function AddXY(Const AXValue, AYValue: Double; Const AXLabel: String; AColor: TColor) : Longint; wheretimeLabelis a string representing MM:SS. But what value should I be passing for

我应该传递什么值,我用`Chart1.Series [0] .AddXY( Chart1.Series [0] .Count,codValue,timeLabel,clRed

and I cam calling it with `Chart1.Series[0].AddXY(Chart1.Series[0].Count, codValue, timeLabel, clRed

btw,我已经编码了Chart1.Series [0 ] .XValues.DateTime:= True;
Chart1.BottomAxis.DateTimeFormat:='nn:ss'; //'hh'或'nn'或'ss',如您所愿,例如Chart1.BottomAxis.DateTimeFormat: = dd / mm / yyyy hh:mm;

btw, I have coded Chart1.Series[0].XValues.DateTime := True; Chart1.BottomAxis.DateTimeFormat := 'nn:ss'; //'hh' or 'nn' or 'ss' as you wish, e.g. Chart1.BottomAxis.DateTimeFormat:="dd/mm/yyyy hh:mm";

推荐答案

也许是生成值以放入图表的方式是瓶颈吗?

Maybe the way you are generating the values to put in the chart is the bottleneck?

在Delphi 2010上,我测量以下代码花费的时间少于1/10秒:

On Delphi 2010, I measured the following code to take less than 1/10 second:

var
  I: Integer;
begin
  for I := 0 to 3000 - 1 do
    Series1.AddXY(Random(1000), Random(100));

这篇关于在Delphi 7中优化TCHart绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 15:12