mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 13:56:00 +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
|
var
|
||||||
fixedCoord: Integer;
|
fixedCoord: Integer;
|
||||||
pv, v: Double;
|
pv, v: Double;
|
||||||
axisTransf: TTransformFunc;
|
|
||||||
t: TChartValueText;
|
t: TChartValueText;
|
||||||
begin
|
begin
|
||||||
if not Visible then exit;
|
if not Visible then exit;
|
||||||
@ -443,9 +442,8 @@ begin
|
|||||||
pv := NaN;
|
pv := NaN;
|
||||||
FHelper.BeginDrawing;
|
FHelper.BeginDrawing;
|
||||||
FHelper.DrawAxisLine(AxisPen, fixedCoord);
|
FHelper.DrawAxisLine(AxisPen, fixedCoord);
|
||||||
axisTransf := @GetTransform.AxisToGraph;
|
|
||||||
for t in FMarkValues do begin
|
for t in FMarkValues do begin
|
||||||
v := axisTransf(t.FValue);
|
v := FHelper.FAxisTransf(t.FValue);
|
||||||
FHelper.DrawMark(fixedCoord, v, t.FText);
|
FHelper.DrawMark(fixedCoord, v, t.FText);
|
||||||
DrawMinors(fixedCoord, pv, v);
|
DrawMinors(fixedCoord, pv, v);
|
||||||
pv := v;
|
pv := v;
|
||||||
@ -597,7 +595,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
pv := cv;
|
pv := cv;
|
||||||
// Optimization: only measure edge labels to calculate longitudinal margins.
|
// 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 not InRange(c, rmin, rmax) then continue;
|
||||||
if c < minc then begin
|
if c < minc then begin
|
||||||
minc := c;
|
minc := c;
|
||||||
@ -634,6 +632,7 @@ begin
|
|||||||
else
|
else
|
||||||
FHelper := TAxisDrawHelperX.Create;
|
FHelper := TAxisDrawHelperX.Create;
|
||||||
FHelper.FAxis := Self;
|
FHelper.FAxis := Self;
|
||||||
|
FHelper.FAxisTransf := @GetTransform.AxisToGraph;
|
||||||
FHelper.FClipRect := AClipRect;
|
FHelper.FClipRect := AClipRect;
|
||||||
FHelper.FDrawer := ADrawer;
|
FHelper.FDrawer := ADrawer;
|
||||||
FHelper.FTransf := ATransf;
|
FHelper.FTransf := ATransf;
|
||||||
|
@ -179,6 +179,7 @@ type
|
|||||||
function TryApplyStripes: Boolean; inline;
|
function TryApplyStripes: Boolean; inline;
|
||||||
public
|
public
|
||||||
FAxis: TChartBasicAxis;
|
FAxis: TChartBasicAxis;
|
||||||
|
FAxisTransf: TTransformFunc;
|
||||||
FClipRect: ^TRect;
|
FClipRect: ^TRect;
|
||||||
FDrawer: IChartDrawer;
|
FDrawer: IChartDrawer;
|
||||||
FPrevCoord: Integer;
|
FPrevCoord: Integer;
|
||||||
@ -255,6 +256,7 @@ function TAxisDrawHelper.Clone: TAxisDrawHelper;
|
|||||||
begin
|
begin
|
||||||
Result := TAxisDrawHelperClass(ClassType).Create;
|
Result := TAxisDrawHelperClass(ClassType).Create;
|
||||||
Result.FAxis := FAxis;
|
Result.FAxis := FAxis;
|
||||||
|
Result.FAxisTransf := FAxisTransf;
|
||||||
Result.FClipRect := FClipRect;
|
Result.FClipRect := FClipRect;
|
||||||
Result.FDrawer := FDrawer;
|
Result.FDrawer := FDrawer;
|
||||||
Result.FTransf := FTransf;
|
Result.FTransf := FTransf;
|
||||||
|
Loading…
Reference in New Issue
Block a user