TAChart: Update chart after change of axis interval parameters

git-svn-id: trunk@31859 -
This commit is contained in:
ask 2011-08-03 16:26:51 +00:00
parent e486d01537
commit 7195e84854
4 changed files with 12 additions and 2 deletions

View File

@ -556,6 +556,8 @@ begin
FValueMax := Math.Min(Max, FValueMax); FValueMax := Math.Min(Max, FValueMax);
end; end;
d := MakeValuesInRangeParams(FValueMin, FValueMax); d := MakeValuesInRangeParams(FValueMin, FValueMax);
FValueMin := GetTransform.AxisToGraph(FValueMin);
FValueMax := GetTransform.AxisToGraph(FValueMax);
end; end;
SetLength(FMarkValues, 0); SetLength(FMarkValues, 0);
vis := TChartAxisList(Collection).OnVisitSources; vis := TChartAxisList(Collection).OnVisitSources;

View File

@ -87,6 +87,7 @@ type
TCustomChartAxisMarks = class(TBasicChartAxisMarks) TCustomChartAxisMarks = class(TBasicChartAxisMarks)
strict private strict private
FDefaultSource: TIntervalChartSource; FDefaultSource: TIntervalChartSource;
FDefaultListener: TListener;
FStripes: TChartStyles; FStripes: TChartStyles;
procedure SetStripes(AValue: TChartStyles); procedure SetStripes(AValue: TChartStyles);
strict protected strict protected
@ -524,13 +525,16 @@ end;
constructor TCustomChartAxisMarks.Create(AOwner: TCustomChart); constructor TCustomChartAxisMarks.Create(AOwner: TCustomChart);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FDefaultListener := TListener.Create(nil, @StyleChanged);
FDefaultSource := TIntervalChartSource.Create(AOwner); FDefaultSource := TIntervalChartSource.Create(AOwner);
FDefaultSource.Broadcaster.Subscribe(FDefaultListener);
FDistance := 1; FDistance := 1;
FLabelBrush.Style := bsClear; FLabelBrush.Style := bsClear;
end; end;
destructor TCustomChartAxisMarks.Destroy; destructor TCustomChartAxisMarks.Destroy;
begin begin
FreeAndNil(FDefaultListener);
FreeAndNil(FDefaultSource); FreeAndNil(FDefaultSource);
inherited; inherited;
end; end;

View File

@ -637,7 +637,8 @@ end;
procedure TListener.Forget; procedure TListener.Forget;
begin begin
FBroadcaster := nil; FBroadcaster := nil;
FRef^ := nil; if FRef <> nil then
FRef^ := nil;
end; end;
function TListener.GetIsListening: Boolean; function TListener.GetIsListening: Boolean;

View File

@ -196,7 +196,10 @@ end;
procedure TChartAxisIntervalParams.Changed; procedure TChartAxisIntervalParams.Changed;
begin begin
// Empty. with FOwner as TCustomChartSource do begin
BeginUpdate;
EndUpdate;
end;
end; end;
constructor TChartAxisIntervalParams.Create(AOwner: TPersistent); constructor TChartAxisIntervalParams.Create(AOwner: TPersistent);