TDragPointTool always favoures the "left" point

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Whookie
Newbie
Newbie
Posts: 25
Joined: Fri Jan 07, 2011 12:00 am

TDragPointTool always favoures the "left" point

Post by Whookie » Fri Apr 25, 2014 3:26 pm

Hi!
I'm using a TChart with one LineSeries and a TDragPointTool but grapping the series and moving the point (I just allow moving it in Y-direction) always uses the point left of the mouse-position (in the example image, if you grap the series one pixel to the left of the y:0-mark you begin to move the y:-1 mark!!).

I think it would be good to have an option to either restrain the drag-operation to the mark itself or center the sensitiv area over a point (eg.: -0.5 to 0.5 move the y:0-mark).

I'm also missing an option to restrict movement beyond some values (like the minima/maxima of the left axis in the example). Maybe an OnDragPointAllow(Sender, Index, Var Cancel: Boolean) - event could be implemented?
Attachments
left.png
left.png (4.62 KiB) Viewed 3680 times

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TDragPointTool always favoures the "left" point

Post by Yeray » Mon Apr 28, 2014 7:36 am

Hello,
Whookie wrote:I'm using a TChart with one LineSeries and a TDragPointTool but grapping the series and moving the point (I just allow moving it in Y-direction) always uses the point left of the mouse-position (in the example image, if you grap the series one pixel to the left of the y:0-mark you begin to move the y:-1 mark!!).

I think it would be good to have an option to either restrain the drag-operation to the mark itself or center the sensitiv area over a point (eg.: -0.5 to 0.5 move the y:0-mark).
I've added it to the wish list to be further investigated. I think looking for what of the two valueindex of the clicked line segment is the nearest to the mouse click should work better:
http://bugs.teechart.net/show_bug.cgi?id=748
Feel free to add you mail to the CC list to be automatically notified when an update arrives.
Whookie wrote:I'm also missing an option to restrict movement beyond some values (like the minima/maxima of the left axis in the example). Maybe an OnDragPointAllow(Sender, Index, Var Cancel: Boolean) - event could be implemented?
There's a OnDragPoint event for the TDragPointTool you could use to restrict this. Ie:

Code: Select all

var tmpMin, tmpMax: Double;

procedure TForm1.FormCreate(Sender: TObject);
begin
  tmpMin:=Chart1[0].YValues.MinValue;
  tmpMax:=Chart1[0].YValues.MaxValue;
end;

procedure TForm1.ChartTool1DragPoint(Sender: TDragPointTool;
  Index: Integer);
begin
  if ((Index>-1) and (Chart1[0].YValue[Index]>=tmpMax)) then
    Chart1[0].YValue[Index]:=tmpMax;

  if ((Index>-1) and (Chart1[0].YValue[Index]<=tmpMin)) then
    Chart1[0].YValue[Index]:=tmpMin;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply