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

Implement stream.from_param #6396

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Implement stream.from_param #6396

wants to merge 2 commits into from

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Sep 27, 2024

Closes #6384

Wondering how to bidirectionally link it.

Currently, the widgets can update the point location, but tapping does not update the widgets

Screen.Recording.2024-09-27.at.2.36.22.PM.mov
import param
import holoviews as hv
import panel as pn

pn.extension()

class TapTest(pn.custom.PyComponent):

    x = param.Number(default=1, allow_refs=True)
    y = param.Number(default=0.5, allow_refs=True)

    def __init__(self, **params):
        super().__init__(**params)

        self._tap = hv.streams.Tap.from_param(x=self.param.x, y=self.param.y)
        hv_pane = pn.pane.HoloViews(object=hv.DynamicMap(self.plot, streams=[self._tap]))
        self._layout = pn.Column(hv_pane, self.param.x, self.param.y)

    def plot(self, x, y):
        return hv.Points([(x, y)]).opts(tools=['tap'], xlim=(0, 2), ylim=(0, 2))

    def __panel__(self):
        return self._layout

tap_test = TapTest()
tap_test.show()

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.48%. Comparing base (017361b) to head (04e07fc).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/streams.py 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6396      +/-   ##
==========================================
- Coverage   88.48%   88.48%   -0.01%     
==========================================
  Files         323      323              
  Lines       68459    68466       +7     
==========================================
+ Hits        60579    60582       +3     
- Misses       7880     7884       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ahuang11 ahuang11 added the type: enhancement Minor feature or improvement to an existing feature label Oct 5, 2024
@ahuang11 ahuang11 closed this Oct 22, 2024
@ahuang11 ahuang11 reopened this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot link tap to float slider
2 participants