Skip to content

Commit

Permalink
Renamed to selection_param
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 14, 2020
1 parent 4409a57 commit d05c955
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions holoviews/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def instance(self_or_cls, **params):
@param.depends('selection_expr', watch=True)
def _update_pipes(self):
sel_expr = self.selection_expr
for pipe, ds in self._datasets:
for pipe, ds, raw in self._datasets:
ref = ds._plot_id
self._cache[ref] = ds_cache = self._cache.get(ref, {})
if sel_expr in ds_cache:
Expand All @@ -250,24 +250,26 @@ def _update_pipes(self):
ds_cache.clear()
sel_ds = SelectionDisplay._select(ds, sel_expr, self._cache)
ds_cache[sel_expr] = sel_ds
pipe.event(data=sel_ds.data)
pipe.event(data=sel_ds.data if raw else sel_ds)

def pipe(self, data):
def selection_param(self, data):
"""
Returns a parameter which reflects the current selection
when applied to the supplied data, making it easy to create
a callback which reflects the current selection.
a callback which depends on the current selection.
Args:
data: A Dataset type or data which can be cast to a Dataset
Returns:
A parameter which reflects the current selection
"""
raw = False
if not isinstance(data, Dataset):
raw = True
data = Dataset(data)
pipe = Pipe(data=data.data)
self._datasets.append((pipe, data))
self._datasets.append((pipe, data, raw))
return pipe.param.data

@classmethod
Expand Down

0 comments on commit d05c955

Please sign in to comment.