Skip to content

Hover tooltips only show up on first element values #5981

@hoxbro

Description

@hoxbro

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

screenrecord-2023-11-09_15.42.21.mp4
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't correct or isn't working

    Type

    No type

    Projects

    Status

    Wishlist

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions