how get the distance between two points

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
LucaSirri
Posts: 15
Joined: Tue Sep 16, 2008 11:48 am

how get the distance between two points

Post by LucaSirri » Wed Nov 05, 2008 3:20 pm

hello,

I have a problem... :-(

I get a point by muose click, and I need to know if this point is near a chart point (dataset point), see the image :

Image

I have a point and a dataset, there is a way to know the dataset point nearest ?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Nov 05, 2008 4:04 pm

Only by iterating through all the data items in the dataset and computing the "distance" for each one. And distance could be defined in Java2D space OR in data-space (if the axis scales are different, which is the normal case).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked