Issue with TNearestTool and THorizAreaSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Issue with TNearestTool and THorizAreaSeries

Post by johnnix » Thu May 12, 2011 12:25 pm

Hello,

I am using TChart 2010.01.11004 and just noticed a strange behavior. When moving the mouse over a THorizAreaSeries with a TNearestTool enabled, in some cases the cursor jumps to the last point of the Series although it is over or near another point. To reproduce this error do:

1. Start a new application
2. Drop a TChart and add a THorizAreaSeries
3. Add a TNearestTool
4. Left axis is inverted
5. Fill with some sample data

Can anyone please conform this and let me know of a fix?

Kindest regards

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by Sandra » Fri May 13, 2011 11:17 am

Hello johnnix,

I couldn't reproduce your problem using last version of TeeChartVCL. I inform that in download page there are a new version of TeeChartVCL (Build 2011.03.30407). Please update your version and try again if your project persist.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by johnnix » Fri May 13, 2011 12:11 pm

Hello,

Thank you very much for your email. Unfortunately I am reluctant to update my version but will download the sources and try to figure out if something changed....

Kindest regards

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by Sandra » Fri May 13, 2011 2:14 pm

Hello jhonnix,

I inform you that this problems were a bugs with numbers (TV52015282andTV52015313) and we fixed in maintenance release 2010.02 of TeeChartVCL. I think you can take a look in this link where explain, how solve the two bugs. On the other hand, if pervious link doesn't help you to solve your problem with TNearestTool I recommend see in TeeTools.pas concretely in NearestTool.GetNearestPoint function, so is unlikely the problem is here.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by johnnix » Sat May 14, 2011 9:49 am

Hello Sandra,

Thank you very much for your support. Indeed I too traced the error somewhere in the ClickedPoint but my guess is that the error is maybe inside the PointInArea (the code from the link you provided did not solve the problem). Anyway I will keep looking :)

Kindest regards

johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by johnnix » Sat May 14, 2011 9:57 am

Hello,

Here is an update. The following code works ok but I do not know if it has any impact in any other series. So it is the PointInArea after all :D

Code: Select all

if (Index>=tmpFirst) and ClickableLine then
       if CheckPointInLine then // or (FDrawArea and PointInArea(Index)) then
         if GetHorizAxis.Inverted then
            result:=Succ(Index)
         else
            result:=Pred(Index);
Kindest regards

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

Re: Issue with TNearestTool and THorizAreaSeries

Post by Yeray » Mon May 16, 2011 2:58 pm

Hello johnnix,

I think your modification could break the previous behavior. Let me explain:
Having a TLineSeries, when the mouse pointer is over a line, the predecessor index is returned, even if the successor is nearer because it is considered as part of the predecessor point. The same behavior is applied with TBarSeries and TAreaSeries, when the mouse is over a part of the series, the predecessor index is taken even if the successor is nearer.

I've added to the wish list the possibility to add a new property (it could be called AbsoluteNearest for example) that would make the clicked method to return -1 when the mouse is over the area so the TNearestTool will look for the nearest point (TV52015566). So for the area series it would be something like this:

Code: Select all

if CheckPointInLine or (FDrawArea and (not FAbsoluteNearest) and PointInArea(Index)) then
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

johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by johnnix » Tue May 17, 2011 5:01 am

Hello Yeray,

Thank you very much for your reply. I will try to modify my sources in order to include this new property.

Kindest regards

johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Re: Issue with TNearestTool and THorizAreaSeries

Post by johnnix » Tue Jun 14, 2011 6:32 am

Here is an update, if I set ClickableLine to false then it works ok :)

Post Reply