I had problems with values returned by OnDrawReticule event. Always returns
values from last series defined on my object.
I explore this component and I found this:
procedure TReticuleTool.MouseMove(APoint: TPoint);
.
.
.
for i := 0 to FChart.SeriesCount - 1 do
if FChart.Series[i].GetNearestPoint(df, APoint, pointIndex, newRetPos,
value) and
PtInRect(FChart.ClipRect, newRetPos)
then begin
d := df(APoint, newRetPos);
if d < minDist then begin
bestRetPos := newRetPos;
bestSeries := i;
minDist := d;
end;
end;
...
I think that would work something like this:
for i := 0 to FChart.SeriesCount - 1 do
if FChart.Series[i].GetNearestPoint(df, APoint, pointIndex, newRetPos,
value) and
PtInRect(FChart.ClipRect, newRetPos)
then begin
d := df(APoint, newRetPos);
if d < minDist then begin
bestRetPos := newRetPos;
bestSeries := i;
bestPoint := pointIndex;
bestValue := value;
minDist := d;
end;
end;
if (minDist < Infinity) and (bestRetPos <> FChart.ReticulePos) then begin
FChart.ReticulePos := bestRetPos;
if Assigned(FChart.OnDrawReticule) then
FChart.OnDrawReticule(FChart, bestSeries, bestPoint, bestValue);
end;
Is that correct?
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus