mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 18:09:20 +02:00
TAChart: Fix first and last ticks/candles of OpenHighLowCloseSeries not being shown fully.
git-svn-id: trunk@53937 -
This commit is contained in:
parent
5b1bca7854
commit
cd884d710b
@ -160,6 +160,7 @@ type
|
||||
AX, AOpen, AHigh, ALow, AClose: Double;
|
||||
ALabel: String = ''; AColor: TColor = clTAColor): Integer; inline;
|
||||
procedure Draw(ADrawer: IChartDrawer); override;
|
||||
function Extent: TDoubleRect; override;
|
||||
function GetNearestPoint(const AParams: TNearestPointParams;
|
||||
out AResults: TNearestPointResults): Boolean; override;
|
||||
published
|
||||
@ -920,6 +921,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TOpenHighLowCloseSeries.Extent: TDoubleRect;
|
||||
var
|
||||
x: Double;
|
||||
tw: Double;
|
||||
begin
|
||||
if Source.YCount < 4 then exit(EmptyExtent);
|
||||
Result := Source.ExtentList;
|
||||
// Show first and last open/close ticks and candle boxes fully.
|
||||
x := GetGraphPointX(0);
|
||||
tw := GetXRange(x, 0) * PERCENT * TickWidth;
|
||||
Result.a.X := Min(Result.a.X, x - tw);
|
||||
x := GetGraphPointX(Count - 1);
|
||||
tw := GetXRange(x, Count - 1) * PERCENT * TickWidth;
|
||||
Result.b.X := Max(Result.b.X, x + tw);
|
||||
end;
|
||||
|
||||
procedure TOpenHighLowCloseSeries.GetLegendItems(AItems: TChartLegendItems);
|
||||
begin
|
||||
AItems.Add(TLegendItemOHLCLine.Create(Self, LegendTextSingle));
|
||||
|
Loading…
Reference in New Issue
Block a user