diff --git a/components/tachart/tachartaxis.pas b/components/tachart/tachartaxis.pas index 36b5eec9e1..808a690bd4 100644 --- a/components/tachart/tachartaxis.pas +++ b/components/tachart/tachartaxis.pas @@ -545,6 +545,12 @@ begin AMin := GetTransform.GraphToAxis(AMin); AMax := GetTransform.GraphToAxis(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); vis := TChartAxisList(Collection).OnVisitSources; if Marks.AtDataOnly and Assigned(vis) then begin diff --git a/components/tachart/tachartaxisutils.pas b/components/tachart/tachartaxisutils.pas index 51ebfcd500..27ddabc380 100644 --- a/components/tachart/tachartaxisutils.pas +++ b/components/tachart/tachartaxisutils.pas @@ -121,9 +121,11 @@ type FAtDataOnly: Boolean; FDefaultSource: TCustomChartSource; FListener: TListener; + FRange: TChartRange; FSource: TCustomChartSource; procedure SetAtDataOnly(AValue: Boolean); + procedure SetRange(AValue: TChartRange); procedure SetSource(AValue: TCustomChartSource); public constructor Create(AOwner: TCustomChart); @@ -138,6 +140,7 @@ type property Frame; property LabelBrush; property OverlapPolicy; + property Range: TChartRange read FRange write SetRange; property Source: TCustomChartSource read FSource write SetSource; property Stripes; property Style default smsValue; @@ -553,12 +556,14 @@ begin inherited Create(AOwner); FDefaultSource := TIntervalChartSource.Create(AOwner); FListener := TListener.Create(@FSource, @StyleChanged); + FRange := TChartRange.Create(AOwner); FStyle := smsValue; FFormat := SERIES_MARK_FORMATS[FStyle]; end; destructor TChartAxisMarks.Destroy; begin + FreeAndNil(FRange); FreeAndNil(FListener); FreeAndNil(FDefaultSource); inherited; @@ -571,6 +576,13 @@ begin StyleChanged(Self); end; +procedure TChartAxisMarks.SetRange(AValue: TChartRange); +begin + if FRange = AValue then exit; + FRange.Assign(AValue); + StyleChanged(Self); +end; + procedure TChartAxisMarks.SetSource(AValue: TCustomChartSource); begin if FSource = AValue then exit;