TAChart: Add TChartAxisMarks.Range property

git-svn-id: trunk@31824 -
This commit is contained in:
ask 2011-07-30 08:08:54 +00:00
parent b8bef2f439
commit 11d4e269aa
2 changed files with 18 additions and 0 deletions

View File

@ -545,6 +545,12 @@ begin
AMin := GetTransform.GraphToAxis(AMin); AMin := GetTransform.GraphToAxis(AMin);
AMax := GetTransform.GraphToAxis(AMax); AMax := GetTransform.GraphToAxis(AMax);
EnsureOrder(AMin, AMax); EnsureOrder(AMin, AMax);
with Marks.Range do begin
if UseMin then
AMin := Math.Max(Min, AMin);
if UseMax then
AMax := Math.Min(Max, AMax);
end;
SetLength(FMarkValues, 0); SetLength(FMarkValues, 0);
vis := TChartAxisList(Collection).OnVisitSources; vis := TChartAxisList(Collection).OnVisitSources;
if Marks.AtDataOnly and Assigned(vis) then begin if Marks.AtDataOnly and Assigned(vis) then begin

View File

@ -121,9 +121,11 @@ type
FAtDataOnly: Boolean; FAtDataOnly: Boolean;
FDefaultSource: TCustomChartSource; FDefaultSource: TCustomChartSource;
FListener: TListener; FListener: TListener;
FRange: TChartRange;
FSource: TCustomChartSource; FSource: TCustomChartSource;
procedure SetAtDataOnly(AValue: Boolean); procedure SetAtDataOnly(AValue: Boolean);
procedure SetRange(AValue: TChartRange);
procedure SetSource(AValue: TCustomChartSource); procedure SetSource(AValue: TCustomChartSource);
public public
constructor Create(AOwner: TCustomChart); constructor Create(AOwner: TCustomChart);
@ -138,6 +140,7 @@ type
property Frame; property Frame;
property LabelBrush; property LabelBrush;
property OverlapPolicy; property OverlapPolicy;
property Range: TChartRange read FRange write SetRange;
property Source: TCustomChartSource read FSource write SetSource; property Source: TCustomChartSource read FSource write SetSource;
property Stripes; property Stripes;
property Style default smsValue; property Style default smsValue;
@ -553,12 +556,14 @@ begin
inherited Create(AOwner); inherited Create(AOwner);
FDefaultSource := TIntervalChartSource.Create(AOwner); FDefaultSource := TIntervalChartSource.Create(AOwner);
FListener := TListener.Create(@FSource, @StyleChanged); FListener := TListener.Create(@FSource, @StyleChanged);
FRange := TChartRange.Create(AOwner);
FStyle := smsValue; FStyle := smsValue;
FFormat := SERIES_MARK_FORMATS[FStyle]; FFormat := SERIES_MARK_FORMATS[FStyle];
end; end;
destructor TChartAxisMarks.Destroy; destructor TChartAxisMarks.Destroy;
begin begin
FreeAndNil(FRange);
FreeAndNil(FListener); FreeAndNil(FListener);
FreeAndNil(FDefaultSource); FreeAndNil(FDefaultSource);
inherited; inherited;
@ -571,6 +576,13 @@ begin
StyleChanged(Self); StyleChanged(Self);
end; end;
procedure TChartAxisMarks.SetRange(AValue: TChartRange);
begin
if FRange = AValue then exit;
FRange.Assign(AValue);
StyleChanged(Self);
end;
procedure TChartAxisMarks.SetSource(AValue: TCustomChartSource); procedure TChartAxisMarks.SetSource(AValue: TCustomChartSource);
begin begin
if FSource = AValue then exit; if FSource = AValue then exit;