holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

Hover tooltips only show up on first element values

Open hoxbro opened this issue 7 months ago • 1 comments

With the following code, the hover tooltip only shows up for the first element:

https://github.com/holoviz/holoviews/assets/19758978/b543164c-d1fa-44b2-a4b1-c17c3fb017d4

import holoviews as hv
import pandas as pd
import panel as pn

hv.extension("bokeh")

color_dim = hv.dim("category").categorize(
    categories={"B": "red", "A": "blue", "C": "green"}, default="grey"
)
data = pd.DataFrame(
    {"x": range(5), "y": range(5), "category": ["A", "B", "A", "C", "B"]}
)


def inner(value):
    el = (
        hv.Dataset(data)
        .to(hv.Points, kdims=["x", "y"], groupby="category")
        .opts(tools=["hover"], size=10)
    )
    if value:
        el = el.get(value)
    el.opts(color=color_dim, show_legend=False, xlim=(-1, 6), ylim=(-1, 6))
    return el.overlay()


w1 = pn.widgets.MultiSelect(value=["A"], options=list("ABC"))
pn.Column(w1, hv.DynamicMap(inner, streams=[w1.param.value])).servable()

If I change the default value of the widget to A and B, those values show up.

hoxbro avatar Nov 09 '23 14:11 hoxbro