Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No hover is shown if rasterized inside dynamicmap using apply_when-like logic #6382

Open
ahuang11 opened this issue Sep 20, 2024 · 2 comments
Labels
TRIAGE Needs triaging

Comments

@ahuang11
Copy link
Collaborator

import holoviews as hv
import random


def plot(x_range, y_range):
    points = hv.Points(([0, 0], [0, 0])).opts(
        tools=["hover"], projection=ccrs.GOOGLE_MERCATOR
    )
    if random.choice([True, False]) or x_range is None:
        points = rasterize(points, dynamic=False)
    return hv.Overlay(
        [
            points,
        ]
    ).opts("Points", tools=["hover", "box_select"])


hv.DynamicMap(plot, streams=[hv.streams.RangeXY()])
image

Hover doesn't work if rasterized first.

It works if not rasterized first.
image

@ahuang11 ahuang11 added the TRIAGE Needs triaging label Sep 20, 2024
@ahuang11 ahuang11 changed the title No hover if apply_when rasterize inside dynamicmap No hover is shown if rasterized inside dynamicmap using apply_when-like logic Sep 20, 2024
@ahuang11
Copy link
Collaborator Author

The not-so-workaround is setting points alpha to 0, but I'm sure it has performance implications.

import holoviews as hv
import random


def plot(x_range, y_range):
    points = hv.Points(([0, 0], [0, 0])).opts(
        tools=["hover"], projection=ccrs.GOOGLE_MERCATOR
    )
    raster = rasterize(points, dynamic=False)
    if len(points > 1000):
        points.opts(alpha=0)
    return points * raster

hv.DynamicMap(plot, streams=[hv.streams.RangeXY()])

@hoxbro
Copy link
Member

hoxbro commented Sep 20, 2024

I think this is the same underlying issue as reported in #5981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TRIAGE Needs triaging
Projects
None yet
Development

No branches or pull requests

2 participants