mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 09:39:37 +01:00
plotpanel: Add properties for linewidth control (issue #32648) and background color control.
git-svn-id: trunk@56326 -
This commit is contained in:
parent
cee38e2b1b
commit
8a2289c220
@ -72,12 +72,16 @@ Type
|
|||||||
Published
|
Published
|
||||||
Property Expression : String Read GetExpression Write SetExpression;
|
Property Expression : String Read GetExpression Write SetExpression;
|
||||||
Property Identifiers : TFPExprIdentifierDefs Read GetIdentifiers Write SetIdentifiers;
|
Property Identifiers : TFPExprIdentifierDefs Read GetIdentifiers Write SetIdentifiers;
|
||||||
Property Anchors;
|
Property Active;
|
||||||
Property Align;
|
Property Align;
|
||||||
|
Property Anchors;
|
||||||
|
Property BackgroundColor;
|
||||||
|
Property BorderSpacing;
|
||||||
|
Property Color;
|
||||||
|
Property PlotColor;
|
||||||
|
property PlotLinewidth;
|
||||||
Property XAxis;
|
Property XAxis;
|
||||||
Property YAxis;
|
Property YAxis;
|
||||||
Property Active;
|
|
||||||
Property PlotColor;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|||||||
@ -54,6 +54,7 @@ Const
|
|||||||
DefGridInterval = 1;
|
DefGridInterval = 1;
|
||||||
DefGridColor = clSilver;
|
DefGridColor = clSilver;
|
||||||
DefPlotColor = clRed;
|
DefPlotColor = clRed;
|
||||||
|
DefLineWidth = 1;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TPlotFloat = Double;
|
TPlotFloat = Double;
|
||||||
@ -88,6 +89,7 @@ Type
|
|||||||
private
|
private
|
||||||
FDrawZero: Boolean;
|
FDrawZero: Boolean;
|
||||||
FGridColor: TColor;
|
FGridColor: TColor;
|
||||||
|
FGridLinewidth: Integer;
|
||||||
FGridInterval: Integer;
|
FGridInterval: Integer;
|
||||||
FInterval: TPlotFloat;
|
FInterval: TPlotFloat;
|
||||||
FCaption: TPlotCaption;
|
FCaption: TPlotCaption;
|
||||||
@ -96,20 +98,27 @@ Type
|
|||||||
FOrigin: TPlotFloat;
|
FOrigin: TPlotFloat;
|
||||||
FPlotter : TCanvasPlotter;
|
FPlotter : TCanvasPlotter;
|
||||||
FColor: TColor;
|
FColor: TColor;
|
||||||
|
FLinewidth: Integer;
|
||||||
FTickColor: TColor;
|
FTickColor: TColor;
|
||||||
FTickFont: TFont;
|
FTickFont: TFont;
|
||||||
FTickMode: TTickMode;
|
FTickMode: TTickMode;
|
||||||
FTicks: Integer;
|
FTicks: Integer;
|
||||||
FTickSize: integer;
|
FTickSize: integer;
|
||||||
|
FTickLinewidth: Integer;
|
||||||
procedure SetAxisColor(const AValue: TColor);
|
procedure SetAxisColor(const AValue: TColor);
|
||||||
|
procedure SetLinewidth(const AValue: Integer);
|
||||||
procedure SetDrawZero(const AValue: Boolean);
|
procedure SetDrawZero(const AValue: Boolean);
|
||||||
procedure SetInterval(const AValue: TPlotFloat);
|
procedure SetInterval(const AValue: TPlotFloat);
|
||||||
procedure SetCaption(const AValue: TPlotCaption);
|
procedure SetCaption(const AValue: TPlotCaption);
|
||||||
|
procedure SetGridColor(const AValue: TColor);
|
||||||
|
procedure SetGridInterval(const AValue: Integer);
|
||||||
|
procedure SetGridLinewidth(const AValue: Integer);
|
||||||
procedure SetLegendInterval(const AValue: Integer);
|
procedure SetLegendInterval(const AValue: Integer);
|
||||||
procedure SetLegendFormat(const AValue: String);
|
procedure SetLegendFormat(const AValue: String);
|
||||||
procedure SetOrigin(const AValue: TPlotFloat);
|
procedure SetOrigin(const AValue: TPlotFloat);
|
||||||
procedure SetTickColor(const AValue: TColor);
|
procedure SetTickColor(const AValue: TColor);
|
||||||
procedure SetTickFont(const AValue: TFont);
|
procedure SetTickFont(const AValue: TFont);
|
||||||
|
procedure SetTickLinewidth(const AValue: Integer);
|
||||||
procedure SetTickMode(const AValue: TTickMode);
|
procedure SetTickMode(const AValue: TTickMode);
|
||||||
procedure SetTicks(const AValue: Integer);
|
procedure SetTicks(const AValue: Integer);
|
||||||
procedure SetTickSize(const AValue: integer);
|
procedure SetTickSize(const AValue: integer);
|
||||||
@ -126,6 +135,8 @@ Type
|
|||||||
Constructor Create;virtual;
|
Constructor Create;virtual;
|
||||||
Destructor Destroy; override;
|
Destructor Destroy; override;
|
||||||
Published
|
Published
|
||||||
|
// Linewidth of axis line
|
||||||
|
Property LineWidth: Integer read FLineWidth write SetLineWidth default DefLineWidth;
|
||||||
// Graph color
|
// Graph color
|
||||||
Property Color : TColor Read FColor Write SetAxisColor default defAxisColor;
|
Property Color : TColor Read FColor Write SetAxisColor default defAxisColor;
|
||||||
// Color of ticks on axis
|
// Color of ticks on axis
|
||||||
@ -134,6 +145,8 @@ Type
|
|||||||
Property Ticks : Integer Read FTicks Write SetTicks;
|
Property Ticks : Integer Read FTicks Write SetTicks;
|
||||||
// Length of ticks on axis
|
// Length of ticks on axis
|
||||||
Property TickSize : integer Read FTickSize Write SetTickSize;
|
Property TickSize : integer Read FTickSize Write SetTickSize;
|
||||||
|
// Linewidth of ticks on axis
|
||||||
|
Property TickLinewidth: Integer read FTickLinewidth write SetTickLinewidth default DefLinewidth;
|
||||||
// Ticks is number of ticks or distance (in pixels) between ticks ?
|
// Ticks is number of ticks or distance (in pixels) between ticks ?
|
||||||
Property TickMode : TTickMode Read FTickMode Write SetTickMode;
|
Property TickMode : TTickMode Read FTickMode Write SetTickMode;
|
||||||
// Font for tick legend
|
// Font for tick legend
|
||||||
@ -151,9 +164,11 @@ Type
|
|||||||
// Format for legend (formatfloat);
|
// Format for legend (formatfloat);
|
||||||
Property LegendFormat : String Read FLegendFormat write SetLegendFormat;
|
Property LegendFormat : String Read FLegendFormat write SetLegendFormat;
|
||||||
// Interval (in ticks) of grid. 0 means no grid.
|
// Interval (in ticks) of grid. 0 means no grid.
|
||||||
Property GridInterval : Integer Read FGridInterval Write FGridInterval default DefGridInterval;
|
Property GridInterval : Integer Read FGridInterval Write SetGridInterval default DefGridInterval;
|
||||||
// Grid color.
|
// Grid color.
|
||||||
Property GridColor : TColor Read FGridColor Write FGridColor default DefGridColor;
|
Property GridColor : TColor Read FGridColor Write SetGridColor default DefGridColor;
|
||||||
|
// Grid linewidth
|
||||||
|
Property GridLinewidth: Integer Read FGridLinewidth Write SetGridLinewidth default DefLineWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPlotXAxis }
|
{ TPlotXAxis }
|
||||||
@ -208,7 +223,9 @@ Type
|
|||||||
FBackGroundColor: TColor;
|
FBackGroundColor: TColor;
|
||||||
FBoundsRect: TRect;
|
FBoundsRect: TRect;
|
||||||
FCaption: TPlotCaption;
|
FCaption: TPlotCaption;
|
||||||
|
FColor: TColor;
|
||||||
FPlotColor: TColor;
|
FPlotColor: TColor;
|
||||||
|
FPlotLineWidth: Integer;
|
||||||
FXaxis: TPlotXAxis;
|
FXaxis: TPlotXAxis;
|
||||||
FYaxis: TPlotYAxis;
|
FYaxis: TPlotYAxis;
|
||||||
FCanvas: TCanvas;
|
FCanvas: TCanvas;
|
||||||
@ -221,7 +238,9 @@ Type
|
|||||||
procedure SetBoundsRect(const AValue: TRect);
|
procedure SetBoundsRect(const AValue: TRect);
|
||||||
procedure SetCanvas(const AValue: TCanvas);
|
procedure SetCanvas(const AValue: TCanvas);
|
||||||
procedure SetCaption(const AValue: TPlotCaption);
|
procedure SetCaption(const AValue: TPlotCaption);
|
||||||
|
procedure SetColor(const AValue: TColor);
|
||||||
procedure SetPlotColor(const AValue: TColor);
|
procedure SetPlotColor(const AValue: TColor);
|
||||||
|
procedure SetPlotLineWidth(const AValue: Integer);
|
||||||
procedure SetXAxis(const AValue: TPlotXAxis);
|
procedure SetXAxis(const AValue: TPlotXAxis);
|
||||||
procedure SetYAxis(const AValue: TPlotYAxis);
|
procedure SetYAxis(const AValue: TPlotYAxis);
|
||||||
Protected
|
Protected
|
||||||
@ -243,7 +262,9 @@ Type
|
|||||||
Property XAxis : TPlotXAxis Read FXaxis Write SetXAxis;
|
Property XAxis : TPlotXAxis Read FXaxis Write SetXAxis;
|
||||||
Property YAxis : TPlotYAxis Read FYaxis Write SetYAxis;
|
Property YAxis : TPlotYAxis Read FYaxis Write SetYAxis;
|
||||||
Property BackgroundColor : TColor Read FBackGroundColor Write SetBackGroundColor;
|
Property BackgroundColor : TColor Read FBackGroundColor Write SetBackGroundColor;
|
||||||
|
Property Color: TColor Read FColor write SetColor;
|
||||||
Property PlotColor : TColor Read FPlotColor Write SetPlotColor;
|
Property PlotColor : TColor Read FPlotColor Write SetPlotColor;
|
||||||
|
Property PlotLinewidth: Integer read FPlotLineWidth Write SetPlotLineWidth;
|
||||||
Property Active : Boolean Read FActive Write SetActive;
|
Property Active : Boolean Read FActive Write SetActive;
|
||||||
Property Caption : TPlotCaption Read FCaption Write SetCaption;
|
Property Caption : TPlotCaption Read FCaption Write SetCaption;
|
||||||
end;
|
end;
|
||||||
@ -277,13 +298,18 @@ Type
|
|||||||
private
|
private
|
||||||
FPlotter: TCanvasPlotter;
|
FPlotter: TCanvasPlotter;
|
||||||
function GetActive: Boolean;
|
function GetActive: Boolean;
|
||||||
|
function GetBackgroundColor: TColor;
|
||||||
function GetCaption: TPlotCaption;
|
function GetCaption: TPlotCaption;
|
||||||
|
function GetColor: TColor;
|
||||||
function GetPlotColor: TColor;
|
function GetPlotColor: TColor;
|
||||||
|
function GetPlotLineWidth: Integer;
|
||||||
function GetXaxis: TPlotXAxis;
|
function GetXaxis: TPlotXAxis;
|
||||||
function GetYaxis: TPlotYAxis;
|
function GetYaxis: TPlotYAxis;
|
||||||
procedure SetActive(const AValue: Boolean);
|
procedure SetActive(const AValue: Boolean);
|
||||||
|
procedure SetBackgroundColor(const AValue: TColor);
|
||||||
procedure SetCaption(const AValue: TPlotCaption);
|
procedure SetCaption(const AValue: TPlotCaption);
|
||||||
procedure SetPlotColor(const AValue: TColor);
|
procedure SetPlotColor(const AValue: TColor);
|
||||||
|
procedure SetPlotLineWidth(const AValue: Integer);
|
||||||
procedure SetXAxis(const AValue: TPlotXAxis);
|
procedure SetXAxis(const AValue: TPlotXAxis);
|
||||||
procedure SetYAxis(const AValue: TPlotYAxis);
|
procedure SetYAxis(const AValue: TPlotYAxis);
|
||||||
Protected
|
Protected
|
||||||
@ -294,13 +320,15 @@ Type
|
|||||||
Public
|
Public
|
||||||
Constructor Create(AOwner : TComponent); override;
|
Constructor Create(AOwner : TComponent); override;
|
||||||
Destructor Destroy; override;
|
Destructor Destroy; override;
|
||||||
Property Anchors;
|
|
||||||
Property Align;
|
Property Align;
|
||||||
|
Property Active : Boolean Read GetActive Write SetActive;
|
||||||
|
Property BackgroundColor: TColor read GetBackgroundColor write SetBackgroundColor default clDefault;
|
||||||
|
Property Caption : TPlotCaption Read GetCaption Write SetCaption;
|
||||||
|
Property Color: TColor read GetColor write SetColor default clDefault;
|
||||||
|
Property PlotColor : TColor Read GetPlotColor Write SetPlotColor;
|
||||||
|
Property PlotLineWidth: Integer read GetPlotLinewidth Write SetPlotLinewidth default DefLinewidth;
|
||||||
Property XAxis : TPlotXAxis Read GetXaxis Write SetXAxis;
|
Property XAxis : TPlotXAxis Read GetXaxis Write SetXAxis;
|
||||||
Property YAxis : TPlotYAxis Read GetYaxis Write SetYAxis;
|
Property YAxis : TPlotYAxis Read GetYaxis Write SetYAxis;
|
||||||
Property Active : Boolean Read GetActive Write SetActive;
|
|
||||||
Property PlotColor : TColor Read GetPlotColor Write SetPlotColor;
|
|
||||||
Property Caption : TPlotCaption Read GetCaption Write SetCaption;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPlotFunctionPanel }
|
{ TPlotFunctionPanel }
|
||||||
@ -313,12 +341,16 @@ Type
|
|||||||
Function CreatePlotter : TCanvasPlotter; override;
|
Function CreatePlotter : TCanvasPlotter; override;
|
||||||
Published
|
Published
|
||||||
Property OnCalcPlot : TOnCalcPlotEvent Read GetOnCalcPlot Write SetOnCalcPlot;
|
Property OnCalcPlot : TOnCalcPlotEvent Read GetOnCalcPlot Write SetOnCalcPlot;
|
||||||
Property Anchors;
|
|
||||||
Property Align;
|
Property Align;
|
||||||
|
Property Anchors;
|
||||||
|
Property Active;
|
||||||
|
Property BackgroundColor;
|
||||||
|
Property BorderSpacing;
|
||||||
|
Property Color;
|
||||||
|
Property PlotColor;
|
||||||
|
property PlotLinewidth;
|
||||||
Property XAxis;
|
Property XAxis;
|
||||||
Property YAxis;
|
Property YAxis;
|
||||||
Property Active;
|
|
||||||
Property PlotColor;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
EPlotPanel = Class(Exception);
|
EPlotPanel = Class(Exception);
|
||||||
@ -351,16 +383,31 @@ begin
|
|||||||
Result:=FPlotter.Active;
|
Result:=FPlotter.Active;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomPlotFunctionPanel.GetBackgroundColor: TColor;
|
||||||
|
begin
|
||||||
|
Result := FPlotter.BackgroundColor;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomPlotFunctionPanel.GetCaption: TPlotCaption;
|
function TCustomPlotFunctionPanel.GetCaption: TPlotCaption;
|
||||||
begin
|
begin
|
||||||
Result:=FPlotter.Caption;
|
Result:=FPlotter.Caption;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomPlotFunctionPanel.GetColor: TColor;
|
||||||
|
begin
|
||||||
|
Result := FPlotter.Color;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomPlotFunctionPanel.GetPlotColor: TColor;
|
function TCustomPlotFunctionPanel.GetPlotColor: TColor;
|
||||||
begin
|
begin
|
||||||
Result:=FPlotter.PlotColor;
|
Result:=FPlotter.PlotColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomPlotFunctionPanel.GetPlotLinewidth: Integer;
|
||||||
|
begin
|
||||||
|
Result := FPlotter.PlotLinewidth;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomPlotFunctionPanel.GetXaxis: TPlotXAxis;
|
function TCustomPlotFunctionPanel.GetXaxis: TPlotXAxis;
|
||||||
begin
|
begin
|
||||||
Result:=FPlotter.XAxis;
|
Result:=FPlotter.XAxis;
|
||||||
@ -376,6 +423,11 @@ begin
|
|||||||
FPlotter.Active:=AValue;
|
FPlotter.Active:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomPlotFunctionPanel.SetBackgroundColor(const AValue: TColor);
|
||||||
|
begin
|
||||||
|
FPlotter.BackgroundColor := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomPlotFunctionPanel.SetCaption(const AValue: TPlotCaption);
|
procedure TCustomPlotFunctionPanel.SetCaption(const AValue: TPlotCaption);
|
||||||
begin
|
begin
|
||||||
FPlotter.Caption.Assign(AValue);
|
FPlotter.Caption.Assign(AValue);
|
||||||
@ -386,6 +438,11 @@ begin
|
|||||||
FPlotter.PlotColor:=AValue;
|
FPlotter.PlotColor:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomPlotFunctionPanel.SetPlotLineWidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
FPlotter.PlotLinewidth := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomPlotFunctionPanel.SetYAxis(const AValue: TPlotYAxis);
|
procedure TCustomPlotFunctionPanel.SetYAxis(const AValue: TPlotYAxis);
|
||||||
begin
|
begin
|
||||||
FPlotter.Yaxis.Assign(AValue);
|
FPlotter.Yaxis.Assign(AValue);
|
||||||
@ -402,7 +459,7 @@ procedure TCustomPlotFunctionPanel.SetColor(Value: TColor);
|
|||||||
begin
|
begin
|
||||||
inherited SetColor(Value);
|
inherited SetColor(Value);
|
||||||
If Assigned(FPlotter) then
|
If Assigned(FPlotter) then
|
||||||
FPLotter.BackgroundColor:=Value;
|
FPLotter.Color:=Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -434,6 +491,12 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPlotAxis.SetLinewidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FLinewidth = AValue then exit;
|
||||||
|
FLinewidth := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPlotAxis.SetDrawZero(const AValue: Boolean);
|
procedure TPlotAxis.SetDrawZero(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
@ -458,6 +521,27 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPlotAxis.SetGridColor(const AValue: TColor);
|
||||||
|
begin
|
||||||
|
if FGridColor=AValue then exit;
|
||||||
|
FGridColor := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPlotAxis.SetGridInterval(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FGridInterval = AValue then exit;
|
||||||
|
FGridInterval := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPlotAxis.SetGridLinewidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FGridLinewidth = AValue then exit;
|
||||||
|
FGridLinewidth := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPlotAxis.SetLegendInterval(const AValue: Integer);
|
procedure TPlotAxis.SetLegendInterval(const AValue: Integer);
|
||||||
begin
|
begin
|
||||||
if FLegendInterval=AValue then exit;
|
if FLegendInterval=AValue then exit;
|
||||||
@ -495,6 +579,13 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPlotAxis.SetTickLinewidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FTickLinewidth = AValue then exit;
|
||||||
|
FTickLinewidth := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPlotAxis.SetTickMode(const AValue: TTickMode);
|
procedure TPlotAxis.SetTickMode(const AValue: TTickMode);
|
||||||
begin
|
begin
|
||||||
if FTickMode=AValue then exit;
|
if FTickMode=AValue then exit;
|
||||||
@ -558,12 +649,15 @@ begin
|
|||||||
FCaption.FOnChange:=@DoCaptionChange;
|
FCaption.FOnChange:=@DoCaptionChange;
|
||||||
FCaption.Font.OnChange:= @DoCaptionChange;
|
FCaption.Font.OnChange:= @DoCaptionChange;
|
||||||
FColor:=DefAxisColor;
|
FColor:=DefAxisColor;
|
||||||
|
FLineWidth:= DefLineWidth;
|
||||||
FTickFont:=TFont.Create;
|
FTickFont:=TFont.Create;
|
||||||
FTickFont.OnChange := @DoCaptionChange;
|
FTickFont.OnChange := @DoCaptionChange;
|
||||||
|
FTickLinewidth := DefLinewidth;
|
||||||
FLegendInterval:=DefLegendInterval;
|
FLegendInterval:=DefLegendInterval;
|
||||||
FInterval:=DefInterval;
|
FInterval:=DefInterval;
|
||||||
FTickColor:=DefTickColor;
|
FTickColor:=DefTickColor;
|
||||||
FGridColor:=DefGridColor;
|
FGridColor:=DefGridColor;
|
||||||
|
FGridLinewidth:=DefLineWidth;
|
||||||
FGridInterval:=DefGridInterval;
|
FGridInterval:=DefGridInterval;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -696,6 +790,13 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCanvasPlotter.SetColor(const AValue: TColor);
|
||||||
|
begin
|
||||||
|
if FColor = AValue then exit;
|
||||||
|
FColor := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCanvasPlotter.SetPlotColor(const AValue: TColor);
|
procedure TCanvasPlotter.SetPlotColor(const AValue: TColor);
|
||||||
begin
|
begin
|
||||||
If (FPlotColor=AValue) then Exit;
|
If (FPlotColor=AValue) then Exit;
|
||||||
@ -703,6 +804,13 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCanvasPlotter.SetPlotLineWidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if (FPlotLinewidth=AValue) then exit;
|
||||||
|
FPlotLineWidth := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCanvasPlotter.SetXAxis(const AValue: TPlotXAxis);
|
procedure TCanvasPlotter.SetXAxis(const AValue: TPlotXAxis);
|
||||||
begin
|
begin
|
||||||
if FXaxis=AValue then exit;
|
if FXaxis=AValue then exit;
|
||||||
@ -737,7 +845,10 @@ begin
|
|||||||
FYAxis:=TPlotYAxis.Create;
|
FYAxis:=TPlotYAxis.Create;
|
||||||
FYAxis.FPlotter:=Self;
|
FYAxis.FPlotter:=Self;
|
||||||
FPlotColor:=DefPlotColor;
|
FPlotColor:=DefPlotColor;
|
||||||
|
FPlotLinewidth:=DefLinewidth;
|
||||||
FCaption:=TPlotCaption.Create;
|
FCaption:=TPlotCaption.Create;
|
||||||
|
FBackgroundColor := clDefault;
|
||||||
|
FColor := clDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCanvasPlotter.Destroy;
|
destructor TCanvasPlotter.Destroy;
|
||||||
@ -782,11 +893,20 @@ end;
|
|||||||
procedure TCanvasPlotter.DrawBackground(ACanvas: TCanvas);
|
procedure TCanvasPlotter.DrawBackground(ACanvas: TCanvas);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// self.ClientRect
|
// Color paints the entire diagram background
|
||||||
ACanvas.Brush.Color:=BackgroundColor;
|
ACanvas.Brush.Color:=Color;
|
||||||
ACanvas.Brush.Style:=bsSolid;
|
ACanvas.Brush.Style:=bsSolid;
|
||||||
ACanvas.FillRect(BoundsRect);
|
ACanvas.FillRect(BoundsRect);
|
||||||
// ACanvas.FillRect(0,0,ACanvas.Width,ACanvas.Height);
|
|
||||||
|
// Background color paints the background spanned by the axes
|
||||||
|
ACanvas.Brush.Color := BackgroundColor;
|
||||||
|
ACanvas.FillRect(
|
||||||
|
FXAxis.LeftMargin,
|
||||||
|
FYAxis.TopMargin,
|
||||||
|
BoundsRect.Width-FXAxis.RightMargin,
|
||||||
|
BoundsRect.Height-FYAxis.BottomMargin
|
||||||
|
);
|
||||||
|
|
||||||
DrawHAxis(ACanvas,FXAxis,FYAxis);
|
DrawHAxis(ACanvas,FXAxis,FYAxis);
|
||||||
DrawVAxis(ACanvas,FYAxis,FXAxis);
|
DrawVAxis(ACanvas,FYAxis,FXAxis);
|
||||||
end;
|
end;
|
||||||
@ -808,7 +928,9 @@ begin
|
|||||||
EY:=FBoundsRect.Top+AVAxis.Margin2;
|
EY:=FBoundsRect.Top+AVAxis.Margin2;
|
||||||
// Writeln(Format('(%d,%d) -> (%d,%d) (%d,%d) (%d,%d)',[width,height,ox,oy,ox,ey,ex,oy]));
|
// Writeln(Format('(%d,%d) -> (%d,%d) (%d,%d) (%d,%d)',[width,height,ox,oy,ox,ey,ex,oy]));
|
||||||
// X axis
|
// X axis
|
||||||
|
ACanvas.Brush.Style := bsClear;
|
||||||
ACanvas.Pen.Color:=AHAxis.Color;
|
ACanvas.Pen.Color:=AHAxis.Color;
|
||||||
|
ACanvas.Pen.Width:=AHAxis.LineWidth;
|
||||||
ACanvas.Line(OX,OY,EX,OY);
|
ACanvas.Line(OX,OY,EX,OY);
|
||||||
Canvas.Font:=AHAxis.TickFont;
|
Canvas.Font:=AHAxis.TickFont;
|
||||||
TickDelta:=AHAxis.TickDelta;
|
TickDelta:=AHAxis.TickDelta;
|
||||||
@ -821,11 +943,13 @@ begin
|
|||||||
L:='#0.#';
|
L:='#0.#';
|
||||||
Repeat
|
Repeat
|
||||||
ACanvas.Pen.Color:=AHAxis.TickColor;
|
ACanvas.Pen.Color:=AHAxis.TickColor;
|
||||||
|
ACanvas.Pen.Width := AHAxis.TickLinewidth;
|
||||||
X:=OX+Round(I*TickDelta);
|
X:=OX+Round(I*TickDelta);
|
||||||
ACanvas.Line(X,OY,X,TE);
|
ACanvas.Line(X,OY,X,TE);
|
||||||
If (AHAxis.GridInterval<>0) and ((I mod AHAxis.GridInterval)=0) then
|
If (AHAxis.GridInterval<>0) and ((I mod AHAxis.GridInterval)=0) then
|
||||||
begin
|
begin
|
||||||
ACanvas.Pen.Color:=AHAxis.GridColor;
|
ACanvas.Pen.Color:=AHAxis.GridColor;
|
||||||
|
ACanvas.Pen.Width := AHAxis.GridLinewidth;
|
||||||
ACanvas.Line(X,OY,X,EY);
|
ACanvas.Line(X,OY,X,EY);
|
||||||
end;
|
end;
|
||||||
If (AHAxis.LegendInterval<>0) and ((I mod AHAxis.LegendInterval)=0) then
|
If (AHAxis.LegendInterval<>0) and ((I mod AHAxis.LegendInterval)=0) then
|
||||||
@ -841,6 +965,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
X:=OX+Round((EX-OX)*Abs(AHAxis.Origin)/AHAxis.Interval);
|
X:=OX+Round((EX-OX)*Abs(AHAxis.Origin)/AHAxis.Interval);
|
||||||
ACanvas.Pen.Color:=AHAxis.TickColor;
|
ACanvas.Pen.Color:=AHAxis.TickColor;
|
||||||
|
ACanvas.Pen.Width := AHAxis.TickLinewidth;
|
||||||
ACanvas.Line(X,OY,X,EY);
|
ACanvas.Line(X,OY,X,EY);
|
||||||
end;
|
end;
|
||||||
Canvas.Font:=AHAxis.Caption.Font;
|
Canvas.Font:=AHAxis.Caption.Font;
|
||||||
@ -877,7 +1002,9 @@ begin
|
|||||||
EX:=FBoundsRect.Right-AHAxis.Margin2;
|
EX:=FBoundsRect.Right-AHAxis.Margin2;
|
||||||
OY:=FBoundsRect.Bottom-AVAxis.Margin1;
|
OY:=FBoundsRect.Bottom-AVAxis.Margin1;
|
||||||
EY:=FBoundsRect.Top+AVAxis.Margin2;
|
EY:=FBoundsRect.Top+AVAxis.Margin2;
|
||||||
|
ACanvas.Brush.Style := bsClear;
|
||||||
ACanvas.Pen.Color:=AVAxis.Color;
|
ACanvas.Pen.Color:=AVAxis.Color;
|
||||||
|
ACanvas.Pen.Width:=AVAxis.Linewidth;
|
||||||
ACanvas.Line(OX,OY,OX,EY);
|
ACanvas.Line(OX,OY,OX,EY);
|
||||||
TickDelta:=AVAxis.TickDelta;
|
TickDelta:=AVAxis.TickDelta;
|
||||||
VD:=AVAxis.ValueDelta;
|
VD:=AVAxis.ValueDelta;
|
||||||
@ -892,10 +1019,12 @@ begin
|
|||||||
Repeat
|
Repeat
|
||||||
Y:=OY-Round(I*TickDelta);
|
Y:=OY-Round(I*TickDelta);
|
||||||
ACanvas.Pen.Color:=AVAxis.TickColor;
|
ACanvas.Pen.Color:=AVAxis.TickColor;
|
||||||
|
ACanvas.Pen.Width := AVAxis.TickLinewidth;
|
||||||
ACanvas.Line(TE,Y,OX,Y);
|
ACanvas.Line(TE,Y,OX,Y);
|
||||||
If (Y<>OY) and (AVAxis.GridInterval<>0) and ((I mod AVAxis.GridInterval)=0) then
|
If (Y<>OY) and (AVAxis.GridInterval<>0) and ((I mod AVAxis.GridInterval)=0) then
|
||||||
begin
|
begin
|
||||||
ACanvas.Pen.Color:=AVAxis.GridColor;
|
ACanvas.Pen.Color:=AVAxis.GridColor;
|
||||||
|
ACanvas.Pen.Width := AVAxis.GridLinewidth;
|
||||||
ACanvas.Line(OX,Y,EX,Y);
|
ACanvas.Line(OX,Y,EX,Y);
|
||||||
end;
|
end;
|
||||||
If (AVAxis.LegendInterval<>0) and ((I mod AVAxis.LegendInterval)=0) then
|
If (AVAxis.LegendInterval<>0) and ((I mod AVAxis.LegendInterval)=0) then
|
||||||
@ -911,6 +1040,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
Y:=OY-Round((OY-EY)*Abs(AVAxis.Origin)/AVAxis.Interval);
|
Y:=OY-Round((OY-EY)*Abs(AVAxis.Origin)/AVAxis.Interval);
|
||||||
ACanvas.Pen.Color:=AVAxis.TickColor;
|
ACanvas.Pen.Color:=AVAxis.TickColor;
|
||||||
|
ACanvas.Pen.Width := AVAxis.TickLinewidth;
|
||||||
ACanvas.Line(OX,Y,EX,Y);
|
ACanvas.Line(OX,Y,EX,Y);
|
||||||
end;
|
end;
|
||||||
L:=AVAxis.Caption.Title;
|
L:=AVAxis.Caption.Title;
|
||||||
@ -1051,6 +1181,7 @@ begin
|
|||||||
// Start value
|
// Start value
|
||||||
X:=FXAxis.Origin;
|
X:=FXAxis.Origin;
|
||||||
ACanvas.Pen.Color:=PlotColor;
|
ACanvas.Pen.Color:=PlotColor;
|
||||||
|
ACanvas.Pen.Width := FPlotLineWidth;
|
||||||
PLX:=POX;
|
PLX:=POX;
|
||||||
PLY:=POY;
|
PLY:=POY;
|
||||||
For PX:=0 to PXW do
|
For PX:=0 to PXW do
|
||||||
@ -1108,13 +1239,15 @@ begin
|
|||||||
If AOwner is TCOntrol then
|
If AOwner is TCOntrol then
|
||||||
begin
|
begin
|
||||||
FControl:=AOwner as TControl;
|
FControl:=AOwner as TControl;
|
||||||
FBackGroundColor:=FControl.Color;
|
if FColor = clDefault then
|
||||||
|
FColor := FControl.Color;
|
||||||
|
if FBackgroundColor = clDefault then
|
||||||
|
FBackGroundColor:=FControl.Color;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TEventControlPlotter }
|
{ TEventControlPlotter }
|
||||||
|
|
||||||
|
|
||||||
procedure TEventControlPlotter.SetOnCalcPlot(const AValue: TOnCalcPlotEvent);
|
procedure TEventControlPlotter.SetOnCalcPlot(const AValue: TOnCalcPlotEvent);
|
||||||
begin
|
begin
|
||||||
FOnCalcPlot:=AValue;
|
FOnCalcPlot:=AValue;
|
||||||
|
|||||||
@ -18,16 +18,22 @@ Active : If set to false, only the grid is drawn.
|
|||||||
|
|
||||||
PlotColor : Color of the plotted line
|
PlotColor : Color of the plotted line
|
||||||
|
|
||||||
|
BackgroundColor : Background color of the area spanned by the axes
|
||||||
|
|
||||||
|
Color : Background color of the entire control.
|
||||||
|
|
||||||
Caption : Caption of the graph
|
Caption : Caption of the graph
|
||||||
|
|
||||||
|
|
||||||
XAxis, YAxis: These control the appearance of the X and Y axis.
|
XAxis, YAxis: These control the appearance of the X and Y axis.
|
||||||
They have both the following properties:
|
They have both the following properties:
|
||||||
Color : Axis color
|
Color : Axis color
|
||||||
|
Linewidth : Width of the axis line
|
||||||
TickColor : Color of the tick marks on the axis.
|
TickColor : Color of the tick marks on the axis.
|
||||||
Ticks : Number of tick marks or distance between tick marks on the
|
Ticks : Number of tick marks or distance between tick marks on the
|
||||||
axis.
|
axis.
|
||||||
TickSize : Length of the tick mark.
|
TickSize : Length of the tick mark.
|
||||||
|
TickLinewidth : Linewidth for the tick marks
|
||||||
TickMode : Ticks is number of ticks or distance (in pixels) between ticks.
|
TickMode : Ticks is number of ticks or distance (in pixels) between ticks.
|
||||||
TickFont : Font for the tick labels
|
TickFont : Font for the tick labels
|
||||||
Caption : Caption of the axis.
|
Caption : Caption of the axis.
|
||||||
@ -42,4 +48,5 @@ XAxis, YAxis: These control the appearance of the X and Y axis.
|
|||||||
This should be a valid float formatting specifier (used in FormatFloat);
|
This should be a valid float formatting specifier (used in FormatFloat);
|
||||||
GridInterval : The number of ticks at which a grid line must be drawn.
|
GridInterval : The number of ticks at which a grid line must be drawn.
|
||||||
GridColor : Color of the grid line.
|
GridColor : Color of the grid line.
|
||||||
|
GridLinewidth : Width for the grid line
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user