TAChart: Refactor TChartAxis.GetMarkValues and add FIXME comment

+ Add forgotten line from the previous commit.

git-svn-id: trunk@36165 -
This commit is contained in:
ask 2012-03-19 12:16:30 +00:00
parent f7c92839bd
commit dfa6c71041

View File

@ -453,6 +453,7 @@ procedure TChartAxis.Draw;
// Only draw minor marks strictly inside the major mark interval. // Only draw minor marks strictly inside the major mark interval.
FValueMin := Max(FAxisTransf(AMin), FValueMin); FValueMin := Max(FAxisTransf(AMin), FValueMin);
FValueMax := Min(FAxisTransf(AMax), FValueMax); FValueMax := Min(FAxisTransf(AMax), FValueMax);
if FValueMax <= FValueMin then continue;
ExpandRange(FValueMin, FValueMax, -EPS); ExpandRange(FValueMin, FValueMax, -EPS);
try try
BeginDrawing; BeginDrawing;
@ -542,22 +543,27 @@ var
d: TValuesInRangeParams; d: TValuesInRangeParams;
vis: TChartOnVisitSources; vis: TChartOnVisitSources;
t: TChartValueText; t: TChartValueText;
axisMin, axisMax: Double;
begin begin
with FHelper do begin with FHelper do begin
FValueMin := GetTransform.GraphToAxis(FValueMin); axisMin := GetTransform.GraphToAxis(FValueMin);
FValueMax := GetTransform.GraphToAxis(FValueMax); axisMax := GetTransform.GraphToAxis(FValueMax);
EnsureOrder(FValueMin, FValueMax);
Marks.Range.Intersect(FValueMin, FValueMax);
d := MakeValuesInRangeParams(FValueMin, FValueMax);
FValueMin := GetTransform.AxisToGraph(FValueMin);
FValueMax := GetTransform.AxisToGraph(FValueMax);
end; end;
EnsureOrder(axisMin, axisMax);
Marks.Range.Intersect(axisMin, axisMax);
d := MakeValuesInRangeParams(axisMin, axisMax);
SetLength(FMarkValues, 0); SetLength(FMarkValues, 0);
vis := TChartAxisList(Collection).OnVisitSources; vis := TChartAxisList(Collection).OnVisitSources;
if Marks.AtDataOnly and Assigned(vis) then if Marks.AtDataOnly and Assigned(vis) then begin
vis(@VisitSource, Self, d) vis(@VisitSource, Self, d);
// FIXME: Intersect axisMin/Max with the union of series extents.
end
else else
Marks.SourceDef.ValuesInRange(d, FMarkValues); Marks.SourceDef.ValuesInRange(d, FMarkValues);
with FHelper do begin
FValueMin := GetTransform.AxisToGraph(axisMin);
FValueMax := GetTransform.AxisToGraph(axisMax);
end;
if Inverted then if Inverted then
for i := 0 to High(FMarkValues) div 2 do begin for i := 0 to High(FMarkValues) div 2 do begin
t := FMarkValues[i]; t := FMarkValues[i];
@ -814,10 +820,10 @@ end;
procedure TChartAxis.VisitSource(ASource: TCustomChartSource; var AData); procedure TChartAxis.VisitSource(ASource: TCustomChartSource; var AData);
var var
ext: TDoubleRect; ext: TDoubleRect;
p: TValuesInRangeParams; p: TValuesInRangeParams absolute AData;
begin begin
ext := ASource.Extent; ext := ASource.Extent;
p := TValuesInRangeParams(AData); //p := TValuesInRangeParams(AData);
p.FMin := Max(TDoublePointBoolArr(ext.a)[IsVertical], p.FMin); p.FMin := Max(TDoublePointBoolArr(ext.a)[IsVertical], p.FMin);
p.FMax := Min(TDoublePointBoolArr(ext.b)[IsVertical], p.FMax); p.FMax := Min(TDoublePointBoolArr(ext.b)[IsVertical], p.FMax);
Marks.SourceDef.ValuesInRange(p, FMarkValues); Marks.SourceDef.ValuesInRange(p, FMarkValues);