I've modified the multi_line plot example provided on the official bokeh usage guide pages to add a HoverTool with tooltips. (Usage guide example)
from bokeh.plotting import figure, output_file, show
from bokeh.models import ColumnDataSource, HoverTool
output_file("patch.html")
plot_data=dict(
xs=[[1, 3, 2], [3, 4, 6, 6]],
ys=[[2, 1, 4], [4, 7, 8, 5]],
colors=["firebrick", "navy"],
alphas=[0.8, 0.3])
hover=HoverTool(tooltips=[
('X-Coordinate','@xs'),
('Y-Coordinate','@ys')])
dsource = ColumnDataSource(plot_data)
p = figure(plot_width=400, plot_height=400, tools=[hover, 'wheel_zoom', ])
p.multi_line('xs', 'ys', color='colors', alpha='alphas', line_width=4,
source=dsource)
show(p)
I would expect the tooltip to show the x and y coordinates of the point over which (near to) i hover the pointer. However, the tooltip contains the x and y co-ordinates of all the line points over which the pointer hovers.
Is there a way/option buried somewhere (i tried to hard to find it) to make HoverTool-tool to display the co-ordinates of a single point?
P.S. - I know that $x, $y and $sx, $sy can be used to display the screen and canvas x, y co-ordinates respectively but in my case x axis could be a datetime axis as well in which case i would want one single date in the tooltip instead of all the dates.