Page 1 of 1

Issue with TNearestTool and THorizAreaSeries

Posted: Thu May 12, 2011 12:25 pm
by 10046032
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

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Fri May 13, 2011 11:17 am
by 10050769
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,

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Fri May 13, 2011 12:11 pm
by 10046032
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

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Fri May 13, 2011 2:14 pm
by 10050769
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,

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Sat May 14, 2011 9:49 am
by 10046032
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

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Sat May 14, 2011 9:57 am
by 10046032
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

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Mon May 16, 2011 2:58 pm
by yeray
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

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Tue May 17, 2011 5:01 am
by 10046032
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

Re: Issue with TNearestTool and THorizAreaSeries

Posted: Tue Jun 14, 2011 6:32 am
by 10046032
Here is an update, if I set ClickableLine to false then it works ok :)