Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-10

TAChart - OnDrawReticule event problem

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pierre

Hi all,

I'm trying to use the TAChart under 0.9.28.1 (I downloaded "Lazarus-0.9.28.1-21932-fpc-2.2.4-20091001-win32.exe").

I have a problem the OnDrawReticule event. It's never called :( I take a look at the source and I find that in the "UpdateReticule" procedure (line 914 of TAGraph) the function "GetNearestPoint" is called but it always return False.

UpdateReticule contain:
--------------------------------------------------

    for i := 0 to SeriesCount - 1 do begin
      if
        Series[i].GetNearestPoint(
          DIST_FUNCS[FReticuleMode], APoint, pointIndex, newRetPos, value) and
        (newRetPos  FReticulePos) and PtInRect(FClipRect, newRetPos)
      then begin
        DoDrawReticule(i, pointIndex, newRetPos, value);
        DrawReticule(Canvas);
        FReticulePos := newRetPos;
        DrawReticule(Canvas);
        exit;
      end;
    end;

-------------------------------------------------- As you can see DoDrawReticule is called only the result of the IF is true.

The problem is that function "GetNearestPoint" contain:

--------------------------------------------------
function TBasicChartSeries.GetNearestPoint(
  ADistFunc: TPointDistFunc; const APoint: TPoint;
  out AIndex: Integer; out AImg: TPoint; out AValue: TDoublePoint): Boolean;
begin
  Unused(ADistFunc, APoint);
  AIndex := 0;
  AImg := Point(0, 0);
  AValue.X := 0;
  AValue.Y := 0;
  Result := false;
end;
--------------------------------------------------

and the procedure "Unused" contain:

--------------------------------------------------
procedure Unused(const A1, A2);
begin
end;
--------------------------------------------------

And the Result of the function is always false.

So the OnDrawReticule event is never called! Normal? This feature was working in 0.9.26.

Regards,

Reply by email

Alexander Klenin
to Pierre
Pierre wrote 5 lines
Hi all, I'm trying to use the TAChart under 0.9.28.1 (I downloaded "Lazarus-0.9.28.1-21932-fpc-2.2.4-20091001-win32.exe"). I have a problem the OnDrawReticule event. It's never called :(

Hm, it works for me. Please see components/tachart/basic/demp.lpi as a demo project.
If it does not help, please post a complete minimal project showing the problem. Without such a project, I can guess that you either use wrong series type (e.g. TPieSeries can not show reticule) or forget to set ReticuleMode property.

I take a look at the source and I find that in the "UpdateReticule" procedure (line 914 of TAGraph) the function "GetNearestPoint" is called but it always return False.

[skip code analysis]

GetNearestPoint is a virtual function, so you should look at the override in the series type you actually use, not at basic empty stub.

Alexander S. Klenin

Reply by email