Welcome to the Xceed Community | Help
Community Search  
More Search Options

Relate mouse click to data point

Sort Posts: Previous Next
  •  11-25-2009, 4:07 AM Post no. 24981

    Relate mouse click to data point

    Hi all,

    I have a GridSurface chart. When the mouse is clicked, is it possible to find out the nearest data point to that click? The "Viewport to Scale" demo with "Clamp values to ruler" checked shows there is some support to take the nearest 'point of interest' from a click, but can you map that all the way back to the data source?

     Steve 

  •  12-16-2009, 5:42 PM Post no. 25238 in reply to 24981

    Re: Relate mouse click to data point

    Hi Steve,

    There is a method that will return the data point informations when a mouse is right over the data point but there is no method built-in that would return the nearest point to a mouse click.  

    On the other hand, it is certainly possible through programming to determine what is the nearest data point when you click the mouse button.  Suppose you have 5 points in a 3D space, P(1)=[1,1,1], P(2)=[2,2,2], ....., P(5)=[5,5,5].  If you click your mouse on some plane, and that coordinate is P(M)=[2,3,4], you just have to scan through all the points P(n) and compute the Distance(n) = SquareRoot((P(M)[ X ]-P(n)[ X ])²+(P(M)[ Y ]-P(n)[ Y ])²+(P(M)[ Z ]-P(n)[ Z] )²). The smallest distance will tell you which point is the nearest to your mouse, in this case, D(3) = SquareRoot((2-3)²+(3-3)²+(4-3)²) = SQRT(2)

    Best regards,


    Ghislain
    Technical Support and software developer
    Xceed Software Inc.
    Knowledge Base : http://xceed.com/kb/
    Update Center : http://xceed.com/updates/
    Documentation Center : http://xceed.com/doc/
    For everything else, there is Google
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.