TAChart: Fix chart invalidation after changing subcomponents' properties

git-svn-id: trunk@27563 -
This commit is contained in:
ask 2010-10-04 09:22:47 +00:00
parent 0b18b44d8e
commit d589d25f96
4 changed files with 18 additions and 9 deletions

View File

@ -43,6 +43,7 @@ type
procedure SetShowInLegend(AValue: Boolean);
protected
procedure AfterAdd; override;
procedure GetGraphBounds(var ABounds: TDoubleRect); override;
procedure GetLegendItems(AItems: TChartLegendItems); virtual; abstract;
procedure GetLegendItemsBasic(AItems: TChartLegendItems); override;
@ -206,6 +207,11 @@ uses
{ TCustomChartSeries }
procedure TCustomChartSeries.AfterAdd;
begin
Legend.SetOwner(FChart);
end;
function TCustomChartSeries.AxisToGraph(
const APoint: TDoublePoint): TDoublePoint;
begin
@ -408,6 +414,7 @@ end;
procedure TChartSeries.AfterAdd;
begin
inherited;
FMarks.SetOwner(FChart);
end;

View File

@ -51,7 +51,7 @@ type
FTitle: String;
FZPosition: TChartDistance;
procedure AfterAdd; virtual;
procedure AfterAdd; virtual; abstract;
procedure AfterDraw; virtual;
procedure BeforeDraw; virtual;
// Set series bounds in axis coordinates.
@ -711,6 +711,9 @@ end;
procedure TChart.AddSeries(ASeries: TBasicChartSeries);
begin
if ASeries.FChart = Self then exit;
if ASeries.FChart <> nil then
ASeries.FChart.DeleteSeries(ASeries);
DrawReticule(Canvas);
Series.FList.Add(ASeries);
ASeries.FChart := Self;
@ -1094,11 +1097,6 @@ end;
{ TBasicChartSeries }
procedure TBasicChartSeries.AfterAdd;
begin
// nothing
end;
procedure TBasicChartSeries.AfterDraw;
begin
// empty

View File

@ -858,6 +858,7 @@ end;
procedure TPieSeries.AfterAdd;
begin
inherited;
// disable axis when we have TPie series
ParentChart.LeftAxis.Visible := false;
ParentChart.BottomAxis.Visible := false;

View File

@ -318,9 +318,12 @@ end;
procedure TChartElement.Assign(Source: TPersistent);
begin
//inherited Assign(Source);
if Source is TChartElement then
Self.FVisible := TChartElement(Source).FVisible;
with TChartElement(Source) do begin
Self.FVisible := FVisible;
Self.FOwner := FOwner;
end;
inherited Assign(Source);
end;
constructor TChartElement.Create(AOwner: TCustomChart);
@ -427,7 +430,6 @@ end;
procedure TGenericChartMarks.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is Self.ClassType then
with TGenericChartMarks(Source) do begin
Self.FClipped := FClipped;
@ -440,6 +442,7 @@ begin
Self.FOverlapPolicy := FOverlapPolicy;
Self.FStyle := FStyle;
end;
inherited Assign(Source);
end;
function TGenericChartMarks.CenterOffset(