搜索
bottom↓
回复: 6

初学delphi 求高手解释下这段代码! Tchart 和 Timer的 谢谢

[复制链接]

出0入0汤圆

发表于 2010-2-14 23:11:24 | 显示全部楼层 |阅读模式
Procedure TMainForm.TimerTimer(Sender: TObject);
Begin
  Chart1.Series[0].AddXY(I, TemperData, TimeToStr(Time));
  If I < 60 Then
    XStr[I] := TimeToStr(Time)
  Else
  Begin
    XStr[I Mod 60] := TimeToStr(Time);
    Inc(Y);
    Chart1.BottomAxis.SetMinMax(Y, Y + 59);
  End;
  Inc(I);
End;

=====================================
转自
我也贴个我第一次做的DS18B20温度计,含DELPHI上位机曲线图和PCB  http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=3877366&bbs_page_no=1&search
这是  SkyGz   发布的程序的一段  求高手 解释下  看不懂  谢谢  

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

 楼主| 发表于 2010-2-14 23:59:00 | 显示全部楼层
查到  AddXY的定义是这样子的。应该有4个参数   ,但是上面的程序只有3个参数,?难道那个可以省略吗??

{ Adds a new point into the Series. }
Function TChartSeries.AddXY( Const AXValue,AYValue:Double;
                             Const ALabel:String; AColor:TColor):Integer;
var t : Integer;
Begin
  FX.TempValue:=AXValue;
  FY.TempValue:=AYValue;

  if (not Assigned(FOnBeforeAdd)) or FOnBeforeAdd(Self) then
  Begin
    result:=FX.AddChartValue; // (FX.TempValue);   // 7.0
    FY.InsertChartValue(result,FY.TempValue);

    for t:=2 to ValuesList.Count-1 do
        With ValuesList[t] do InsertChartValue(result,TempValue);

    if Assigned(FColors) then
       FColors.Insert(result,{$IFDEF CLR}TObject{$ELSE}Pointer{$ENDIF}(AColor))
    else
    if AColor<>clTeeColor then
    begin
      GrowColors;
      FColors.Insert(result,{$IFDEF CLR}TObject{$ELSE}Pointer{$ENDIF}(AColor));
    end;

    if (ALabel<>'') or (FLabels.Count>0) then { speed opt. 5.02 }
       Labels.InsertLabel(result,ALabel);

    if IUpdating=0 then { 5.02 }
       NotifyNewValue(Self,result);
  end
  else result:=-1;
end;

出0入0汤圆

发表于 2010-2-15 00:16:38 | 显示全部楼层
TChartSeries.AddXY
TChartSeries
function AddXY(Const AXValue, AYValue: Double; Const ALabel: String; AColor: TColor): Integer; virtual;

Unit
TeEngine

Description
This function inserts a new point in the Series.
The new point has X and Y values.

The ALabel parameter is optional (can be empty '').
The AColor parameter is optional (can be clTeeColor).
The function returns the new point position in the Values list.

Series1.AddXY( 123, 456, 'Hello', clGreen );

出0入0汤圆

 楼主| 发表于 2010-2-15 10:27:28 | 显示全部楼层
回复【2楼】haeha
-----------------------------------------------------------------------

谢谢


还有个问题   这段代码 放在   Procedure TMainForm.TimerTimer(Sender: TObject);

这个函数里面是什么意思啊??谢谢

出0入0汤圆

 楼主| 发表于 2010-2-15 20:31:01 | 显示全部楼层

(原文件名:11.jpg)


(原文件名:22.jpg)
知道了
          函数Procedure TMainForm.TimerTimer(Sender: TObject);  是Timer  定时时间 1s到的时候的执行函数

出0入0汤圆

发表于 2010-2-18 14:48:33 | 显示全部楼层
Procedure TMainForm.TimerTimer(Sender: TObject);  
这个是定时器的中断函数

出0入0汤圆

发表于 2010-3-17 21:43:44 | 显示全部楼层
delephi怎么调用VB谢谢程序
对VB的文本框  text   combo   command
进行调用,谢谢各位啊
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-20 23:17

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表