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

📄 iplotaxis.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{*******************************************************}
{                                                       }
{       TiPlotAxis                                      }
{                                                       }
{       Copyright (c) 1997,2003 Iocomp Software         }
{                                                       }
{*******************************************************}
{$I iInclude.inc}

{$ifdef iVCL}unit  iPlotAxis;{$endif}
{$ifdef iCLX}unit QiPlotAxis;{$endif}

interface

uses
  {$I iIncludeUses.inc}
  {$IFDEF iVCL} Menus,  iDateUtils,  iTypes,  iGPFunctions,  iMath,  iPlotObjects;{$ENDIF}
  {$IFDEF iCLX}QMenus, QiDateUtils, QiTypes, QiGPFunctions, QiMath, QiPlotObjects;{$ENDIF}

const
  TIME_HOUR        = 1/24;
  TIME_MINUTE      = TIME_HOUR/60;
  TIME_SECOND      = TIME_MINUTE/60;
  TIME_MILLISECOND = TIME_SECOND/1000;

type
  TiPlotAxis = class;

  TiQuadSide            = (iqsLeft, iqsRight, iqsTop, iqsBottom);
  TiPlotTrackingStyle   = (iptsScaleMinMax, iptsScaleMax, iptsScaleMin, iptsScrollSmooth, iptsScrollPage, iptsExpandCollapse, iptsExpandCollapseFast);
  TiPlotAlignFirstStyle = (ipafsMin, ipafsMax, ipafsAuto, ipafsNone);
  TiPlotScaleType       = (ipstLinear, ipstLog10);
  TiPlotTextFormat      = (iptfValue, iptfExponent, iptfPrefix, iptfDateTime, iptfPrice32nds, iptfThousands);
  TiPlotAxisMode        = (ipamScroll, ipamZoom);
  TiPlotTickType        = (ipttMajor, ipttMinor);
  TiPlotGridLineStyle   = (ipglsSolid, ipglsDash, ipglsDot);
  TiPlotCartesianStyle  = (ipcsNone, ipcsMaster, ipcsChild);

  TiPlotTickObject = class(TObject)
  public
    TickType       : TiPlotTickType;
    Position       : Double;
    PositionPixels : Integer;
    Text           : String;
    Show           : Boolean;
  end;

  TiPlotAxis = class(TiPlotLayoutObject)
  private
    FActualStart                   : Integer;
    FActualStop                    : Integer;
    FPixelsPerSpanUnit             : Double;

    FCartesianRefAxis              : TiPlotAxis;
    FAlignRefAxis                  : TiPlotAxis;

    FBlockMinSpanEvent             : Boolean;

    FTickList                      : TStringList;
    FQuadSide                      : TiQuadSide;
    FMouseDown                     : Boolean;
    FMouseDownX                    : Integer;
    FMouseDownY                    : Integer;
    FFirstAlignDone                : Boolean;
    FScaleRect                     : TRect;
    FFocusRect                     : TRect;
    FRequiredWidth                 : Integer;
    FTitleOffset                   : Integer;

    FPreviousMin                   : Double;
    FPreviousSpan                  : Double;
    FPreviousLabelsMinLength       : Double;

    FAllowLabelMinAdjust           : Boolean;

    FSpan                          : Double;
    FMin                           : Double;
    FReverseScale                  : Boolean;

    FInnerMargin                   : Integer;
    FOuterMargin                   : Integer;
    FStackingEndsMargin            : Double;

    FMinorLength                   : Integer;
    FMajorLength                   : Integer;
    FMinorCount                    : Integer;

    FLabelsVisible                 : Boolean;
    FLabelsMargin                  : Double;
    FLabelsPrecision               : Integer;
    FLabelsPrecisionStyle          : TiPrecisionStyle;
    FLabelsFont                    : TFont;
    FLabelsMinLength               : Double;
    FLabelsMinLengthAutoAdjust     : Boolean;
    FLabelSeparation               : Double;

    FTitleMargin                   : Double;
    FTitleFont                     : TFont;
    FTitleShow                     : Boolean;
    FTitle                         : String;
    FTitleRotated                  : Boolean;

    FScaleLineShow                 : Boolean;
    FScaleLinesColor               : TColor;

    FTrackingEnabled               : Boolean;
    FTrackingStyle                 : TiPlotTrackingStyle;
    FTrackingScrollCompressMax     : Double;
    FTrackingAlignFirstStyle       : TiPlotAlignFirstStyle;
    FScaleType                     : TiPlotScaleType;
    FDateTimeFormat                : String;
    FLabelsFormatStyle             : TiPlotTextFormat;
    FMode                          : TiPlotAxisMode;
    FDesiredIncrement              : Double;
    FCursorScaler                  : Double;
    FRestoreValuesOnResume         : Boolean;
    FScrollMin                     : Double;
    FScrollMax                     : Double;
    FScrollMinMaxEnabled           : Boolean;
    FMasterUIInput                 : Boolean;
    FDesiredStart                  : Double;
    FMonthModeEnabled              : Boolean;
    FYearModeEnabled               : Boolean;

    FCartesianStyle                : TiPlotCartesianStyle;
    FCartesianChildRefValue        : Double;
    FCartesianChildRefAxisName     : String;
    FGridLinesVisible              : Boolean;
    FScaleLinesShow                : Boolean;

    FCursorUseDefaultFormat        : Boolean;
    FCursorDateTimeFormat          : String;
    FCursorFormatStyle             : TiPlotTextFormat;
    FCursorPrecisionStyle          : TiPrecisionStyle;
    FCursorPrecision               : Integer;
    FCursorMinLengthAutoAdjust     : Boolean;
    FCursorMinLength               : Double;

    FLegendUseDefaultFormat        : Boolean;
    FLegendFormatStyle             : TiPlotTextFormat;
    FLegendDateTimeFormat          : String;
    FLegendPrecisionStyle          : TiPrecisionStyle;
    FLegendPrecision               : Integer;
    FLegendMinLength               : Double;
    FLegendMinLengthAutoAdjust     : Boolean;
    FTickListCustom                : Boolean;
    FAlignRefAxisName              : String;
    FLabelsRotation                : TiRotationAngle;

    function GetMax : Double;

    procedure SetSpan                     (const Value: Double);
    procedure SetMin                      (const Value: Double);
    procedure SetReverseScale             (const Value: Boolean);

    procedure SetInnerMargin              (const Value: Integer);
    procedure SetOuterMargin              (const Value: Integer);
    procedure SetStackingEndsMargin       (const Value: Double);

    procedure SetLabelsVisible            (const Value: Boolean);
    procedure SetLabelsPrecisionStyle     (const Value: TiPrecisionStyle);
    procedure SetLabelsFont               (const Value: TFont);
    procedure SetLabelsMargin             (const Value: Double);
    procedure SetLabelsPrecision          (const Value: Integer);
    procedure SetLabelsMinLength          (const Value: Double);
    procedure SetLabelsMinLengthAutoAdjust(const Value: Boolean);
    procedure SetLabelsFormatStyle        (const Value: TiPlotTextFormat);
    procedure SetLabelsRotation           (const Value: TiRotationAngle);

    procedure SetMajorLength              (const Value: Integer);
    procedure SetMinorLength              (const Value: Integer);
    procedure SetMinorCount               (const Value: Integer);

    procedure SetTitleFont                (const Value: TFont);
    procedure SetTitleMargin              (const Value: Double);
    procedure SetTitleShow                (const Value: Boolean);
    procedure SetTitle                    (const Value: String);
    procedure SetTitleRotated             (const Value: Boolean);

    procedure SetScaleLineShow            (const Value: Boolean);
    procedure SetScaleLinesShow           (const Value: Boolean);
    procedure SetLabelSeparation          (const Value: Double);
    procedure SetScaleLinesColor          (const Value: TColor);

    procedure SetTrackingEnabled          (const Value: Boolean);
    procedure SetTrackingStyle            (const Value: TiPlotTrackingStyle);
    procedure SetTrackingScrollCompressMax(const Value: Double);
    procedure SetTrackingAlignFirstStyle  (const Value: TiPlotAlignFirstStyle);
    procedure SetScaleType                (const Value: TiPlotScaleType);
    procedure SetDateTimeFormat           (const Value: String);
    procedure SetMode                     (const Value: TiPlotAxisMode);
    procedure SetDesiredIncrement         (const Value: Double);
    procedure SetCursorScaler             (const Value: Double);
    procedure SetRestoreValuesOnResume    (const Value: Boolean);
    procedure SetScrollMax                (const Value: Double);
    procedure SetScrollMin                (const Value: Double);
    procedure SetScrollMinMaxEnabled      (const Value: Boolean);
    procedure SetMasterUIInput            (const Value: Boolean);
    procedure SetDesiredStart             (const Value: Double);
    procedure SetCartesianStyle           (const Value: TiPlotCartesianStyle);
    procedure SetCartesianChildRefAxisName(const Value: String);
    procedure SetCartesianChildRefValue   (const Value: Double);
    procedure SetAlignRefAxisName         (const Value: String);
    procedure SetGridLinesVisible         (const Value: Boolean);

    procedure SetCursorDateTimeFormat     (const Value: String);
    procedure SetCursorFormatStyle        (const Value: TiPlotTextFormat);
    procedure SetCursorPrecisionStyle     (const Value: TiPrecisionStyle);
    procedure SetCursorPrecision          (const Value: Integer);
    procedure SetCursorUseDefaultFormat   (const Value: Boolean);
    procedure SetCursorMinLength          (const Value: Double);
    procedure SetCursorMinLengthAutoAdjust(const Value: Boolean);

    procedure SetLegendUseDefaultFormat   (const Value: Boolean);
    procedure SetLegendFormatStyle        (const Value: TiPlotTextFormat);
    procedure SetLegendDateTimeFormat     (const Value: String);
    procedure SetLegendPrecisionStyle     (const Value: TiPrecisionStyle);
    procedure SetLegendPrecision          (const Value: Integer);
    procedure SetLegendMinLength          (const Value: Double);
    procedure SetLegendMinLengthAutoAdjust(const Value: Boolean);

    procedure SetTickListCustom           (const Value: Boolean);

    function GetMinPixels                 : Integer;
    function GetMaxPixels                 : Integer;
    function GetTickListCount             : Integer;

    function GetTickObject(Index: Integer): TiPlotTickObject;

    function GetCartesianRefAxis          : TiPlotAxis;
    function GetAlignRefAxis              : TiPlotAxis;

    function TickDiv(Count, Divisor: Integer): Integer;

    function  GetLabelTextAdjust(const Value  : Double): String;

    function GetTickListItemLabel   (Index: Integer): String;
    function GetTickListItemPosition(Index: Integer): Double;
    function GetTickListItemStyle   (Index: Integer): TiPlotTickType;

    procedure SetTickListItemLabel   (Index: Integer; const Value: String);
    procedure SetTickListItemPosition(Index: Integer; const Value: Double);
    procedure SetTickListItemStyle   (Index: Integer; const Value: TiPlotTickType);
  protected
    procedure DefineProperties    (Filer : TFiler);               override;

⌨️ 快捷键说明

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