1

I am having a problem with the bokeh bar chart. Here is my code:

from bkcharts import Bar
from bokeh.models import FactorRange

# Make Bokeh Push push output to Jupyter Notebook.
from bokeh.io import push_notebook, show, output_notebook
from bokeh.resources import INLINE
output_notebook(resources=INLINE)

from bokeh.models import HoverTool

data = {
    'name' : [chan['name'] for chan in full_channels_info],
    'members' : [chan['num_members'] for chan in full_channels_info]
}

hover = HoverTool(tooltips=[
    ("Channel", "@name"),
    ("Users", "@members"),
])

chart = Bar(data, values='members', label='name',
      title="Channels population", plot_width=1000, xlabel="Channel", ylabel="Members",
            legend=None, tools=[hover])

show(chart)

The problem being that when I hover over one of the bars, the tooltip looks like this:

enter image description here

Andrea
  • 302
  • 2
  • 6
  • 12

1 Answers1

3

The issue is that in HoverTool() you should refer to @height instead of @members.

hover = HoverTool(tooltips=[
    ("Channel", "@name"),
    ("Users", "@height"),
])
tuomastik
  • 4,559
  • 5
  • 36
  • 48