Is there a built-in function (similar to the Cursor) that measures distance? For instance, on an OHLC chart, click-hold a location on the chart, drag to second point... the result would be the number of Bars and the Difference Value.
Typically, this would be used to determine time and amount of a move.
There are APIs XYChart.getXValue and XYChart.getYValue that tells you the x and y data values at a mouse position. For the two points, you can use these APIs to obtain the x and y data values at those points. The difference is the number of bars and the change in the y value. See: