diff --git a/components/tachart/tachartaxis.pas b/components/tachart/tachartaxis.pas index 2da3a10563..4db6f0d076 100644 --- a/components/tachart/tachartaxis.pas +++ b/components/tachart/tachartaxis.pas @@ -321,8 +321,12 @@ end; procedure TChartAxisTitle.Assign(Source: TPersistent); begin if Source is TChartAxisTitle then - with TChartAxisTitle(Source) do - FCaption := Caption; + with TChartAxisTitle(Source) do begin + Self.FLabelBrush.Assign(FLabelBrush); + Self.FLabelFont.Assign(FLabelFont); + Self.FLinkPen.Assign(FLinkPen); + Self.FCaption := FCaption; + end; inherited Assign(Source); end; diff --git a/components/tachart/tacustomseries.pas b/components/tachart/tacustomseries.pas index 78aaa66c5d..273fbae106 100644 --- a/components/tachart/tacustomseries.pas +++ b/components/tachart/tacustomseries.pas @@ -77,6 +77,7 @@ type function IsRotated: Boolean; public + procedure Assign(Source: TPersistent); override; constructor Create(AOwner: TComponent); override; destructor Destroy; override; function GetNearestPoint( @@ -136,6 +137,7 @@ type protected property Styles: TChartStyles read FStyles write SetStyles; public + procedure Assign(Source: TPersistent); override; constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -224,6 +226,17 @@ begin Legend.SetOwner(FChart); end; +procedure TCustomChartSeries.Assign(Source: TPersistent); +begin + if Source is TCustomChartSeries then + with TCustomChartSeries(Source) do begin + Self.FAxisIndexX := FAxisIndexX; + Self.FAxisIndexY := FAxisIndexY; + Self.Legend := FLegend; + end; + inherited Assign(Source); +end; + function TCustomChartSeries.AxisToGraph( const APoint: TDoublePoint): TDoublePoint; begin @@ -396,7 +409,7 @@ end; procedure TCustomChartSeries.SetLegend(AValue: TChartSeriesLegend); begin if FLegend = AValue then exit; - FLegend := AValue; + FLegend.Assign(AValue); UpdateParentChart; end; @@ -465,6 +478,18 @@ begin Source.AfterDraw; end; +procedure TChartSeries.Assign(Source: TPersistent); +begin + if Source is TChartSeries then + with TChartSeries(Source) do begin + Self.Marks := FMarks; + Self.FOnGetMark := FOnGetMark; + Self.Source := FSource; + Self.Styles := FStyles; + end; + inherited Assign(Source); +end; + procedure TChartSeries.BeforeDraw; begin inherited BeforeDraw; diff --git a/components/tachart/tagraph.pas b/components/tachart/tagraph.pas index 2884c4f66d..a2a986ae9b 100644 --- a/components/tachart/tagraph.pas +++ b/components/tachart/tagraph.pas @@ -75,6 +75,7 @@ type function GraphToAxisY(AY: Double): Double; virtual; public + procedure Assign(Source: TPersistent); override; destructor Destroy; override; public @@ -1162,6 +1163,17 @@ begin // empty end; +procedure TBasicChartSeries.Assign(Source: TPersistent); +begin + if Source is TBasicChartSeries then + with TBasicChartSeries(Source) do begin + Self.FActive := FActive; + Self.FDepth := FDepth; + Self.FTitle := FTitle; + Self.FZPosition := FZPosition; + end; +end; + function TBasicChartSeries.AxisToGraphX(AX: Double): Double; begin Result := AX; diff --git a/components/tachart/talegend.pas b/components/tachart/talegend.pas index bf56fd3ec8..6d2cc59432 100644 --- a/components/tachart/talegend.pas +++ b/components/tachart/talegend.pas @@ -490,7 +490,7 @@ begin with TChartSeriesLegend(Source) do begin Self.FMultiplicity := FMultiplicity; Self.FOnDraw := FOnDraw; - Self.FVisible := FVisible; + Self.FUserItemsCount := FUserItemsCount; end; inherited Assign(Source); diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index 332a19159f..77f6133e21 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -195,6 +195,7 @@ type procedure GetLegendItems(AItems: TChartLegendItems); override; function GetSeriesColor: TColor; override; public + procedure Assign(ASource: TPersistent); override; constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -317,6 +318,19 @@ begin FPointer.SetOwner(FChart); end; +procedure TLineSeries.Assign(ASource: TPersistent); +begin + if ASource is TLineSeries then + with TLineSeries(ASource) do begin + Self.LinePen := FLinePen; + Self.FLineType := FLineType; + Self.FOnDrawPointer := FOnDrawPointer; + Self.Pointer := FPointer; + Self.FShowPoints := FShowPoints; + end; + inherited Assign(ASource); +end; + procedure TLineSeries.BeginUpdate; begin ListSource.BeginUpdate; diff --git a/components/tachart/tatypes.pas b/components/tachart/tatypes.pas index 523f938eeb..67563ad370 100644 --- a/components/tachart/tatypes.pas +++ b/components/tachart/tatypes.pas @@ -207,6 +207,7 @@ type TChartMarks = class(TCustomChartMarks) public + procedure Assign(Source: TPersistent); override; constructor Create(AOwner: TCustomChart); published property Distance default DEF_MARKS_DISTANCE; @@ -342,7 +343,6 @@ begin Self.FVisible := FVisible; Self.FOwner := FOwner; end; - inherited Assign(Source); end; constructor TChartElement.Create(AOwner: TCustomChart); @@ -483,9 +483,11 @@ begin Self.FDistance := FDistance; Self.FFormat := FFormat; Self.FFrame.Assign(FFrame); - Self.FLabelBrush.Assign(FLabelBrush); - Self.FLabelFont.Assign(FLabelFont); - Self.FLinkPen.Assign(FLinkPen); + // FPC miscompiles virtual calls to generic type arguments, + // so as a workaround these assignments are moved to the specializations. + // Self.FLabelBrush.Assign(FLabelBrush); + // Self.FLabelFont.Assign(FLabelFont); + // Self.FLinkPen.Assign(FLinkPen); Self.FOverlapPolicy := FOverlapPolicy; Self.FStyle := FStyle; end; @@ -705,6 +707,17 @@ end; { TChartMarks } +procedure TChartMarks.Assign(Source: TPersistent); +begin + if Source is TChartMarks then + with TChartMarks(Source) do begin + Self.FLabelBrush.Assign(FLabelBrush); + Self.FLabelFont.Assign(FLabelFont); + Self.FLinkPen.Assign(FLinkPen); + end; + inherited Assign(Source); +end; + constructor TChartMarks.Create(AOwner: TCustomChart); begin inherited Create(AOwner);