📄 iplotlegend.pas
字号:
{*******************************************************}
{ }
{ TiPlotLegend }
{ }
{ Copyright (c) 1997,2003 Iocomp Software }
{ }
{*******************************************************}
{$I iInclude.inc}
{$ifdef iVCL}unit iPlotLegend;{$endif}
{$ifdef iCLX}unit QiPlotLegend;{$endif}
interface
uses
{$I iIncludeUses.inc}
{$IFDEF iVCL} Menus, iTypes, iGPFunctions, iPlotObjects, iPlotChannelCustom;{$ENDIF}
{$IFDEF iCLX}QMenus, QiTypes, QiGPFunctions, QiPlotObjects, QiPlotChannelCustom;{$ENDIF}
type
TiPlotLegendChannelNameColorStyle = (iplcncsFont, iplcncsChannelColor, iplcncsXAxisFontColor, iplcncsYAxisFontColor);
TiPlotLegendButton = class(TiPlotButton)
public
procedure Draw(const Canvas: TCanvas; const BackGroundColor: TColor); override;
end;
TiPlotLegendItem = class(TObject)
public
Channel : TiPlotChannelCustom;
MaxHeight : Integer;
ALeft : Integer;
ATop : Integer;
ARow : Integer;
ACol : Integer;
end;
TiPlotLegend = class(TiPlotLayoutObject)
private
FUpButton : TiPlotLegendButton;
FDownButton : TiPlotLegendButton;
FRequiredWidth : Integer;
FRequiredHeight : Integer;
FInnerRect : TRect;
FItemList : TStringList;
FColumnList : TStringList;
FColumnWidth : Integer;
FItemWidth : Integer;
FActualWrapColCount : Integer;
FActualWrapRowCount : Integer;
FColumnSpacingPixels : Integer;
FRowSpacingPixels : Integer;
FWrapSpacingPixels : Integer;
FColumnStartChannel : Integer;
FColumnStartLine : Integer;
FColumnStartMarker : Integer;
FColumnStartXName : Integer;
FColumnStartYName : Integer;
FColumnStartXValue : Integer;
FColumnStartYValue : Integer;
FColumnStartYMax : Integer;
FColumnStartYMin : Integer;
FColumnStartYMean : Integer;
FMaxWidthLine : Integer;
FMaxWidthMarker : Integer;
FMaxWidthChannelLabel : Integer;
FMaxWidthXName : Integer;
FMaxWidthYName : Integer;
FMaxWidthXValue : Integer;
FMaxWidthYValue : Integer;
FMaxWidthYMax : Integer;
FMaxWidthYMin : Integer;
FMaxWidthYMean : Integer;
FItemViewStartIndex : Integer;
FItemViewStopIndex : Integer;
FItemHeight : Integer;
FMaxItemHeight : Integer;
FColumnTitlesHeightPixels : Integer;
FColumnTitlesMarginPixels : Integer;
FColumnTitlesRect : TRect;
FItemsRect : TRect;
FMarginLeft : Double;
FMarginRight : Double;
FMarginBottom : Double;
FMarginTop : Double;
FBackGroundTransparent : Boolean;
FBackGroundColor : TColor;
FColumnSpacing : Double;
FFont : TFont;
FSelectedItemBackGroundColor : TColor;
FSelectedItemFont : TFont;
FShowColumnLine : Boolean;
FShowColumnMarker : Boolean;
FShowColumnXName : Boolean;
FShowColumnYName : Boolean;
FShowColumnXValue : Boolean;
FShowColumnYValue : Boolean;
FColumnTitlesVisible : Boolean;
FColumnTitlesFont : TFont;
FChannelNameMaxWidth : Double;
FChannelNameColorStyle : TiPlotLegendChannelNameColorStyle;
FShowColumnYMax : Boolean;
FShowColumnYMin : Boolean;
FShowColumnYMean : Boolean;
FCursorAllChannels : Boolean;
FShowColumnXValue2 : Boolean;
FShowColumnYValue2 : Boolean;
FCaptionColumnYMax : String;
FCaptionColumnYValue : String;
FCaptionColumnTitle : String;
FCaptionColumnYMean : String;
FCaptionColumnXName : String;
FCaptionColumnYName : String;
FCaptionColumnXValue : String;
FCaptionColumnYMin : String;
FWrapColDesiredCount : Integer;
FWrapRowDesiredCount : Integer;
FWrapColAutoCountEnabled : Boolean;
FWrapRowAutoCountEnabled : Boolean;
FWrapRowAutoCountMax : Integer;
FWrapColAutoCountMax : Integer;
FWrapColSpacingMin : Double;
FWrapRowSpacingMin : Double;
FWrapRowSpacingAuto : Boolean;
FWrapColSpacingAuto : Boolean;
protected
procedure SetMarginBottom (const Value: Double);
procedure SetMarginLeft (const Value: Double);
procedure SetMarginRight (const Value: Double);
procedure SetMarginTop (const Value: Double);
procedure SetBackGroundColor (const Value: TColor);
procedure SetBackGroundTransparent (const Value: Boolean);
procedure SetFont (const Value: TFont);
procedure SetSelectedItemBackGroundColor(const Value: TColor);
procedure SetSelectedItemFont (const Value: TFont);
procedure SetShowColumnLine (const Value: Boolean);
procedure SetShowColumnMarker (const Value: Boolean);
procedure SetShowColumnXAxisTitle (const Value: Boolean);
procedure SetShowColumnYAxisTitle (const Value: Boolean);
procedure SetShowColumnXValue (const Value: Boolean);
procedure SetShowColumnYValue (const Value: Boolean);
procedure SetShowColumnYMax (const Value: Boolean);
procedure SetShowColumnYMean (const Value: Boolean);
procedure SetShowColumnYMin (const Value: Boolean);
procedure SetColumnSpacing (const Value: Double);
procedure SetColumnTitlesFont (const Value: TFont);
procedure SetColumnTitlesVisible (const Value: Boolean);
procedure SetChannelNameMaxWidth (const Value: Double);
procedure SetChannelNameColorStyle (const Value: TiPlotLegendChannelNameColorStyle);
procedure SetWrapColDesiredCount (const Value: Integer);
procedure SetWrapRowDesiredCount (const Value: Integer);
procedure SetWrapColAutoCountEnabled (const Value: Boolean);
procedure SetWrapRowAutoCountEnabled (const Value: Boolean);
procedure SetWrapColAutoCountMax (const Value: Integer);
procedure SetWrapRowAutoCountMax (const Value: Integer);
procedure SetWrapColSpacingMin (const Value: Double);
procedure SetWrapRowSpacingMin (const Value: Double);
procedure SetWrapColSpacingAuto (const Value: Boolean);
procedure SetWrapRowSpacingAuto (const Value: Boolean);
procedure SetCaptionColumnTitle (const Value: String);
procedure SetCaptionColumnXAxisTitle (const Value: String);
procedure SetCaptionColumnXValue (const Value: String);
procedure SetCaptionColumnYAxisTitle (const Value: String);
procedure SetCaptionColumnYMax (const Value: String);
procedure SetCaptionColumnYMean (const Value: String);
procedure SetCaptionColumnYMin (const Value: String);
procedure SetCaptionColumnYValue (const Value: String);
procedure CalcRects (Canvas : TCanvas);
procedure CalcColumnChannelName(Canvas: TCanvas);
procedure CalcColumnTitles (Canvas: TCanvas);
procedure ButtonInvalidate(Sender : TObject);
procedure UpButtonClick (Sender : TObject);
procedure DownButtonClick (Sender : TObject);
procedure ClearItemList;
procedure NotificationSetFocus(Sender: TObject); override;
function GetMouseObject(X, Y: Integer): TiPlotObject; override;
procedure AddMenuItems(PopupMenu: TPopUpMenu); override;
procedure DoMouseUp (MouseData: TiPlotMouseData); override;
function GetRequiredWidth(const Canvas: TCanvas): Integer; override;
procedure GetNewMax(Value: Integer; var Max: Integer);
procedure Draw (const Canvas: TCanvas; const BackGroundColor: TColor); override;
procedure DrawLine (const Canvas: TCanvas; X, Y : Integer; AColor : TColor; LineStyle : TiPlotLineStyle);
procedure DrawColumnTitles(const Canvas: TCanvas);
procedure DrawDownButton (const Canvas: TCanvas);
procedure DrawUpButton (const Canvas: TCanvas);
function GetXAxisNameText (iChannel: TiPlotChannelCustom): String;
function GetYAxisNameText (iChannel: TiPlotChannelCustom): String;
function GetXAxisValueText(iChannel: TiPlotChannelCustom): String;
function GetYAxisValueText(iChannel: TiPlotChannelCustom): String;
function GetYAxisMaxText (iChannel: TiPlotChannelCustom): String;
function GetYAxisMeanText (iChannel: TiPlotChannelCustom): String;
function GetYAxisMinText (iChannel: TiPlotChannelCustom): String;
property CursorAllChannels : Boolean read FCursorAllChannels write FCursorAllChannels;
public
constructor Create(AOwner: TObject; AOnChange, AOnInsert, AOnRemove, AOnRename: TNotifyEvent); override;
destructor Destroy; override;
property ViewStartIndex : Integer read FItemViewStartIndex;
property ViewStopIndex : Integer read FItemViewStopIndex;
published
property MarginLeft : Double read FMarginLeft write SetMarginLeft;
property MarginTop : Double read FMarginTop write SetMarginTop;
property MarginRight : Double read FMarginRight write SetMarginRight;
property MarginBottom : Double read FMarginBottom write SetMarginBottom;
property BackGroundColor : TColor read FBackGroundColor write SetBackGroundColor default clGray;
property BackGroundTransparent : Boolean read FBackGroundTransparent write SetBackGroundTransparent default True;
property SelectedItemBackGroundColor : TColor read FSelectedItemBackGroundColor write SetSelectedItemBackGroundColor default clYellow;
property SelectedItemFont : TFont read FSelectedItemFont write SetSelectedItemFont;
property ShowColumnLine : Boolean read FShowColumnLine write SetShowColumnLine default True;
property ShowColumnMarker : Boolean read FShowColumnMarker write SetShowColumnMarker default False;
property ShowColumnXAxisTitle : Boolean read FShowColumnXName write SetShowColumnXAxisTitle default False;
property ShowColumnYAxisTitle : Boolean read FShowColumnYName write SetShowColumnYAxisTitle default False;
property ShowColumnXValue : Boolean read FShowColumnXValue write SetShowColumnXValue default False;
property ShowColumnYValue : Boolean read FShowColumnYValue write SetShowColumnYValue default False;
property ShowColumnYMax : Boolean read FShowColumnYMax write SetShowColumnYMax default False;
property ShowColumnYMin : Boolean read FShowColumnYMin write SetShowColumnYMin default False;
property ShowColumnYMean : Boolean read FShowColumnYMean write SetShowColumnYMean default False;
property CaptionColumnTitle : String read FCaptionColumnTitle write SetCaptionColumnTitle;
property CaptionColumnXAxisTitle : String read FCaptionColumnXName write SetCaptionColumnXAxisTitle;
property CaptionColumnYAxisTitle : String read FCaptionColumnYName write SetCaptionColumnYAxisTitle;
property CaptionColumnXValue : String read FCaptionColumnXValue write SetCaptionColumnXValue;
property CaptionColumnYValue : String read FCaptionColumnYValue write SetCaptionColumnYValue;
property CaptionColumnYMax : String read FCaptionColumnYMax write SetCaptionColumnYMax;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -