From 33343e7d67245ac3354500cc06974d7671eb0a7a Mon Sep 17 00:00:00 2001 From: ask Date: Sun, 27 Sep 2009 15:24:39 +0000 Subject: [PATCH] TAChart: Minor cleanups: Move ShowInLegend initialization into TCustomChartSeries. Add empty override for TUserDrawnSeries.GetLegendItems. git-svn-id: trunk@21900 - --- components/tachart/tacustomseries.pas | 2 +- components/tachart/tagraph.pas | 2 +- components/tachart/taseries.pas | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/tachart/tacustomseries.pas b/components/tachart/tacustomseries.pas index 5a1566fbd5..206d09d2ed 100644 --- a/components/tachart/tacustomseries.pas +++ b/components/tachart/tacustomseries.pas @@ -133,6 +133,7 @@ constructor TCustomChartSeries.Create(AOwner: TComponent); begin inherited Create(AOwner); FActive := true; + FShowInLegend := true; end; procedure TCustomChartSeries.SetActive(AValue: Boolean); @@ -233,7 +234,6 @@ begin FBuiltinSource.Name := 'Builtin'; FBuiltinSource.Subscribe(FListener); FMarks := TChartMarks.Create(FChart); - FShowInLegend := true; end; function TChartSeries.DefaultFormattedMark(AIndex: integer): String; diff --git a/components/tachart/tagraph.pas b/components/tachart/tagraph.pas index ae5d2a5f3c..20fb5d3e4d 100644 --- a/components/tachart/tagraph.pas +++ b/components/tachart/tagraph.pas @@ -83,7 +83,7 @@ type procedure Draw(ACanvas: TCanvas); virtual; abstract; function IsEmpty: Boolean; virtual; abstract; - property Active: Boolean read FActive write SetActive; + property Active: Boolean read FActive write SetActive default true; property Depth: TChartDistance read FDepth write SetDepth default 0; property ParentChart: TChart read FChart; property SeriesColor: TColor diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index 05b33e1ad2..12af07c797 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -294,6 +294,7 @@ type procedure SetOnDraw(AValue: TSeriesDrawEvent); procedure SetOnUpdateBounds(AValue: TSeriesUpdateBoundsEvent); protected + procedure GetLegendItems(AItems: TChartLegendItems); override; procedure UpdateBounds(var ABounds: TDoubleRect); override; public procedure Draw(ACanvas: TCanvas); override; @@ -550,7 +551,6 @@ constructor TLine.Create(AOwner: TComponent); begin inherited Create(AOwner); - FActive := true; FLineStyle := lsHorizontal; FPen := TPen.Create; FPen.OnChange := @StyleChanged; @@ -1075,7 +1075,6 @@ constructor TFuncSeries.Create(AOwner: TComponent); begin inherited Create(AOwner); FExtent := TChartExtent.Create(FChart); - FShowInLegend := true; FPen := TChartPen.Create; FPen.OnChange := @StyleChanged; FStep := 2; @@ -1191,6 +1190,11 @@ begin FOnDraw(ACanvas, FChart.ClipRect); end; +procedure TUserDrawnSeries.GetLegendItems(AItems: TChartLegendItems); +begin + Unused(AItems); +end; + function TUserDrawnSeries.IsEmpty: Boolean; begin Result := not Assigned(FOnDraw);