⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 istripchart.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    procedure iKeyDown       (var CharCode: Word; Shift: TShiftState);             override;

    procedure iMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure iMouseUp  (Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure iMouseMove(                      Shift: TShiftState; X, Y: Integer); override;

    procedure CalcPoints;
    procedure CalcCursorIndex(X : Integer);
    procedure CalcNewStartXIndex;
    procedure CalcNewStopXIndex;
    function  CalcIndex(TargetValue : Double) : Integer;

    procedure iPaintTo          (Canvas: TCanvas); override;
    procedure DrawXTicks        (Canvas: TCanvas);
    procedure DrawYTicks        (Canvas: TCanvas);
    procedure DrawLegend        (Canvas: TCanvas);
    procedure DrawTitle         (Canvas: TCanvas);
    procedure DrawXAxisLabels   (Canvas: TCanvas);
    procedure DrawModeLabels    (Canvas: TCanvas);
    procedure DrawData          (Canvas: TCanvas);
    procedure DrawLabels        (Canvas: TCanvas);
    procedure DrawClip          (Canvas: TCanvas);
    procedure DrawLimits        (Canvas: TCanvas);
    procedure DrawVertLines     (Canvas: TCanvas);
    procedure DrawAxisLines     (Canvas: TCanvas);
    procedure DrawGrid          (Canvas: TCanvas);
    procedure DrawGridBackGround(Canvas: TCanvas);
    procedure DrawConnectPoints (Canvas: TCanvas);

    function GetChannel     (Index : Integer): TiStripChartChannelObject;
    function GetLabelChannel(Index: Integer) : TiLabelChannelObject;
    function GetActualTimeIndex(Value : Integer) : Integer;

    function GetXPixels(Value: Double): Integer;
    function GetYPixels(Value: Double): Integer;
    function GetChannelYPixels(Value: Double; FixedAxis: Boolean): Integer;

    procedure ScrollCursorInView;

    function  GetXAxisDecimalPoints: Integer;
    function  GetYAxisDecimalPoints: Integer;

    function  GetToolBarButtonIndex(X, Y: Integer): Integer;

    function  ChannelColorInUse(Value: TColor): Boolean;

    procedure DefineProperties(Filer: TFiler); override;
    function  DoWriteChannels : Boolean;
    procedure WriteChannels   (Writer: TWriter);
    procedure ReadChannels    (Reader: TReader);
    procedure WriteXAxisMax   (Writer: TWriter);
    procedure ReadXAxisMax    (Reader: TReader);
    procedure WriteYAxisMax   (Writer: TWriter);
    procedure ReadYAxisMax    (Reader: TReader);

    procedure DoAutoScroll(Time : Double);

    procedure DoModeChange;
    procedure DoDataUpdate;
    procedure DoCursorChange;
  public
    constructor Create(AOwner: TComponent);  override;
    destructor  Destroy;                     override;

    procedure   AddChannel(Title: String; AColor: TColor; LineStyle: TiChannelLineStyle; LineWidth: Integer);
    procedure   RemoveChannel(Index : Integer);
    procedure   RemoveAllChannels;
    property    ChannelCount                          : Integer            read GetChannelCount;

    property    ChannelTitle          [Index : Integer] : String             read GetChannelTitle              write SetChannelTitle;
    property    ChannelColor          [Index : Integer] : TColor             read GetChannelColor              write SetChannelColor;
    property    ChannelLineStyle      [Index : Integer] : TiChannelLineStyle read GetChannelLineStyle          write SetChannelLineStyle;
    property    ChannelLineWidth      [Index : Integer] : Integer            read GetChannelLineWidth          write SetChannelLineWidth;
    property    ChannelVisible        [Index : Integer] : Boolean            read GetChannelVisible            write SetChannelVisible;
    property    ChannelVisibleInLegend[Index : Integer] : Boolean            read GetChannelVisibleInLegend    write SetChannelVisibleInLegend;
    property    ChannelUseFixedAxis   [Index : Integer] : Boolean            read GetChannelUseFixedAxis       write SetChannelUseFixedAxis;
    property    ChannelMin            [Index : Integer] : Double             read GetChannelMin;
    property    ChannelMax            [Index : Integer] : Double             read GetChannelMax;
    property    ChannelMean           [Index : Integer] : Double             read GetChannelMean;
    property    ChannelData  [Channel, Index : Integer] : Double             read GetChannelData               write SetChannelData;

    procedure   AddLabelChannel(YPosition : Double);
    procedure   RemoveLabelChannel(Index : Integer);
    procedure   RemoveAllLabelChannels;
    property    LabelChannelCount                          : Integer       read GetLabelChannelCount;

    property    LabelChannelText[Channel, Index : Integer] : String        read GetLabelChannelText          write SetLabelChannelText;
    property    LabelChannelYPosition    [Index : Integer] : Double        read GetLabelYPosition            write SetLabelYPosition;
    property    LabelChannelFontName     [Index : Integer] : String        read GetLabelChannelFontName      write SetLabelChannelFontName;
    property    LabelChannelFontSize     [Index : Integer] : Integer       read GetLabelChannelFontSize      write SetLabelChannelFontSize;
    property    LabelChannelFontColor    [Index : Integer] : TColor        read GetLabelChannelFontColor     write SetLabelChannelFontColor;
    property    LabelChannelFontBold     [Index : Integer] : Boolean       read GetLabelChannelFontBold      write SetLabelChannelFontBold;
    property    LabelChannelFontItalic   [Index : Integer] : Boolean       read GetLabelChannelFontItalic    write SetLabelChannelFontItalic;
    property    LabelChannelFontUnderLine[Index : Integer] : Boolean       read GetLabelChannelFontUnderLine write SetLabelChannelFontUnderLine;
    property    LabelChannelFontStrikeOut[Index : Integer] : Boolean       read GetLabelChannelFontStrikeOut write SetLabelChannelFontStrikeOut;

    property    CursorIndex                           : Integer            read FCursorIndex                 write SetCursorIndex;

    procedure   EndUpdate; override;
    procedure   ClearData;

    procedure   SetBufferSize    (Value : Integer);
    procedure   SetRingBufferSize(Value : Integer);

    procedure   SetChannelControlLimits(Channel : Integer; ShowUpper : Boolean; UpperValue : Double; UpperLineStyle : TiChannelLineStyle;
                                                           ShowLower : Boolean; LowerValue : Double; LowerLineStyle : TiChannelLineStyle);
    procedure   SetChannelWarningLimits(Channel : Integer; ShowUpper : Boolean; UpperValue : Double; UpperLineStyle : TiChannelLineStyle;
                                                           ShowLower : Boolean; LowerValue : Double; LowerLineStyle : TiChannelLineStyle);

    procedure   SetLimitLinesOnTop(const Value : Boolean);
    procedure   SetGridLinesOnTop (const Value : Boolean);

    property   ElapsedStartTime : TDateTime read FElapsedStartTime write FElapsedStartTime;    

    property   ChannelControlLimitUpperShow     [Index : Integer] : Boolean            read GetChannelControlLimitUpperShow      write SetChannelControlLimitUpperShow;
    property   ChannelControlLimitUpperValue    [Index : Integer] : Double             read GetChannelControlLimitUpperValue     write SetChannelControlLimitUpperValue;
    property   ChannelControlLimitUpperColor    [Index : Integer] : TColor             read GetChannelControlLimitUpperColor     write SetChannelControlLimitUpperColor;
    property   ChannelControlLimitUpperLineStyle[Index : Integer] : TiChannelLineStyle read GetChannelControlLimitUpperLineStyle write SetChannelControlLimitUpperLineStyle;
    property   ChannelControlLimitUpperLineWidth[Index : Integer] : Integer            read GetChannelControlLimitUpperLineWidth write SetChannelControlLimitUpperLineWidth;

    property   ChannelControlLimitLowerShow     [Index : Integer] : Boolean            read GetChannelControlLimitLowerShow      write SetChannelControlLimitLowerShow;
    property   ChannelControlLimitLowerValue    [Index : Integer] : Double             read GetChannelControlLimitLowerValue     write SetChannelControlLimitLowerValue;
    property   ChannelControlLimitLowerColor    [Index : Integer] : TColor             read GetChannelControlLimitLowerColor     write SetChannelControlLimitLowerColor;
    property   ChannelControlLimitLowerLineStyle[Index : Integer] : TiChannelLineStyle read GetChannelControlLimitLowerLineStyle write SetChannelControlLimitLowerLineStyle;
    property   ChannelControlLimitLowerLineWidth[Index : Integer] : Integer            read GetChannelControlLimitLowerLineWidth write SetChannelControlLimitLowerLineWidth;

    property   ChannelWarningLimitUpperShow     [Index : Integer] : Boolean            read GetChannelWarningLimitUpperShow      write SetChannelWarningLimitUpperShow;
    property   ChannelWarningLimitUpperValue    [Index : Integer] : Double             read GetChannelWarningLimitUpperValue     write SetChannelWarningLimitUpperValue;
    property   ChannelWarningLimitUpperColor    [Index : Integer] : TColor             read GetChannelWarningLimitUpperColor     write SetChannelWarningLimitUpperColor;
    property   ChannelWarningLimitUpperLineStyle[Index : Integer] : TiChannelLineStyle read GetChannelWarningLimitUpperLineStyle write SetChannelWarningLimitUpperLineStyle;
    property   ChannelWarningLimitUpperLineWidth[Index : Integer] : Integer            read GetChannelWarningLimitUpperLineWidth write SetChannelWarningLimitUpperLineWidth;

    property   ChannelWarningLimitLowerShow     [Index : Integer] : Boolean            read GetChannelWarningLimitLowerShow      write SetChannelWarningLimitLowerShow;
    property   ChannelWarningLimitLowerValue    [Index : Integer] : Double             read GetChannelWarningLimitLowerValue     write SetChannelWarningLimitLowerValue;
    property   ChannelWarningLimitLowerColor    [Index : Integer] : TColor             read GetChannelWarningLimitLowerColor     write SetChannelWarningLimitLowerColor;
    property   ChannelWarningLimitLowerLineStyle[Index : Integer] : TiChannelLineStyle read GetChannelWarningLimitLowerLineStyle write SetChannelWarningLimitLowerLineStyle;
    property   ChannelWarningLimitLowerLineWidth[Index : Integer] : Integer            read GetChannelWarningLimitLowerLineWidth write SetChannelWarningLimitLowerLineWidth;

    procedure   SetChannelsData(Index: Integer; Data : Variant);
    procedure   AddData(Interval : Double; Data : Variant);
    procedure   SetChannelDataNull  (Channel, Index: Integer);
    function    GetChannelDataIsNull(Channel, Index: Integer; var Data: Double) : Boolean;
    function    GetChannelDataStatus(Channel, Index: Integer) : TiChannelDataSatus;

    procedure   AddVerticalLine(Position: Double; Color: TColor; Width : Integer; Style : TiChannelLineStyle);
    procedure   RemoveAllVerticalLines;

    function    GetNextChannelColor: TColor;
    function    GetNow: Double;

    function    AddIndexTime(Time: Double) : Integer;
    function    AddIndexTimeNow            : Integer;
    function    AddIndexTimeElapsedNow     : Integer;

    property    IndexTime[Index : Integer]: Double   read GetIndexTime;
    property    IndexCount                : Integer  read GetIndexCount;

    property    MinXAxisData              : Double   read FMinXAxisData;
    property    MaxXAxisData              : Double   read FMaxXAxisData;
    property    MinYAxisData              : Double   read FMinYAxisData;
    property    MaxYAxisData              : Double   read FMaxYAxisData;

    property    DisplayStartIndex         : Integer  read FPlotStartIndex;
    property    DisplayStopIndex          : Integer  read FPlotStopIndex;

    //Kylix TODO
    {$ifndef iCLX}
    property    SnapShotPicture           : TPicture read GetSnapShotPicture;
    procedure   CopyToClipBoard;
    {$endif}

    //Kylix TODO
    {$ifndef iCLX}
    procedure   SaveToMetaFile   (FileName: String);
    procedure   SaveToBitmap     (FileName: String);
    {$endif}
    
    procedure   SaveToXMLFile    (FileName: String);
    procedure   LoadFromXMLFile  (FileName: String);

    procedure   ClearAllXMLComments;
    procedure   AddXMLComment(ElementName, ElementValue : String);

    procedure   ResetElapsedStartTime;

    //Kylix TODO
    {$ifndef iCLX}
    procedure   PrintChart;
    {$endif}
    procedure   PrinterClearCommentLines;
    procedure   PrinterAddCommentLine(Value: String);

    procedure   ScrollXAxis   (Value: Double);
    procedure   ScrollYAxis   (Value: Double);
    procedure   SetXAxisMinMax(Min, Max: Double);
    procedure   SetYAxisMinMax(Min, Max: Double);
    procedure   ZoomXAxis     (Value: Double);
    procedure   ZoomYAxis     (Value: Double);
  published

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -