home *** CD-ROM | disk | FTP | other *** search
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMW MWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWM author: tomas.hanak@centrum.cz WMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMW MWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- unit Qth2DGraph;
-
- interface
-
- uses
- SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs, QStdCtrls,
- QExtCtrls, QMenus, QTypes, Qt,
- Math;
-
- const
- MAX_CURVES = 16;
-
- type
- TPlotMode = (pmDot, pmLine, pmBar);
- TScaleMode = (smNone, smNumber, smTime);
- TTimeFormat = (tfHour, tfHourMin, tfHourMinSec, tfMin, tfMinSec, tfSec);
- TDirection = (diLeftRight, diTopBottom);
-
- TRGBTriple = record
- RGBtRed : Byte;
- RGBtGreen: Byte;
- RGBtBlue : Byte;
- RGBtAny : Byte;
- end;
- TRGBArray = array[0..32767] of TRGBTriple;
- PRGBArray = ^TRGBArray;
-
- Txyc = record
- X: Extended;
- Y: Extended;
- C: TColor;
- end;
-
- TLayerOpt = record
- PlotMode: TPlotMode;
- PenWidth: Integer;
- end;
-
- TGradient = class(TGraphicsObject)
- private
- FColorStart: TColor;
- FColorStop : TColor;
- FDirection : TDirection;
- FEnable : Boolean;
- procedure SetColorStart(const Value: TColor);
- procedure SetColorStop (const Value: TColor);
- procedure SetDirection (const Value: TDirection);
- procedure SetEnable (const Value: Boolean);
- protected
- procedure Draw(ACanvas: TCanvas; Rect: TRect); overload;
- procedure Draw(ACanvas: TCanvas; X1, Y1, X2, Y2: Integer); overload;
- property OnChange;
- public
- constructor Create;
- destructor Destroy; override;
- procedure Assign(Source: TPersistent); override;
- published
- property ColorStart: TColor read FColorStart write SetColorStart default clGray;
- property ColorStop: TColor read FColorStop write SetColorStop default clSilver;
- property DireCtion: TDirection read FDirection write SetDirection default diTopBottom;
- property Enable: Boolean read FEnable write SetEnable default True;
- end;
-
- TLimit = class(TGraphicsObject)
- private
- FAlarmColor: TColor;
- FPen : TPen;
- FValue : Extended;
- FVisible : Boolean;
- procedure SetAlarmColor(const Value: TColor);
- procedure SetPen (const Value: TPen);
- procedure SetValue (const Value: Extended);
- procedure SetVisible (const Value: Boolean);
- protected
- property OnChange;
- public
- constructor Create;
- destructor Destroy; override;
- procedure Assign(Source: TPersistent); override;
- published
- property AlarmColor: TColor read FAlarmColor write SetAlarmColor default clRed;
- property Pen: TPen read FPen write SetPen;
- property Value: Extended read FValue write SetValue;
- property Visible: Boolean read FVisible write SetVisible default False;
- end;
-
- TAxis = class(TGraphicsObject)
- private
- FArrow : Boolean;
- FArrowLength : Integer;
- FArrowWidth : Integer;
- FDivisions : Integer;
- FHighLimit : TLimit;
- FLength : Integer;
- FLowLimit : TLimit;
- FMarginBottom : Integer;
- FMarginLeft : Integer;
- FMarginTop : Integer;
- FMarginRight : Integer;
- FMarks : Boolean;
- FMarksFont : TFont;
- FMax : Extended;
- FMaxNameHeight : Integer;
- FMaxNameWidth : Integer;
- FMaxValueHeight: Integer;
- FMaxValueWidth : Integer;
- FMin : Extended;
- FName : String;
- FNameTmp : String;
- FNameFont : TFont;
- FOrientation : TOrientation;
- FPen : TPen;
- FScaleMode : TScaleMode;
- FShowName : Boolean;
- FTimeFormat : TTimeFormat;
- FVisible : Boolean;
- function FormatTime (const Format: TTimeFormat; const Value: Extended): String;
- procedure SetArrow (const Value: Boolean);
- procedure SetArrowLength(const Value: Integer);
- procedure SetArrowWidth (const Value: Integer);
- procedure SetDivisions (const Value: Integer);
- procedure SetHighLimit (const Value: TLimit);
- procedure SetLength (const Value: Integer);
- procedure SetLowLimit (const Value: TLimit);
- procedure SetMargins;
- procedure SetMarks (const Value: Boolean);
- procedure SetMarksFont (const Value: TFont);
- procedure SetMax (const Value: Extended);
- procedure SetMin (const Value: Extended);
- procedure SetName (const Value: String);
- procedure SetNameFont (const Value: TFont);
- procedure SetOrientation(const Value: TOrientation);
- procedure SetScaleMode (const Value: TScaleMode);
- procedure SetShowName (const Value: Boolean);
- procedure SetTimeFormat (const Value: TTimeFormat);
- procedure SetPen (const Value: TPen);
- procedure SetVisible (const Value: Boolean);
- protected
- procedure Draw(ACanvas: TCanvas; XStart, YStart: Integer);
- property OnChange;
- public
- constructor Create;
- destructor Destroy; override;
- procedure Assign(Source: TPersistent); override;
- property MarginBottom: Integer read FMarginBottom;
- property MarginLeft: Integer read FMarginLeft;
- property MarginRight: Integer read FMarginRight;
- property MarginTop: Integer read FMarginTop;
- published
- property Arrow: Boolean read FArrow write SetArrow default True;
- property ArrowLength: Integer read FArrowLength write SetArrowLength default 15;
- Property ArrowWidth: Integer read FArrowWidth write SetArrowWidth default 7;
- property Divisions: Integer read FDivisions write SetDivisions default 10;
- property HighLimit: TLimit read FHighLimit write SetHighLimit;
- property Length: Integer read FLength write SetLength default 100;
- property LowLimit: TLimit read FLowLimit write SetLowLimit;
- property Marks: Boolean read FMarks write SetMarks default True;
- property MarksFont: TFont read FMarksFont write SetMarksFont;
- property Max: Extended read FMax write SetMax;
- property Min: Extended read FMin write SetMin;
- property Name: String read FNameTmp write SetName;
- property NameFont: TFont read FNameFont write SetNameFont;
- property Orientation: TOrientation read FOrientation write SetOrientation default orHorizontal;
- property Pen: TPen read FPen write SetPen;
- property ScaleMode: TScaleMode read FScaleMode write SetScaleMode default smNumber;
- property ShowName: Boolean read FShowName write SetShowName default True;
- property TimeFormat: TTimeFormat read FTimeFormat write SetTimeFormat default tfMinSec;
- property Visible: Boolean read FVisible write SetVisible default True;
- end;
-
- Tth2DGraph = class(TCustomPanel)
- private
- FPlotAreaColor : TColor;
- FBorder : TBitmap;
- FBorderGradient : TGradient;
- FClr : Boolean;
- FCursorTmp : TCursor;
- FCursorOldX : Integer;
- FCursorOldY : Integer;
- FCursorShow : Boolean;
- FCursorShowValues: Boolean;
- FCurValFont : TFont;
- FCurValPosLeft : Integer;
- FCurValPosTop : Integer;
- FDataArray : array[1..MAX_CURVES] of array of Txyc;
- FDataLength : array[1..MAX_CURVES] of Integer;
- FFreeze : Boolean;
- FGridShow : Boolean;
- FGridPen : TPen;
- FLayerOpt : array[1..MAX_CURVES] of TLayerOpt;
- FLayerOptions : Boolean;
- FMargin : Integer;
- FMarginBottom : Integer;
- FMarginLeft : Integer;
- FMarginTop : Integer;
- FMarginRight : Integer;
- FPlot : TBitmap;
- FPlotAreaGradient: TGradient;
- FPlotMode : TPlotMode;
- FPlotPen : TPen;
- FRBorder : TRect;
- FRPlot : TRect;
- FTitle : String;
- FTitleFont : TFont;
- FXAxis : TAxis;
- FYAxis : TAxis;
- LastXDrawn : array[1..MAX_CURVES] of Extended;
- LastYDrawn : array[1..MAX_CURVES] of Extended;
- Xqnt : Extended;
- Yqnt : Extended;
- procedure AdjustR2Dimension;
- procedure ChangedLimits(Sender: TObject);
- procedure DoPaint (Sender: TObject);
- procedure PlotData (X, Y: Extended; Color: TColor; Layer: Integer);
- procedure Redraw;
- procedure SetPlotAreaColor (const Value: TColor);
- procedure SetBorderGradient (const Value: TGradient);
- procedure SetCursorShow (const Value: Boolean);
- procedure SetCursorShowValues(const Value: Boolean);
- procedure SetCurValFont (const Value: TFont);
- procedure SetCurValPosLeft (const Value: Integer);
- procedure SetCurValPosTop (const Value: Integer);
- procedure SetFXAxis (const Value: TAxis);
- procedure SetFYAxis (const Value: TAxis);
- procedure SetGridShow (const Value: Boolean);
- procedure SetGridPen (const Value: TPen);
- procedure SetLayerOptions (const Value: Boolean);
- procedure SetMargin (const Value: Integer);
- procedure SetPlotAreaGradient(const Value: TGradient);
- procedure SetPlotMode (const Value: TPlotMode);
- procedure SetPlotPen (const Value: TPen);
- procedure SetTitle (const Value: String);
- procedure SetTitleFont (const Value: TFont);
- protected
- procedure MouseMove (Shift: TShiftState; X, Y: Integer); override;
- public
- constructor Create (AOwner: Tcomponent); override;
- destructor Destroy; override;
- procedure AddXY (X, Y: Extended; Color: TColor; Layer: Integer = 1); overload;
- procedure AddXY (X, Y: Extended); overload;
- procedure AutoScale (Layer: Integer = 1);
- procedure Clear;
- function ConvertS2W (X, Y: Integer; var WX, WY: Extended): Boolean;
- //// procedure AntiAlias;
- procedure Freeze (Value: Boolean);
- procedure HideLayer (Layer: Integer);
- procedure LayerOptions(Layer: Integer; PlotMode: TPlotMode; PenWidth: Integer);
- procedure Paint; override;
- procedure UnHideLayer (Layer:Integer);
- published
- property PlotAreaColor: TColor read FPlotAreaColor write SetPlotAreaColor default clBase;
- property BorderGradient: TGradient read FBorderGradient write SetBorderGradient;
- property CursorShow: Boolean read FCursorShow write SetCursorShow default True;
- property CursorShowValues: Boolean read FCursorShowValues write SetCursorShowValues default True;
- property CursorValuesFont: TFont read FCurValFont write SetCurValFont;
- property CursorValuesPosLeft: Integer read FCurValPosLeft write SetCurValPosLeft default 10;
- property CursorValuesPosTop: Integer read FCurValPosTop write SetCurValPosTop default 5;
- property GridShow: Boolean read FGridShow write SetGridShow default True;
- property GridPen: TPen read FGridPen write SetGridPen;
- property LayerOption: Boolean read FLayerOptions write SetLayerOptions default False;
- property Margin: Integer read FMargin write SetMargin default 15;
- property PlotAreaGradient: TGradient read FPlotAreaGradient write SetPlotAreaGradient;
- property PlotMode: TPlotMode read FPlotMode write SetPlotMode;
- property PlotPen: TPen read FPlotPen write SetPlotPen;
- property XAxis: TAxis read FXAxis write SetFXAxis;
- property YAxis: TAxis read FYAxis write SetFYAxis;
- property Title: String read FTitle write SetTitle;
- property TitleFont: TFont read FTitleFont write SetTitleFont;
- property Align default alNone;
- property Anchors;
- property BevelInner;
- property BevelOuter;
- property BevelWidth;
- property Bitmap;
- property BorderWidth;
- property BorderStyle;
- property Color default clBackground;
- property Constraints;
- property DragMode;
- property Enabled;
- property ParentColor;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property TabOrder;
- property TabStop default False;
- property Visible;
- property OnClick;
- property OnContextPopup;
- property OnDblClick;
- property OnDragDrop;
- property OnDragOver;
- property OnEndDrag;
- property OnEnter;
- property OnExit;
- property OnMouseDown;
- property OnMouseEnter;
- property OnMouseLeave;
- property OnMouseMove;
- property OnMouseUp;
- property OnResize;
- property OnStartDrag;
- end;
-
- function Color2RGB(Color: TColor): Integer;
- function ENDL: String;
- procedure Register;
-
- implementation
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- function Color2RGB(Color: TColor): Integer;
- begin
- if (Color and $FF000000) <> 0 then begin
- Color := ColorToRGB(Color);
- Color := ((Color and $FF0000) shr 16) or
- (Color and $00FF00) or
- ((Color and $0000FF) shl 16);
- end;
- Result := $FFFFFF and Color;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- function ENDL: String;
- begin
- Result := Char($0A);
- {$IFDEF MSWINDOWS}
- Result := Char($0D) + Result;
- {$ENDIF}
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Register;
- begin
- RegisterComponents('thSystem', [Tth2DGraph]);
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TGradient - private metods WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.SetColorStart(const Value: TColor);
- begin
- if FColorStart = Value then Exit;
- FColorStart := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.SetColorStop(const Value: TColor);
- begin
- if FColorStop = Value then Exit;
- FColorStop := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.SetDirection(const Value: TDirection);
- begin
- if FDirection = Value then Exit;
- FDirection := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.SetEnable(const Value: Boolean);
- begin
- if FEnable = Value then Exit;
- FEnable := Value;
- Changed;
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TGradient - protected metods WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.Draw(ACanvas: TCanvas; Rect: TRect);
- begin
- Draw(ACanvas, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.Draw(ACanvas: TCanvas; X1, Y1, X2, Y2: Integer);
- var R1, G1, B1: Byte;
- R2, G2, B2: Byte;
- R3, G3, B3: Byte;
- n : Integer;
- R : TRect;
- begin
- R1 := Color2RGB(FColorStart) and $0000FF;
- G1 := (Color2RGB(FColorStart) and $00FF00) shr 8;
- B1 := (Color2RGB(FColorStart) and $FF0000) shr 16;
- R2 := Color2RGB(FColorStop) and $0000FF;
- G2 := (Color2RGB(FColorStop) and $00FF00) shr 8;
- B2 := (Color2RGB(FColorStop) and $FF0000) shr 16;
- if FDirection = diLeftRight then begin
- for n := 0 to X2 - X1 - 1 do begin
- R3 := R1 + Round(n * (R2 - R1) / (X2 - X1 - 1));
- G3 := G1 + Round(n * (G2 - G1) / (X2 - X1 - 1));
- B3 := B1 + Round(n * (B2 - B1) / (X2 - X1 - 1));
- ACanvas.Brush.Color := R3 or (G3 shl 8) or (B3 shl 16);
- R.Left := X1 + n;
- R.Top := Y1;
- R.Right := X1 + n+1;
- R.Bottom := Y2;
- ACanvas.FillRect(R);
- end;
- end
- else begin
- for n := 0 to Y2 - Y1 - 1 do begin
- R3 := R1 + Round(n * (R2 - R1) / (Y2 - Y1 - 1));
- G3 := G1 + Round(n * (G2 - G1) / (Y2 - Y1 - 1));
- B3 := B1 + Round(n * (B2 - B1) / (Y2 - Y1 - 1));
- ACanvas.Brush.Color := R3 or (G3 shl 8) or (B3 shl 16);
- R.Left := X1;
- R.Top := Y1 + n;
- R.Right := X2;
- R.Bottom := Y1 + n+1;
- ACanvas.FillRect(R);
- end;
- end;
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TGradient - public metod WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- constructor TGradient.Create;
- begin
- inherited Create;
- FColorStart := clGray;
- FColorStop := clSilver;
- FDirection := diTopBottom;
- FEnable := True;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- destructor TGradient.Destroy;
- begin
- inherited Destroy;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TGradient.Assign(Source: TPersistent);
- begin
- if Source is TGradient then begin
- DisableChanged;
- try
- Lock;
- try
- TGradient(Source).Lock;
- try
- FColorStart := TGradient(Source).ColorStart;
- FColorStop := TGradient(Source).ColorStop;
- FDirection := TGradient(Source).Direction;
- FEnable := TGradient(Source).Enable;
- finally
- TGradient(Source).Unlock;
- end;
- finally
- Unlock;
- end;
- finally
- EnableChanged;
- Changed;
- end;
- end
- else
- inherited Assign(Source);
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TLimit - private metods MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TLimit.SetAlarmColor(const Value: TColor);
- begin
- if FAlarmColor = Value then Exit;
- FAlarmColor := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TLimit.SetPen(const Value: TPen);
- begin
- if FPen = Value then Exit;
- FPen.Assign(Value);
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TLimit.SetValue(const Value: Extended);
- begin
- if FValue = Value then Exit;
- FValue := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TLimit.SetVisible(const Value: Boolean);
- begin
- if FVisible = Value then Exit;
- FVisible := Value;
- Changed;
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TLimit - protected metods MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TLimit - public metod MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- constructor TLimit.Create;
- begin
- inherited Create;
- FAlarmColor := clRed;
- FPen := TPen.Create;
- FPen.OnChange := OnChange;
- FPen.Color := clRed;
- FPen.Style := psDash;
- FPen.Width := 2;
- FValue := 0;
- FVisible := False;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- destructor TLimit.Destroy;
- begin
- if Assigned(FPen) then FreeAndNil(FPen);
- inherited Destroy;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TLimit.Assign(Source: TPersistent);
- begin
- if Source is TLimit then begin
- DisableChanged;
- try
- Lock;
- try
- TLimit(Source).Lock;
- try
- FAlarmColor := TLimit(Source).AlarmColor;
- FPen.Assign (TLimit(Source).Pen);
- FValue := TLimit(Source).Value;
- FVisible := TLimit(Source).Visible;
- finally
- TLimit(Source).Unlock;
- end;
- finally
- Unlock;
- end;
- finally
- EnableChanged;
- Changed;
- end;
- end
- else
- inherited Assign(Source);
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TAxis - private metods WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- function TAxis.FormatTime(const Format: TTimeFormat; const Value: Extended): String;
- var Time, H, M, S: Int64;
- begin
- if Value < 0 then Result := '-'
- else Result := '';
- Time := Trunc(Abs(Value));
- H := Time div 3600;
- if Format in [tfHourMin, tfHourMinSec] then
- M := (Time mod 3600) div 60
- else
- M := Time div 60;
- if Format in [tfHourMinSec, tfMinSec] then
- S := (Time mod 3600) mod 60
- else
- S := Time;
-
- if Format in [tfHour, tfHourMin, tfHourMinSec] then
- Result := Result + IntToStr(H);
- if Format in [tfHourMin, tfHourMinSec] then begin
- Result := Result + ':';
- if M < 10 then Result := Result + '0';
- end;
- if Format in [tfHourMin, tfHourMinSec, tfMin, tfMinSec] then
- Result := Result + IntToStr(M);
- if Format in [tfHourMinSec, tfMinSec] then begin
- Result := Result + ':';
- if S < 10 then Result := Result + '0';
- end;
- if Format in [tfHourMinSec, tfMinSec, tfSec] then
- Result := Result + IntToStr(S);
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetArrow(const Value: Boolean);
- begin
- if FArrow = Value then Exit;
- FArrow := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetArrowLength(const Value: Integer);
- begin
- if FArrowLength = Value then Exit;
- FArrowLength := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetArrowWidth(const Value: Integer);
- begin
- if FArrowWidth = Value then Exit;
- FArrowWidth := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetDivisions(const Value: Integer);
- begin
- if FDivisions = Value then Exit;
- if FDivisions < 1 then FDivisions := 1
- else FDivisions := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetHighLimit(const Value: TLimit);
- begin
- if FHighLimit = Value then Exit;
- FHighLimit.Assign(Value);
- if FHighLimit.Value < FLowLimit.Value then FHighLimit.Value := FLowLimit.Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetLength(const Value: Integer);
- begin
- if FLength = Value then Exit;
- if FLength < 1 then FLength := 1
- else FLength := Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetLowLimit(const Value: TLimit);
- begin
- if FLowLimit = Value then Exit;
- FLowLimit.Assign(Value);
- if FLowLimit.Value > FHighLimit.Value then FLowLimit.Value := FHighLimit.Value;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetMargins;
- function GetMax(V1, V2: Integer): Integer;
- begin
- if V1 > V2 then Result := V1
- else Result := V2;
- end;
- var AW2, PW, PW2, PWM2, PWM02: Integer;
- A, B, C, D, n : Integer;
- Str : String;
- X : Extended;
- BMP : TBitmap; // Only for finding TextHeight and TextWidth
- begin
- AW2 := FArrowWidth div 2;
- PW := FPen.Width;
- PW2 := PW div 2;
- PWM2 := PW mod 2;
- if PW > 1 then PWM02 := PWM2
- else PWM02 := 0;
- FMaxNameHeight := 0;
- FMaxNameWidth := 0;
- FMaxValueHeight := 0;
- FMaxValueWidth := 0;
- BMP := TBitmap.Create;
- try
- BMP.Width := 1;
- BMP.Height := 1;
- BMP.Canvas.Font.Assign(FNameFont);
- if FShowName then
- if FOrientation = orHorizontal
- then FMaxNameHeight := BMP.Canvas.TextHeight(FName) // Use not FNameFont.Height!!!
- else FMaxNameWidth := BMP.Canvas.TextWidth (FName); // isn't equal
- if FScaleMode <> smNone then begin
- BMP.Canvas.Font.Assign(FMarksFont);
- for n := 0 to FDivisions do begin
- X := (n * (FMax - FMin) / FDivisions) + FMin;
- if FScaleMode = smTime then
- Str := FormatTime(FTimeFormat, X)
- else
- if X < 1000
- then Str := FormatFloat('0.##', X)
- else Str := FormatFloat('0.## e-00', X);
- if FOrientation = orHorizontal then begin
- if BMP.Canvas.TextHeight(Str) > FMaxValueHeight then
- FMaxValueHeight := BMP.Canvas.TextHeight(Str);
- end
- else if BMP.Canvas.TextWidth (Str) > FMaxValueWidth then
- FMaxValueWidth := BMP.Canvas.TextWidth (Str);
- end;
- end;
- finally
- BMP.Free;
- end;
- A := 0;
- if FMarks then
- if FArrow then begin
- B := GetMax(FArrowLength, PW2);
- C := GetMax(AW2 + 1 - PWM02, FMaxValueWidth + FMaxNameWidth + PW + PW2);
- D := GetMax(AW2, FMaxValueHeight + FMaxNameHeight + PW + PW2 - (1 - PWM2));
- end
- else begin
- B := PW2;
- C := FMaxValueWidth + FMaxNameWidth + PW + PW2;
- D := FMaxValueHeight + FMaxNameHeight + PW + PW2 - (1 - PWM2);
- end
- else
- if FArrow then begin
- B := FArrowLength;
- C := GetMax(AW2 + 1 - PWM02, FMaxValueWidth + FMaxNameWidth + PW2);
- D := GetMax(AW2, FMaxValueHeight + FMaxNameHeight + PW2 - (1 - PWM2));
- end
- else begin
- B := 0;
- C := FMaxValueWidth + FMaxNameWidth + PW2;
- D := FMaxValueHeight + FMaxNameHeight + PW2 - (1 - PWM2);
- end;
- if FOrientation = orHorizontal then begin
- FMarginLeft := A;
- FMarginRight := B;
- FMarginTop := C;
- FMarginBottom := D;
- end
- else begin
- FMarginLeft := C;
- FMarginRight := D;
- FMarginTop := B;
- FMarginBottom := A;
- end;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetMarks(const Value: Boolean);
- begin
- if FMarks = Value then Exit;
- FMarks := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetMarksFont(const Value: TFont);
- begin
- if FMarksFont = Value then Exit;
- FMarksFont.Assign(Value);
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetMax(const Value: Extended);
- begin
- if FMax = Value then Exit;
- FMax := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetMin(const Value: Extended);
- begin
- if FMin = Value then Exit;
- FMin := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetName(const Value: String);
- var n: Integer;
- begin
- if FNameTmp = Value then Exit;
- FNameTmp := Value;
- FName := FNameTmp;
- if FOrientation = orVertical then
- for n := System.Length(Value) downto 2 do
- Insert(ENDL, FName, n);
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetNameFont(const Value: TFont);
- begin
- if FNameFont = Value then Exit;
- FNameFont.Assign(Value);
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetOrientation(const Value: TOrientation);
- var n: Integer;
- begin
- if FOrientation = Value then Exit;
- FOrientation := Value;
- FName := FNameTmp;
- if FOrientation = orVertical then
- for n := System.Length(FNameTmp) downto 2 do
- Insert(ENDL, FName, n);
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetPen(const Value: TPen);
- begin
- FPen.Assign(Value);
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetScaleMode(const Value: TScaleMode);
- begin
- if FScaleMode = Value then Exit;
- FScaleMode := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetShowName(const Value: Boolean);
- begin
- if FShowName = Value then Exit;
- FShowName := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetTimeFormat(const Value: TTimeFormat);
- begin
- if FTimeFormat = Value then Exit;
- FTimeFormat := Value;
- SetMargins;
- Changed;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.SetVisible(const Value: Boolean);
- begin
- if FVisible = Value then Exit;
- FVisible := Value;
- SetMargins;
- Changed;
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TAxis - protected metods WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.Draw(ACanvas: TCanvas; XStart, YStart: Integer);
- var AW2, PW, PW2, PWM02: Integer;
- tmpX, tmpY, n : Integer;
- Str : String;
- X, Y : Extended;
- tmpPen : TPen;
- begin
- if not Visible then Exit;
- tmpPen := TPen.Create;
- try
- tmpPen.Assign(ACanvas.Pen);
- ACanvas.Pen.Assign(FPen);
- AW2 := FArrowWidth div 2;
- PW := FPen.Width;
- PW2 := PW div 2;
- if PW > 1 then PWM02 := PW mod 2
- else PWM02 := 0;
- case FOrientation of
- orHorizontal: begin
- ACanvas.MoveTo(XStart, YStart);
- ACanvas.LineTo(XStart + FLength, YStart);
- if FArrow then begin // Draw axis arrow
- ACanvas.MoveTo(FLength + XStart, YStart);
- ACanvas.LineTo(FLength + XStart + FArrowLength - 2*AW2, YStart);
- ACanvas.Pen.Width := 1;
- for n := 0 to AW2 do begin
- ACanvas.MoveTo(FLength + XStart + FArrowLength - 2*AW2 - 1, YStart - n - (1 - PWM02));
- ACanvas.LineTo(FLength + XStart + FArrowLength - 2*n, YStart - n - (1 - PWM02));
- ACanvas.MoveTo(FLength + XStart + FArrowLength - 2*AW2 - 1, YStart + n);
- ACanvas.LineTo(FLength + XStart + FArrowLength - 2*n, YStart + n);
- end;
- ACanvas.Pen.Width := PW;
- end;
- if FMarks then // Draw axis marks
- for n := 0 to FDivisions do begin
- ACanvas.MoveTo(Round((n * FLength) / FDivisions) + XStart, YStart + PW + PW2 + PWM02);
- ACanvas.LineTo(Round((n * FLength) / FDivisions) + XStart, YStart);
- ACanvas.MoveTo(Round((n * FLength) / FDivisions) + XStart, YStart - (PW + PW2));
- ACanvas.LineTo(Round((n * FLength) / FDivisions) + XStart, YStart);
- end;
- if FScaleMode <> smNone then begin // Write axis values
- ACanvas.Font.Assign(FMarksFont);
- for n := 0 to FDivisions do begin
- X := (n * (FMax - FMin) / FDivisions) + FMin;
- if FScaleMode = smTime then
- Str := FormatTime(FTimeFormat, X)
- else
- if X < 1000 then Str := FormatFloat('0.##', X)
- else Str := FormatFloat('0.## e-00', X);
- tmpX := Round(n * FLength / FDivisions) + XStart - ACanvas.TextWidth(Str) div 2;
- tmpY := YStart + PW2;
- if Marks then Inc(tmpY, PW);
- ACanvas.TextOut(tmpX, tmpY, Str);
- end;
- end;
- if FShowName then begin
- ACanvas.Font.Assign(FNameFont);
- tmpX := XStart + (FLength - ACanvas.TextWidth(FName)) div 2;
- tmpY := YStart + (FMarginBottom - ACanvas.TextHeight(FName));
- ACanvas.TextOut(tmpX, tmpY, FName);
- end;
- end; //orHorizontal
- orVertical: begin
- ACanvas.MoveTo(XStart, YStart);
- ACanvas.LineTo(XStart, YStart - Length);
- if FArrow then begin // Draw axis arrow
- ACanvas.MoveTo(XStart, YStart - FLength);
- ACanvas.LineTo(XStart, YStart - (FLength + FArrowLength - 2*AW2));
- ACanvas.Pen.Width := 1;
- for n := 0 to AW2 do begin
- ACanvas.MoveTo(XStart - n - (1 - PWM02), YStart - (FLength + FArrowLength - 2*AW2 - 1));
- ACanvas.LineTo(XStart - n - (1 - PWM02), YStart - (FLength + FArrowLength - 2*n));
- ACanvas.MoveTo(XStart + n, YStart - (FLength + FArrowLength - 2*AW2 - 1));
- ACanvas.LineTo(XStart + n, YStart - (FLength + FArrowLength - 2*n));
- end;
- ACanvas.Pen.Width := PW;
- end;
- if FMarks then // Draw axis marks
- for n := 0 to FDivisions do begin
- ACanvas.MoveTo(XStart + PW + PW2 + PWM02, YStart - Round((n * FLength) / FDivisions));
- ACanvas.LineTo(XStart, YStart - Round((n * FLength) / FDivisions));
- ACanvas.MoveTo(XStart - (PW + PW2), YStart - Round((n * FLength) / FDivisions));
- ACanvas.LineTo(XStart, YStart - Round((n * FLength) / FDivisions));
- end;
- if FScaleMode <> smNone then begin
- ACanvas.Font.Assign(FMarksFont);
- for n := 0 to FDivisions do begin
- Y := (n * (FMax - FMin) / FDivisions) + FMin;
- if FScaleMode = smTime then
- Str := FormatTime(FTimeFormat, Y)
- else
- if Y < 1000 then
- Str := FormatFloat('0.##', Y)
- else
- Str := FormatFloat('0.##E-00', Y);
- tmpX := XStart - ACanvas.TextWidth(Str) - PW2 - 1;
- if Marks then Dec(tmpX, PW);
- tmpY := YStart - Round((n * FLength) / FDivisions) - ACanvas.TextHeight(Str) div 2;
- ACanvas.TextOut(tmpX, tmpY, Str);
- end;
- end;
- if FShowName then begin
- ACanvas.Font.Assign(FNameFont);
- tmpX := XStart - FMarginLeft;
- tmpY := YStart - (FLength + ACanvas.TextHeight(FName)) div 2;
- ACanvas.TextOut(tmpX, tmpY, FName);
- end;
- end; //orVertical
- end; //case
-
- finally
- ACanvas.Pen.Assign(tmpPen);
- tmpPen.Free;
- end;
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM TAxis - public metods MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- constructor TAxis.Create;
- begin
- inherited Create;
- FHighLimit := TLimit.Create;
- FLowLimit := TLimit.Create;
- FMarksFont := TFont.Create;
- FNameFont := TFont.Create;
- FPen := TPen.Create;
- FHighLimit.OnChange := OnChange;
- FLowLimit.OnChange := OnChange;
- FMarksFont.OnChange := OnChange;
- FNameFont.OnChange := OnChange;
- FPen.OnChange := OnChange;
- FArrow := True;
- FArrowLength := 25;
- FArrowWidth := 11;
- FDivisions := 10;
- FHighLimit.Value := 9;
- FLowLimit.Value := 1;
- FLength := 100;
- FMarks := True;
- FMax := 10;
- FMin := 0;
- FOrientation := orHorizontal;
- FPen.Color := clNavy;
- FPen.Width := 3;
- FScaleMode := smNumber;
- FShowName := True;
- FTimeFormat := tfMinSec;
- FVisible := True;
- Name := '>axis name<';
- SetMargins;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- destructor TAxis.Destroy;
- begin
- if Assigned(FPen) then FreeAndNil(FPen);
- if Assigned(FNameFont) then FreeAndNil(FNameFont);
- if Assigned(FMarksFont) then FreeAndNil(FMarksFont);
- if Assigned(FLowLimit) then FreeAndNil(FLowLimit);
- if Assigned(FHighLimit) then FreeAndNil(FHighLimit);
- inherited Destroy;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure TAxis.Assign(Source: TPersistent);
- begin
- if Source is TAxis then begin
- DisableChanged;
- try
- Lock;
- try
- TAxis(Source).Lock;
- try
- FArrow := TAxis(Source).Arrow;
- FArrowLength := TAxis(Source).FArrowLength;
- FArrowWidth := TAxis(Source).ArrowWidth;
- if TAxis(Source).FDivisions < 1 then FDivisions := 1
- else FDivisions := TAxis(Source).Divisions;
- FHighLimit.Assign(TAxis(Source).HighLimit);
- if TAxis(Source).FLength < 1 then FLength := 1
- else FLength := TAxis(Source).Length;
- FLowLimit.Assign (TAxis(Source).LowLimit);
- FMarks := TAxis(Source).Marks;
- FMarksFont.Assign(TAxis(Source).MarksFont);
- FMax := TAxis(Source).Max;
- FMin := TAxis(Source).Min;
- FNameFont.Assign (TAxis(Source).NameFont);
- FOrientation := TAxis(Source).Orientation;
- FPen.Assign (TAxis(Source).Pen);
- FScaleMode := TAxis(Source).ScaleMode;
- FShowName := TAxis(Source).ShowName;
- FTimeFormat := TAxis(Source).TimeFormat;
- FVisible := TAxis(Source).Visible;
- Name := TAxis(Source).Name;
- SetMargins;
- finally
- TAxis(Source).Unlock;
- end;
- finally
- Unlock;
- end;
- finally
- EnableChanged;
- Changed;
- end;
- end
- else
- inherited Assign(Source);
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM Tth2DGraph - private metods MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.AdjustR2Dimension;
- begin
- try
- Xqnt := FXAxis.Length / (FXAxis.Max - FXAxis.Min);
- except
- on EZeroDivide do Xqnt := FXAxis.Length;
- end;
- try
- Yqnt := FYAxis.Length / (FYAxis.Max - FYAxis.Min);
- except
- on EZeroDivide do Yqnt := FYAxis.Length;
- end;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.ChangedLimits(Sender: TObject);
- var tmp: Extended;
- begin
- if FXAxis.HighLimit.Value < FXAxis.LowLimit.Value then begin
- tmp := FXAxis.LowLimit.Value;
- FXAxis.LowLimit.Value := FXAxis.HighLimit.Value;
- FXAxis.HighLimit.Value := tmp;
- end;
- if FYAxis.HighLimit.Value < FYAxis.LowLimit.Value then begin
- tmp := FYAxis.LowLimit.Value;
- FYAxis.LowLimit.Value := FYAxis.HighLimit.Value;
- FYAxis.HighLimit.Value := tmp;
- end;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.DoPaint(Sender:TObject);
- begin
- Redraw; // Redraw is without parameters
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.PlotData(X, Y: Extended; Color: TColor; Layer: Integer);
- var L, B : Integer;
- S, S2 : Integer;
- Xold, Yold: Extended;
- Xnew, Ynew: Extended;
- Xpix, Ypix: Int64;
- Xll, Xhl : Extended;
- Yll, Yhl : Extended;
- {MWMWMWMW}
- procedure PlotDot;
- var Dot: TRect;
- begin
- FPlot.Canvas.Brush.Color := Color;
- if (X < Xll) and FXAxis.LowLimit.Visible then
- FPlot.Canvas.Brush.Color := FXAxis.LowLimit.AlarmColor;
- if (X > Xhl) and FXAxis.HighLimit.Visible then
- FPlot.Canvas.Brush.Color := FXAxis.HighLimit.AlarmColor;
- if (Y < Yll) and FYAxis.LowLimit.Visible then
- FPlot.Canvas.Brush.Color := FYAxis.LowLimit.AlarmColor;
- if (Y > Yhl) and FYAxis.HighLimit.Visible then
- FPlot.Canvas.Brush.Color := FYAxis.HighLimit.AlarmColor;
- Dot.Left := L - S + Xpix;
- Dot.Right := L - S + S2 + Xpix;
- Dot.Bottom := B+1 + S - Ypix;
- Dot.Top := B+1 + S - S2 - Ypix;
- FPlot.Canvas.FillRect(Dot);
- FPlot.Canvas.Brush.Color := FPlotAreaColor;
- end;
- {MWMWMWMW}
- procedure PlotBar;
- begin
- if (X < Xll) and FXAxis.LowLimit.Visible then
- FPlot.Canvas.Pen.Color := FXAxis.LowLimit.AlarmColor;
- if (X > Xhl) and FXAxis.HighLimit.Visible then
- FPlot.Canvas.Pen.Color := FXAxis.HighLimit.AlarmColor;
- FPlot.Canvas.MoveTo(L + Xpix, B - Round(-FYAxis.Min * Yqnt));
- FPlot.Canvas.LineTo(L + Xpix, B - Ypix);
- FPlot.Canvas.Pen.Color := FYAxis.LowLimit.AlarmColor;
- if (Y < Yll) and FYAxis.LowLimit.Visible then
- if Yll < 0 then begin
- FPlot.Canvas.MoveTo(L + Xpix, B - Ypix);
- FPlot.Canvas.LineTo(L + Xpix, B - Round((Yll - FYAxis.Min) * Yqnt));
- end
- else begin
- FPlot.Canvas.MoveTo(L + Xpix, B - Round(-FYAxis.Min * Yqnt));
- FPlot.Canvas.LineTo(L + Xpix, B - Ypix);
- end
- else
- if (Y > Yll) and (Yll > 0) then begin
- FPlot.Canvas.MoveTo(L + Xpix, B - Round(-FYAxis.Min * Yqnt));
- FPlot.Canvas.LineTo(L + Xpix, B - Round((Yll - FYAxis.Min) * Yqnt));
- end;
- FPlot.Canvas.Pen.Color := FYAxis.HighLimit.AlarmColor;
- if (Y > Yhl) and FYAxis.HighLimit.Visible then
- if Yhl > 0 then begin
- FPlot.Canvas.MoveTo(L + Xpix, B - Ypix);
- FPlot.Canvas.LineTo(L + Xpix, B - Round((Yhl - FYAxis.Min) * Yqnt));
- end
- else begin
- FPlot.Canvas.MoveTo(L + Xpix, B - Round(-FYAxis.Min * Yqnt));
- FPlot.Canvas.LineTo(L + Xpix, B - Ypix);
- end
- else
- if (Y < Yhl) and (Yhl < 0) then begin
- FPlot.Canvas.MoveTo(L + Xpix, B - Round(-FYAxis.Min * Yqnt));
- FPlot.Canvas.LineTo(L + Xpix, B - Round((Yhl - FYAxis.Min) * Yqnt));
- end;
- end;
- {MWMWMWMW}
- procedure PlotLine;
- procedure Swap(var Xa, Ya, Xb, Yb: Extended);
- var Xc, Yc: Extended;
- begin
- Xc := Xa; Yc := Ya;
- Xa := Xb; Ya := Yb;
- Xb := Xc; Yb := Yc;
- end;
- var n : Integer;
- Xavg, Yavg: Extended;
- Xx, Yy : array[0..5] of Extended;
- begin
- if FClr then begin
- FPlot.Canvas.MoveTo(L + Xpix, B+1 - Ypix);
- FClr := False;
- end
- else begin
- if Ynew < Yold then Swap(Xnew, Ynew, Xold, Yold);
- Xx[0] := Xold; Yy[0] := Yold;
- Xx[5] := Xnew; Yy[5] := Ynew;
- Yy[1] := Yll;
- try Xx[1] := Xold + (Xnew - Xold) * (Yy[1] - Yold) / (Ynew - Yold);
- except on EZeroDivide do Xx[1] := (Xnew - Xold) / 2; end;
- Xx[2] := Xll;
- try Yy[2] := Yold + (Ynew - Yold) * (Xx[2] - Xold) / (Xnew - Xold);
- except on EZeroDivide do Yy[2] := (Ynew - Yold) / 2; end;
- Xx[3] := Xhl;
- try Yy[3] := Yold + (Ynew - Yold) * (Xx[3] - Xold) / (Xnew - Xold);
- except on EZeroDivide do Yy[3] := (Ynew - Yold) / 2; end;
- Yy[4] := Yhl;
- try Xx[4] := Xold + (Xnew - Xold) * (Yy[4] - Yold) / (Ynew - Yold);
- except on EZeroDivide do Xx[4] := (Xnew - Xold) / 2; end;
- // Sort dots descending by Y-value
- if Yy[1] > Yy[2] then Swap(Xx[1], Yy[1], Xx[2], Yy[2]);
- if Yy[2] > Yy[3] then Swap(Xx[2], Yy[2], Xx[3], Yy[3]);
- if Yy[3] > Yy[4] then Swap(Xx[3], Yy[3], Xx[4], Yy[4]);
- if Yy[1] > Yy[2] then Swap(Xx[1], Yy[1], Xx[2], Yy[2]);
- if Yy[2] > Yy[3] then Swap(Xx[2], Yy[2], Xx[3], Yy[3]);
- if Yy[1] > Yy[2] then Swap(Xx[1], Yy[1], Xx[2], Yy[2]);
- if Yold >= Yy[1] then begin Xx[1] := Xold; Yy[1] := Yold; end;
- if Yold >= Yy[2] then begin Xx[2] := Xold; Yy[2] := Yold; end;
- if Yold >= Yy[3] then begin Xx[3] := Xold; Yy[3] := Yold; end;
- if Yold >= Yy[4] then begin Xx[4] := Xold; Yy[4] := Yold; end;
- if Ynew <= Yy[1] then begin Xx[1] := Xnew; Yy[1] := Ynew; end;
- if Ynew <= Yy[2] then begin Xx[2] := Xnew; Yy[2] := Ynew; end;
- if Ynew <= Yy[3] then begin Xx[3] := Xnew; Yy[3] := Ynew; end;
- if Ynew <= Yy[4] then begin Xx[4] := Xnew; Yy[4] := Ynew; end;
- // Draw partial lines
- for n := 1 to 5 do begin
- if (Xx[n - 1] = Xx[n]) and (Yy[n - 1] = Yy[n]) then continue;
- Xavg := (Xx[n - 1] + Xx[n]) / 2;
- Yavg := (Yy[n - 1] + Yy[n]) / 2;
- if (Yavg < Yll) and FYAxis.LowLimit.Visible
- then FPlot.Canvas.Pen.Color := FYAxis.LowLimit.AlarmColor
- else if (Yavg > Yhl) and FYAxis.HighLimit.Visible
- then FPlot.Canvas.Pen.Color := FYAxis.HighLimit.AlarmColor
- else if (Xavg < Xll) and FXAxis.LowLimit.Visible
- then FPlot.Canvas.Pen.Color := FXAxis.LowLimit.AlarmColor
- else if (Xavg > Xhl) and FXAxis.HighLimit.Visible
- then FPlot.Canvas.Pen.Color := FXAxis.HighLimit.AlarmColor
- else FPlot.Canvas.Pen.Color := Color;
- FPlot.Canvas.MoveTo(L + Round((Xx[n - 1] - FXAxis.Min) * Xqnt),
- B - Round((Yy[n - 1] - FYAxis.Min) * Yqnt));
- FPlot.Canvas.LineTo(L + Round((Xx[n] - FXAxis.Min) * Xqnt),
- B - Round((Yy[n] - FYAxis.Min) * Yqnt));
- end;
- end;
- end;
- {MWMWMWMW}
- begin
- L := FRPlot.Left;
- B := FRPlot.Bottom-1;
- S := FPlotPen.Width div 2;
- S2 := FPlotPen.Width;
- FPlot.Canvas.Pen.Assign(FPlotPen);
- FPlot.Canvas.Pen.Color := Color;
- if FLayerOptions then begin
- FPlotMode := FLayerOpt[Layer].PlotMode;
- if FPlotMode = pmDot then begin
- S := (FLayerOpt[Layer].PenWidth) div 2;
- S2 := FLayerOpt[Layer].PenWidth;
- end
- else
- FPlot.Canvas.Pen.Width := FLayerOpt[Layer].PenWidth;
- end;
- Xnew := X;
- Ynew := Y;
- Xpix := Round((Xnew - FXAxis.Min) * Xqnt);
- Ypix := Round((Ynew - FYAxis.Min) * Yqnt);
- Xold := LastXDrawn[Layer];
- Yold := LastYDrawn[Layer];
- LastXDrawn[Layer] := Xnew;
- LastYDrawn[Layer] := Ynew;
- Xll := FXAxis.LowLimit.Value;
- Xhl := FXAxis.HighLimit.Value;
- Yll := FYAxis.LowLimit.Value;
- Yhl := FYAxis.HighLimit.Value;
- case FPlotMode of
- pmDot : PlotDot;
- pmLine: PlotLine;
- pmBar : PlotBar;
- end;
- if not FFreeze then FBorder.Canvas.CopyRect(FRPlot, FPlot.Canvas, FRPlot);
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.Redraw;
- function GetMax(V1, V2: Integer): Integer;
- begin
- if V1 > V2 then Result := V1
- else Result := V2;
- end;
- var i, j : Integer;
- tmpFreeze: Boolean;
- tmpLimit : Extended;
- tmpXMarg : Integer;
- tmpYMarg : Integer;
- ACanvas : TCanvas;
-
- BMP: TBitmap;
- R: TRect;
- Color1, Color2: TColor;
- R1, G1, B1: Byte;
- R2, G2, B2: Byte;
- R3, G3, B3: Byte;
-
- begin
- if (csDesigning in ComponentState) then ACanvas := Canvas
- else ACanvas := FBorder.Canvas;
- FCursorOldX := -1;
- FCursorOldY := -1;
- ACanvas.Font.Assign(FTitleFont);
- // Adjust Margins
- if FXAxis.Visible then tmpXMarg := FXAxis.MarginBottom else tmpXMarg := 0;
- if FYAxis.Visible then tmpYMarg := FYAxis.MarginBottom else tmpYMarg := 0;
- FMarginBottom := GetMax(tmpXMarg, tmpYMarg);
- if FXAxis.Visible then tmpXMarg := FXAxis.MarginLeft else tmpXMarg := 0;
- if FYAxis.Visible then tmpYMarg := FYAxis.MarginLeft else tmpYMarg := 0;
- FMarginLeft := GetMax(tmpXMarg, tmpYMarg);
- if FXAxis.Visible then tmpXMarg := FXAxis.MarginRight else tmpXMarg := 0;
- FMarginRight := tmpXMarg;
- if FYAxis.Visible then tmpYMarg := FYAxis.MarginTop else tmpYMarg := 0;
- if Length(FTitle) <> 0
- then FMarginTop := GetMax(ACanvas.TextHeight(FTitle), tmpYMarg)
- else FMarginTop := tmpYMarg;
- Inc(FMarginBottom, FMargin);
- Inc(FMarginLeft, FMargin);
- Inc(FMarginRight, FMargin);
- Inc(FMarginTop, FMargin);
- // Refresh proportional Value
- AdjustR2Dimension;
- // FPlot bitmap size
- FPlot.Width := Width - 2 * BevelWidth;
- FPlot.Height := Height - 2 * BevelWidth;
- // FRBorder is the whole visible area of the Panel (Border)
- FRBorder.Left := 2 * BevelWidth;
- FRBorder.Top := 2 * BevelWidth;
- FRBorder.Right := Width - 2 * BevelWidth;
- FRBorder.Bottom := Height - 2 * BevelWidth;
- // FRPlot is the part where the plotting is done
- FRPlot.Left := FRBorder.Left + FMarginLeft;
- FRPlot.Top := FRBorder.Top + FMarginTop;
- FRPlot.Right := FRBorder.Right - FMarginRight;
- FRPlot.Bottom := FRBorder.Bottom - FMarginBottom;
- // Draws the window for the graph
- if ACanvas = FBorder.Canvas then begin
- FBorder.Width := Width - 2 * BevelWidth;
- FBorder.Height := Height - 2 * BevelWidth;
- end;
- // Draws border
- if FBorderGradient.Enable then
-
- ////// vykreslovat gradient jen pri zmene
-
- FBorderGradient.Draw(ACanvas, FRBorder)
- else begin
- ACanvas.Brush.Color := Color;
- ACanvas.FillRect(FRBorder);
- end;
- // Draws plot area
- if FPlotAreaGradient.Enable then
-
- ////// vykreslovat gradient jen pri zmene
-
- FPlotAreaGradient.Draw(ACanvas, FRPlot)
- else
- if FPlotAreaColor = clNone then
- ACanvas.CopyRect(FRPlot, FBorder.Canvas, FRPlot)
- else begin
- ACanvas.Brush.Color := FPlotAreaColor;
- ACanvas.FillRect(FRPlot);
- end;
- // Graph title - font assigned hereinbefore
- if FTitle <> '' then
- ACanvas.Textout(FRPlot.Left + (FRPlot.Right-1 - FRPlot.Left - ACanvas.TextWidth(FTitle)) div 2,
- (FRPlot.Top + FRBorder.Top - ACanvas.TextHeight(FTitle)) div 2, FTitle);
- // Draws grids
- ACanvas.Pen.Assign(FGridPen);
- // Y-axis (vertical) lines
- YAxis.Length := FRPlot.Bottom-1 - FRPlot.Top;
- if GridShow then
- for i := 0 to FXAxis.Divisions do begin
- ACanvas.MoveTo(Round((i * (FRPlot.Right-1 - FRPlot.Left)) / FXAxis.Divisions) + FRPlot.Left, FRPlot.Top);
- ACanvas.LineTo(Round((i * (FRPlot.Right-1 - FRPlot.Left)) / FXAxis.Divisions) + FRPlot.Left, FRPlot.Bottom-1);
- end;
- // X-axis (horizontal) lines
- XAxis.Length := FRPlot.Right-1 - FRPlot.Left;
- if GridShow then
- for i := 0 to FYAxis.Divisions do begin
- ACanvas.MoveTo(FRPlot.Left, FRPlot.Bottom-1 - Round((i * (FRPlot.Bottom-1 - FRPlot.Top)) / FYAxis.Divisions));
- ACanvas.LineTo(FRPlot.Right-1, FRPlot.Bottom-1 - Round((i * (FRPlot.Bottom-1 - FRPlot.Top)) / FYAxis.Divisions));
- end;
- // Draw axes
- XAxis.Draw(ACanvas, FRPlot.Left, FRPlot.Bottom-1);
- YAxis.Draw(ACanvas, FRPlot.Left, FRPlot.Bottom-1);
- // Draw limits
- if FXAxis.HighLimit.Visible then begin
- tmpLimit := FXAxis.HighLimit.Value;
- if (tmpLimit < FXAxis.Max) and (tmpLimit > FXAxis.Min) then begin
- ACanvas.Pen.Assign(FXAxis.HighLimit.Pen);
- ACanvas.MoveTo(FRPlot.Left+1 + Round((tmpLimit - FXAxis.Min) * Xqnt), FRPlot.Top);
- ACanvas.LineTo(FRPlot.Left+1 + Round((tmpLimit - FXAxis.Min) * Xqnt), FRPlot.Bottom-1);
- end;
- end;
- if FXAxis.LowLimit.Visible then begin
- tmpLimit := FXAxis.LowLimit.Value;
- if (tmpLimit < FXAxis.Max) and (tmpLimit > FXAxis.Min) then begin
- ACanvas.Pen.Assign(FXAxis.LowLimit.Pen);
- ACanvas.MoveTo(FRPlot.Left + Round((tmpLimit - FXAxis.Min) * Xqnt), FRPlot.Top);
- ACanvas.LineTo(FRPlot.Left + Round((tmpLimit - FXAxis.Min) * Xqnt), FRPlot.Bottom-1);
- end;
- end;
- if FYAxis.HighLimit.Visible then begin
- tmpLimit := FYAxis.HighLimit.Value;
- if (tmpLimit < FYAxis.Max) and (tmpLimit > FYAxis.Min) then begin
- ACanvas.Pen.Assign(FYAxis.HighLimit.Pen);
- ACanvas.MoveTo(FRPlot.Left, FRPlot.Bottom-1 - Round((tmpLimit - FYAxis.Min) * Yqnt));
- ACanvas.LineTo(FRPlot.Right-1, FRPlot.Bottom-1 - Round((tmpLimit - FYAxis.Min) * Yqnt));
- end;
- end;
- if FYAxis.LowLimit.Visible then begin
- tmpLimit := FYAxis.LowLimit.Value;
- if (tmpLimit < FYAxis.Max) and (tmpLimit > FYAxis.Min) then begin
- ACanvas.Pen.Assign(FYAxis.LowLimit.Pen);
- ACanvas.MoveTo(FRPlot.Left, FRPlot.Bottom-1 - Round((tmpLimit - FYAxis.Min) * Yqnt));
- ACanvas.LineTo(FRPlot.Right-1, FRPlot.Bottom-1 - Round((tmpLimit - FYAxis.Min) * Yqnt));
- end;
- end;
- ACanvas.Pen.Assign(FGridPen); // Without this line is graph no correct repainted
- // Plot data
- if not(csDesigning in ComponentState) then begin
- FPlot.Canvas.CopyRect(FRPlot, ACanvas, FRPlot);
- tmpFreeze := FFreeze;
- FFreeze := True;
- for j := 1 to MAX_CURVES do
- if FDataLength[j] > 1 then begin
- FClr := True;
- for i := 1 to FDataLength[j] - 1 do
- PlotData(FDataArray[j, i].X, FDataArray[j, i].Y, FDataArray[j, i].C, j);
- end;
- FFreeze := tmpFreeze;
- FBorder.Canvas.CopyRect(FRPlot, FPlot.Canvas, FRPlot);
- if not FFreeze then Canvas.CopyRect(FRBorder, FBorder.Canvas, FRBorder);
- MouseMove([], ScreenToClient(Mouse.CursorPos).X, ScreenToClient(Mouse.CursorPos).Y);
- end;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetPlotAreaColor(const Value: Tcolor);
- begin
- if FPlotAreaColor = Value then Exit;
- FPlotAreaColor := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetBorderGradient(const Value: TGradient);
- begin
- if FBorderGradient = Value then Exit;
- FBorderGradient.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetCursorShow(const Value: Boolean);
- begin
- if FCursorShow = Value then Exit;
- FCursorShow := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetCursorShowValues(const Value: Boolean);
- begin
- if FCursorShowValues = Value then Exit;
- FCursorShowValues := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetCurValFont(const Value: TFont);
- begin
- if FCurValFont = Value then Exit;
- FCurValFont.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetCurValPosLeft(const Value: Integer);
- begin
- if FCurValPosLeft = Value then Exit;
- FCurValPosLeft := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetCurValPosTop(const Value: Integer);
- begin
- if FCurValPosTop = Value then Exit;
- FCurValPosTop := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetFXAxis(const Value: TAxis);
- begin
- if FXAxis = Value then Exit;
- FXAxis.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetFYAxis(const Value: TAxis);
- begin
- if FYAxis = Value then Exit;
- FYAxis.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetGridShow(const Value: Boolean);
- begin
- if FGridShow = Value then Exit;
- FGridShow := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetGridPen(const Value: TPen);
- begin
- if FGridPen = Value then Exit;
- FGridPen.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetLayerOptions(const Value: Boolean);
- begin
- if FLayerOptions = Value then Exit;
- FLayerOptions := Value;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetMargin(const Value: Integer);
- begin
- if FMargin = Value then Exit;
- FMargin := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetPlotAreaGradient(const Value: TGradient);
- begin
- if FPlotAreaGradient = Value then Exit;
- FPlotAreaGradient.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetPlotMode(const Value: TPlotMode);
- begin
- if FPlotMode = Value then Exit;
- FPlotMode := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetPlotPen(const Value: TPen);
- begin
- if FPlotPen = Value then Exit;
- FPlotPen.Assign(Value);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetTitle(const Value: String);
- begin
- if FTitle = Value then Exit;
- FTitle := Value;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.SetTitleFont(const Value: TFont);
- begin
- if FTitleFont = Value then Exit;
- FTitleFont.Assign(Value);
- Redraw;
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM Tth2DGraph - protected metods MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.MouseMove(Shift: TShiftState; X, Y: Integer);
- var NeedRepaint: Boolean;
- WX, WY : Extended;
- procedure DeleteOldCursor;
- begin
- if (FCursorOldX <> -1) and (FCursorOldY <> -1) then begin
- FPlot.Canvas.MoveTo(FCursorOldX, 0);
- FPlot.Canvas.LineTo(FCursorOldX, FPlot.Height-1);
- FPlot.Canvas.MoveTo(0, FCursorOldY);
- FPlot.Canvas.LineTo(FPlot.Width-1, FCursorOldY);
- NeedRepaint := True;
- end;
- end;
- begin
- if FCursorShow then begin
- NeedRepaint := False;
- FPlot.Canvas.Pen.Width := 1;
- FPlot.Canvas.Pen.Mode := pmNot;
- if Cursor <> crNone then FCursorTmp := Cursor;
- if (X < FRPlot.Left) or (X > FRPlot.Right-1) or (Y < FRPlot.Top) or (Y > FRPlot.Bottom-1) then begin
- Cursor := FCursorTmp;
- DeleteOldCursor;
- FCursorOldX := -1;
- FCursorOldY := -1;
- end
- else begin
- Cursor := crNone;
- DeleteOldCursor;
- FPlot.Canvas.MoveTo(X, 0);
- FPlot.Canvas.LineTo(X, FPlot.Height-1);
- FPlot.Canvas.MoveTo(0, Y);
- FPlot.Canvas.LineTo(FPlot.Width-1, Y);
- NeedRepaint := True;
- FCursorOldX := X;
- FCursorOldY := Y;
- end;
- if NeedRepaint then begin
- FBorder.Canvas.CopyRect(FRPlot, FPlot.Canvas, FRPlot);
- Canvas.CopyRect(FRBorder, FBorder.Canvas, FRBorder);
- if FCursorShowValues then begin
- ConvertS2W(X, Y, WX, WY);
- Canvas.Font.Assign(FCurValFont);
- if (FCursorOldX <> -1) and (FCursorOldY <> -1)
- then Canvas.TextOut(FRPlot.Left + FCurValPosLeft, FRPlot.Top + FCurValPosTop,
- 'X = ' + FloatToStr(WX) + ENDL + 'Y = ' + FloatToStr(WY))
- else Canvas.TextOut(FRPlot.Left + FCurValPosLeft, FRPlot.Top + FCurValPosTop,
- 'X = ???' + ENDL + 'Y = ???');
- end;
- end;
- end;
- inherited MouseMove(Shift, X, Y);
- end;
-
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWM Tth2DGraph - public metods WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- constructor Tth2DGraph.Create;
- var n: Integer;
- begin
- inherited Create(AOwner);
- // Global panel default settings
- // BevelInner := bvRaised;
- // BevelOuter := bvLowered;
- // BevelWidth := 2;
- Caption := '';
- Height := 200;
- ParentFont := False;
- Width := 300;
- // Create all dynamic structures
- FBorder := TBitmap.Create;
- FBorderGradient := TGradient.Create;
- FCurValFont := TFont.Create;
- FGridPen := TPen.Create;
- FPlot := TBitmap.Create;
- FPlotAreaGradient := TGradient.Create;
- FPlotPen := TPen.Create;
- FTitleFont := TFont.Create;
- FXAxis := TAxis.Create;
- FYAxis := TAxis.Create;
- // Events assignment
- FBorderGradient.OnChange := DoPaint;
- FCurValFont.OnChange := DoPaint;
- FGridPen.OnChange := DoPaint;
- FPlotAreaGradient.OnChange := DoPaint;
- FPlotPen.OnChange := DoPaint;
- FTitleFont.OnChange := DoPaint;
- FXAxis.OnChange := DoPaint;
- FYAxis.OnChange := DoPaint;
- FXAxis.HighLimit.OnChange := ChangedLimits;
- FYAxis.HighLimit.OnChange := ChangedLimits;
- FXAxis.HighLimit.Pen.OnChange := ChangedLimits;
- FYAxis.HighLimit.Pen.OnChange := ChangedLimits;
- FXAxis.LowLimit.OnChange := ChangedLimits;
- FYAxis.LowLimit.OnChange := ChangedLimits;
- FXAxis.LowLimit.Pen.OnChange := ChangedLimits;
- FYAxis.LowLimit.Pen.OnChange := ChangedLimits;
- FXAxis.MarksFont.OnChange := DoPaint;
- FYAxis.MarksFont.OnChange := DoPaint;
- FXAxis.NameFont.OnChange := DoPaint;
- FYAxis.NameFont.OnChange := DoPaint;
- FXAxis.Pen.OnChange := DoPaint;
- FYAxis.Pen.OnChange := DoPaint;
- // Default distances between graph-edges and panel borders
- FMargin := 10;
- FMarginLeft := FMargin + 2 * BevelWidth;
- FMarginTop := FMargin + 2 * BevelWidth;
- FMarginBottom := FMargin + 2 * BevelWidth;
- FMarginRight := FMargin + 2 * BevelWidth;
- // Values referred to axes
- FXAxis.HighLimit.Visible := True;
- FYAxis.HighLimit.Visible := True;
- FXAxis.LowLimit.Visible := True;
- FYAxis.LowLimit.Visible := True;
- FXAxis.Orientation := orHorizontal;
- FYAxis.Orientation := orVertical;
- // Other settings
- FCursorOldX := -1;
- FCursorOldY := -1;
- FCursorShow := True;
- FCursorShowValues := True;
- FCurValPosLeft := 10;
- FCurValPosTop := 5;
- FGridShow := True;
- FLayerOptions := False;
- FPlotMode := pmLine;
- FTitle := '> Graph title <';
- for n := 1 to MAX_CURVES do begin
- FLayerOpt[n].PlotMode := FPlotMode;
- FLayerOpt[n].PenWidth := 1;
- FDataLength[n] := 1;
- SetLength(FDataArray[n], 1);
- end;
- // Graph and axes styles and colors
- FPlotAreaColor := clBase;
- FBorderGradient.ColorStart := $E6F3F3;
- FBorderGradient.ColorStop := $9ECFCF;
- FGridPen.Color := $999FFF;
- FGridPen.Style := psDot;
- FPlotAreaGradient.ColorStart := $8EBFDB;
- FPlotAreaGradient.ColorStop := $B6C3EF;
- FPlotAreaGradient.Direction := diLeftRight;
- FPlotPen.Color := clMaroon;
- FTitleFont.Color := $808040;
- FXAxis.HighLimit.Pen.Color := clYellow;
- FXAxis.HighLimit.AlarmColor := clYellow;
- FXAxis.LowLimit.Pen.Color := clLime;
- FXAxis.LowLimit.AlarmColor := clLime;
- FYAxis.HighLimit.Pen.Color := clRed;
- FYAxis.HighLimit.AlarmColor := clRed;
- FYAxis.LowLimit.Pen.Color := clFuchsia;
- FYAxis.LowLimit.AlarmColor := clFuchsia;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- destructor Tth2DGraph.Destroy;
- begin
- if Assigned(FYAxis) then FreeAndNil(FYAxis);
- if Assigned(FXAxis) then FreeAndNil(FXAxis);
- if Assigned(FTitleFont) then FreeAndNil(FTitleFont);
- if Assigned(FPlotPen) then FreeAndNil(FPlotPen);
- if Assigned(FPlotAreaGradient) then FreeAndNil(FPlotAreaGradient);
- if Assigned(FPlot) then FreeAndNil(FPlot);
- if Assigned(FGridPen) then FreeAndNil(FGridPen);
- if Assigned(FCurValFont) then FreeAndNil(FCurValFont);
- if Assigned(FBorderGradient) then FreeAndNil(FBorderGradient);
- if Assigned(FBorder) then FreeAndNil(FBorder);
- inherited Destroy;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.AddXY(X, Y: Extended);
- var Color: TColor;
- Layer: Integer;
- begin
- Layer := 1;
- Color := FPlotPen.Color;
- FLayerOptions := False;
- if FDataLength[Layer] = 1 then FClr := True;
- Inc(FDataLength[Layer]);
- SetLength(FDataArray[Layer], FDataLength[Layer]);
- FDataArray[Layer, FDataLength[Layer] - 1].X := X;
- FDataArray[Layer, FDataLength[Layer] - 1].Y := Y;
- FDataArray[Layer, FDataLength[Layer] - 1].C := Color;
- PlotData(X, Y, Color, Layer);
- if not FFreeze then Canvas.CopyRect(FRBorder, FBorder.Canvas, FRBorder);
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.AddXY(X, Y: Extended; Color: TColor; Layer: Integer = 1);
- begin
- if (Layer < 1) or (Layer > MAX_CURVES) then Exit;
- if FDatalength[Layer] = 1 then FClr := True;
- Inc(FDataLength[Layer]);
- SetLength(FDataArray[Layer], FDataLength[Layer]);
- FDataArray[Layer, FDataLength[Layer] - 1].X := X;
- FDataArray[Layer, FDataLength[Layer] - 1].Y := Y;
- FDataArray[Layer, FDataLength[Layer] - 1].C := Color;
- PlotData(X, Y, Color, Layer);
- if not FFreeze then Canvas.CopyRect(FRBorder, FBorder.Canvas, FRBorder);
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
- {
- procedure Tth2DGraph.AntiAlias;
- var n, cx, cy : Integer;
- Rows, Cols : Integer;
- totR, totG, totB: Integer;
- BigBMP, OutBMP : TBitmap;
- Row1, Row2, Row3: PrgbArray;
- DestRow : PrgbArray;
- Width, Height : Integer;
- Rect : TRect;
- begin
- Width := FBorder.Width;
- Height := FBorder.Height;
- BigBMP := TBitmap.Create;
- try
- BigBMP.Width := 3 * Width;
- BigBMP.Height := 3 * Height;
- // BigBMP.PixelFormat := pf32bit;
- Rect.TopLeft := Point(0, 0);
- Rect.BottomRight := Point(FBorder.Width, FBorder.Height);
- BigBMP.Canvas.CopyRect(Rect, FBorder.Canvas, FRBorder);
- OutBMP := TBitmap.Create;
- try
- OutBMP.Width := Width;
- OutBMP.Height := Height;
- // OutBMP.PixelFormat := pf32bit;
- // for all rows
- for Rows := 0 to Height - 1 do begin
- cy := 3 * Rows;
- Row1 := BigBMP.ScanLine[cy];
- Row2 := BigBMP.ScanLine[cy + 1];
- Row3 := BigBMP.ScanLine[cy + 2];
- DestRow := OutBMP.ScanLine[Rows];
- // for all cols
- for Cols := 0 to Width - 1 do begin
- cx := 3 * Cols;
- totR := 0; totG := 0; totB := 0;
- // for all pixels i sample
- for n := 0 to 2 do begin
- totR := totR + Row1[cx + n].RGBtRed + Row2[cx + n].RGBtRed + Row3[cx + n].RGBtRed;
- totG := totG + Row1[cx + n].RGBtGreen + Row2[cx + n].RGBtGreen + Row3[cx + n].RGBtGreen;
- totB := totB + Row1[cx + n].RGBtBlue + Row2[cx + n].RGBtBlue + Row3[cx + n].RGBtBlue;
- end;
- DestRow[Cols].RGBtRed := totR div 9;
- DestRow[Cols].RGBtGreen := totG div 9;
- DestRow[Cols].RGBtBlue := totB div 9;
- DestRow[Cols].RGBtAny := $00;
- end;
- end;
- FBorder.Canvas.CopyRect(FRBorder, OutBMP.Canvas, Rect);
- FPlot.Canvas.CopyRect(FRBorder, OutBMP.Canvas, Rect);
- finally
- OutBMP.Free;
- end;
- finally
- BigBMP.Free;
- end;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.AutoScale(Layer: Integer = 1);
- var tmpMaxX, tmpMinX: Extended;
- tmpMaxY, tmpMinY: Extended;
- X, Y : Extended;
- n : Integer;
- begin
- if (Layer < 1) or (Layer > MAX_CURVES) then Exit;
- if FDataLength[Layer] > 2 then begin
- tmpMaxX := FDataArray[Layer, 1].X;
- tmpMaxY := FDataArray[Layer, 1].Y;
- tmpMinX := tmpMaxX;
- tmpMinY := tmpMaxY;
- for n := 2 to FDataLength[Layer] - 1 do begin
- X := FDataArray[Layer, n].X;
- Y := FDataArray[Layer, n].Y;
- if X > tmpMaxX then tmpMaxX := X;
- if X < tmpMinX then tmpMinX := X;
- if Y > tmpMaxY then tmpMaxY := Y;
- if Y < tmpMinY then tmpMinY := Y;
- end;
- if tmpMaxX <= tmpMinX then begin
- if FXAxis.Divisions > 1 then
- if tmpMinX <> 0 then begin
- tmpMaxX := tmpMinX + Abs(tmpMinX) * (FXAxis.Divisions - 1);
- tmpMinX := tmpMinX - Abs(tmpMinX);
- end
- else begin
- tmpMaxX := FXAxis.Divisions - 1;
- tmpMinX := - 1;
- end
- else
- if tmpMinX <> 0 then tmpMaxX := tmpMinX + Abs(tmpMinX)
- else tmpMaxX := 1;
- end;
- if tmpMaxY <= tmpMinY then begin
- if FYAxis.Divisions > 1 then
- if tmpMinY <> 0 then begin
- tmpMaxY := tmpMinY + Abs(tmpMinY) * (FYAxis.Divisions - 1);
- tmpMinY := tmpMinY - Abs(tmpMinY);
- end
- else begin
- tmpMaxY := FYAxis.Divisions - 1;
- FYAxis.Min := - 1;
- end
- else
- if tmpMinY <> 0 then tmpMaxY := tmpMinY + Abs(tmpMinY)
- else tmpMaxY := 1;
- end;
- if tmpMaxX <> FXAxis.Max then FXAxis.Max := tmpMaxX;
- if tmpMinX <> FXAxis.Min then FXAxis.Min := tmpMinX;
- if tmpMaxY <> FYAxis.Max then FYAxis.Max := tmpMaxY;
- if tmpMinY <> FYAxis.Min then FYAxis.Min := tmpMinY;
- end;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.Clear;
- var n: Integer;
- begin
- FClr := True;
- for n := 1 to MAX_CURVES do begin
- FDataLength[n] := 1;
- FDataArray[n] := Copy(FDataArray[n], 0, 1);
- SetLength(FDataArray[n], 1);
- end;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- function Tth2DGraph.ConvertS2W(X, Y: Integer; var WX, WY: Extended): Boolean;
- begin
- Result := True;
- X := X - FRPlot.Left;
- Y := FRPlot.Bottom-1 - Y;
- WX := FXAxis.Min + X / Xqnt;
- WY := FYAxis.Min + Y / Yqnt;
- if WX < FXAxis.Min then Result := False;
- if WX > FXAxis.Max then Result := False;
- if WY < FYAxis.Min then Result := False;
- if WY > FYAxis.Max then Result := False;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.Freeze(Value: Boolean);
- begin
- if FFreeze = Value then Exit;
- FFreeze := Value;
- if not Value then begin
- FBorder.Canvas.CopyRect(FRPlot, FPlot.Canvas, FRPlot);
- Canvas.CopyRect(FRBorder, FBorder.Canvas, FRBorder);
- end;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.HideLayer(Layer: Integer);
- begin
- if (Layer < 1) or (Layer > MAX_CURVES) then Exit;
- FDataLength[Layer] := 1;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.LayerOptions(Layer: Integer; PlotMode: TPlotMode; PenWidth: Integer);
- begin
- if (Layer < 1) or (Layer > MAX_CURVES) then Exit;
- FLayerOptions := True;
- FLayerOpt[Layer].PlotMode := Plotmode;
- FLayerOpt[Layer].PenWidth := PenWidth;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.Paint;
- begin
- if XAxis.Orientation <> orHorizontal then XAxis.Orientation := orHorizontal;
- if YAxis.Orientation <> orVertical then YAxis.Orientation := orVertical;
- inherited Paint;
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- procedure Tth2DGraph.UnHideLayer(Layer: Integer);
- begin
- if (Layer < 1) or (Layer > MAX_CURVES) then Exit;
- FDataLength[Layer] := Length(FDataArray[Layer]);
- Redraw;
- end;
- {MWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMW}
-
- end.
-
-
-
-
-
-