Page 1 of 1

Zoom gets activated when clicking on a series

Posted: Mon Jan 27, 2014 1:40 pm
by 16567478
Hello!

I have a TChart with a TPointSeries on it.
I activated zoom on the TChart.
On the PointSeries I have a SeriesClickPointer event. So when I click on a node on the PointSeries it triggers a popup of a presentation form with info about the "ValueIndex" node clicked.
This all works fine, but when I close the presentation form my TChart is in zoom mode, that means my next klick on another node on the PointSeries does not trigger the SeriesClickPointer event, instead it zooms my chart.

Please help with this. I dont understand why the click event on a node on the series still activates the zoom function...

Best regards, Mikael

Re: Zoom gets activated when clicking on a series

Posted: Wed Jan 29, 2014 12:31 pm
by yeray
Hi Mikael,

You could try disabling the zoom at the OnMouseDown event, if a pointer is clicked, and re enable it at OnMouseUp event:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Chart1[0].Clicked(X,Y)>-1 then
    Chart1.AllowZoom:=false;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Chart1.AllowZoom:=true;
end;