TAChart: Measure "edge" marks correctly in the presence of axis transformations

git-svn-id: trunk@31772 -
This commit is contained in:
ask 2011-07-20 15:49:18 +00:00
parent 490ec0cbdc
commit 92659628f1
2 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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;