Seeing ?s in hover tooltips

Hover tool is not working properly on vbar graphs. it display only values of x-axis, for y-axis value it show “???”. Below i have given my code, kindly point out me where i am going wrong?

from import show, output_file, curdoc
from bokeh.models import ColumnDataSource, FactorRange
from bokeh.plotting import figure

import numpy as np
x =np.arange(1000)
y =np.random.random(100)
source = ColumnDataSource(data=dict(x=x, y=y))

plots = figure(plot_width = 1300, plot_height = 400,tools ="hover",
               tooltips=[("Date", "@x"), ("Volume", "@y")])
plots.vbar(x, width = 1, bottom = 0, top = y)

The @foo fields refer to the name of a column in a ColumnDataSource, e.g.['foo'] However, you are not actually doing anything with the CDS you create above. Instead of passing it to vbar and using column names, you are passing literal arrays/lists to directly vbar. This causes the vbar to create an internal CDS to use, with default column names. In this case, the default column names are "x" and "top", matching the glyph parameters. But in particular, note there is no "y", which is why @y finds nothing to display. So you have two options:

  • change the call to vbar to actually use the source you made, so @y works:

    plots.vbar(x="x", top="y", width=1, bottom=0, source=source)
  • Change the tooltips to match the default columns by using @top:

    plots = figure(...,  
                   tooltips=[("Date", "@x"), ("Volume", "@top")])

Thank you @Bryan. After doing changes as you mentioned it works for me. But my real issue is with below graph, while applying “hline” mode of Hovertool it works perfectly, but while applying “vline” mode, it doesn’t work on graph rather it display hover on axis for inital and final value.

This is my data format:
     DATE        VOLUME
0  2019-04-18   18168.0 
1  2019-04-16   51630.0
2  2019-04-15   17768.0
3  2019-04-12   57049.0
4  2019-04-11   21701.0

dataframe = pd.DataFrame(data2)
if dataframe['VOLUME'].max() >= 100000:
    dataframe["VOLUME"] = dataframe["VOLUME"].__div__(100)
 dataframe["VOLUME"] = dataframe["VOLUME"]
 dataframe['DATE'] = [x.strftime("%Y-%m-%d %H:%M:%S") for x in dataframe['DATE']]

 dataframe['DATE'] = pd.to_datetime(dataframe['DATE'])
 p = ColumnDataSource( data=dict(DATE=[], VOLUME=[])) = p.from_df(dataframe)
 ts2 = figure(plot_height=200,sizing_mode='stretch_both', x_axis_type='datetime', 
       active_drag="auto", x_axis_label='DATE', y_axis_label='VOLUME')
 t1 = ts2.vbar(x ='DATE', top= 'VOLUME',width = 1, bottom = 0,  legend='volume', 
         color='red', source=p)
 ts2.grid.grid_line_alpha = 0.8
                    tooltips=[("Date", "@DATE{%F}"), ("Volume", "@VOLUME{0.2f}")],
                    formatters={"DATE": "datetime"},

  ts2.x_range.start = dataframe.DATE.min().timestamp() * 1000
  ts2.x_range.end = dataframe.DATE.max().timestamp() * 1000

Remaining images for hover as below,

@internshipdeco this seems like a separate issue. In order to keep the Disocurse organized and as useful as possible for search, can you post a new topic with a complete script that I can just run out of the box to investigate?