TAChart: Allow assignment of TLineSeries

git-svn-id: trunk@29315 -
This commit is contained in:
ask 2011-02-02 06:51:17 +00:00
parent 597383b506
commit 545b9ba037
6 changed files with 76 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);