mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 08:18:13 +02:00
TAChart: Measure "edge" marks correctly in the presence of axis transformations
git-svn-id: trunk@31772 -
This commit is contained in:
parent
490ec0cbdc
commit
92659628f1
@ -433,7 +433,6 @@ procedure TChartAxis.Draw;
|
||||
var
|
||||
fixedCoord: Integer;
|
||||
pv, v: Double;
|
||||
axisTransf: TTransformFunc;
|
||||
t: TChartValueText;
|
||||
begin
|
||||
if not Visible then exit;
|
||||
@ -443,9 +442,8 @@ begin
|
||||
pv := NaN;
|
||||
FHelper.BeginDrawing;
|
||||
FHelper.DrawAxisLine(AxisPen, fixedCoord);
|
||||
axisTransf := @GetTransform.AxisToGraph;
|
||||
for t in FMarkValues do begin
|
||||
v := axisTransf(t.FValue);
|
||||
v := FHelper.FAxisTransf(t.FValue);
|
||||
FHelper.DrawMark(fixedCoord, v, t.FText);
|
||||
DrawMinors(fixedCoord, pv, v);
|
||||
pv := v;
|
||||
@ -597,7 +595,7 @@ begin
|
||||
end;
|
||||
pv := cv;
|
||||
// Optimization: only measure edge labels to calculate longitudinal margins.
|
||||
c := FHelper.GraphToImage(cv);
|
||||
c := FHelper.GraphToImage(FHelper.FAxisTransf(cv));
|
||||
if not InRange(c, rmin, rmax) then continue;
|
||||
if c < minc then begin
|
||||
minc := c;
|
||||
@ -634,6 +632,7 @@ begin
|
||||
else
|
||||
FHelper := TAxisDrawHelperX.Create;
|
||||
FHelper.FAxis := Self;
|
||||
FHelper.FAxisTransf := @GetTransform.AxisToGraph;
|
||||
FHelper.FClipRect := AClipRect;
|
||||
FHelper.FDrawer := ADrawer;
|
||||
FHelper.FTransf := ATransf;
|
||||
|
@ -179,6 +179,7 @@ type
|
||||
function TryApplyStripes: Boolean; inline;
|
||||
public
|
||||
FAxis: TChartBasicAxis;
|
||||
FAxisTransf: TTransformFunc;
|
||||
FClipRect: ^TRect;
|
||||
FDrawer: IChartDrawer;
|
||||
FPrevCoord: Integer;
|
||||
@ -255,6 +256,7 @@ function TAxisDrawHelper.Clone: TAxisDrawHelper;
|
||||
begin
|
||||
Result := TAxisDrawHelperClass(ClassType).Create;
|
||||
Result.FAxis := FAxis;
|
||||
Result.FAxisTransf := FAxisTransf;
|
||||
Result.FClipRect := FClipRect;
|
||||
Result.FDrawer := FDrawer;
|
||||
Result.FTransf := FTransf;
|
||||
|
Loading…
Reference in New Issue
Block a user