HoverTool "vline" interpolation with "$~" data gets error when plot line is horizontal

Hi,

I have found a bug for hovertool when plot is horizontal and hover is defined with mode vline and line policy interpolation for data ~x and ~y. When hover gets to the horizontal part of the plot ‘x’ and ‘y’ data becomes ‘null’ and the tooltip goes to axis origin. Also when this origin are panned out from plot the application gets an error and the tooltip doesn’t show up.

With vline mode, the data isn’t calculated by intersection between a curve defined by points (x0,y0) and (x1,y1) and the crosshair vertical line? If so, then it should not be detected the horizontal case in which intersection will have an angle of 90º?

By inspecting the hovertool JS source code I saw that there are 2 major functions to make this calculation:

  1. v_map_from_target from linear_mapper.coffee
  2. check_2_segments_intersect from hittest.coffee

To find a solution in 2) I need to understand 1) but I don’t get it. Can someone explain to me, please?

Thanks,
Corleo

hover_vline_interpolation_bug.ipynb (81.3 KB)