0

I am creating a stacked area chart in holoviews with bokeh backend, similarly to the example here: http://holoviews.org/reference/elements/matplotlib/Area.html

I would like to have a Hover tooltip but if I add it to the code, the resulting chart shows the hover cross but no data is displayed in the tooltip.

My code:

import holoviews as hv
values = np.random.rand(5, 20)
percentages = (values/values.sum(axis=0)).T*100

overlay = hv.Overlay([hv.Area(percentages[:, i], vdims=[hv.Dimension('value', unit='%')]).opts(tools=["hover"]) for i in range(5)])
stackA =  hv.Area.stack(overlay)

I also tried putting the hover option in the hv.Stack step instead:

stackA =  hv.Area.stack(overlay).opts(tools=["hover"])

but this does nothing.

I would like the hover tooltip to show the area value below the cursor and potentially other dimensions of my dataset.

AleAve81
  • 275
  • 3
  • 8

1 Answers1

2

This is a known issue: https://github.com/pyviz/holoviews/issues/3187. The same is valid for the Spread element.

The reason is (my guess) that bokeh has no hovertool for Patch, which is the glyph used to render Area and Spread elements: https://stackoverflow.com/a/53384398. So at the moment your best bet is probably trying to implement the vectorized workaround proposed in that stackoverflow answer in holoviews/plotting/bokeh/chart.py.

doppler
  • 997
  • 5
  • 17