From 46f4d8292cc26336ce5498672d85a05335d4187a Mon Sep 17 00:00:00 2001 From: jlstevens Date: Sun, 16 Oct 2016 18:21:02 +0100 Subject: [PATCH] Added event method to DynamicMap --- holoviews/core/spaces.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/holoviews/core/spaces.py b/holoviews/core/spaces.py index 84a1e78ec4..9a9eaa461f 100644 --- a/holoviews/core/spaces.py +++ b/holoviews/core/spaces.py @@ -536,6 +536,22 @@ def _validate_key(self, key): raise StopIteration("Key value %s above upper bound %s" % (val, high)) + def event(self, trigger=True, **kwargs): + """ + This method allows any of the available stream parameters to be + updated in an event. + """ + stream_params = set(util.stream_parameters(self.streams)) + updated_streams = [] + for stream in self.streams: + overlap = set(stream.params().keys()) & stream_params & set(kwargs.keys()) + if overlap: + stream.update(**dict({k:kwargs[k] for k in overlap}, trigger=False)) + updated_streams.append(stream) + + if updated_streams and trigger: + updated_streams[0].trigger(updated_streams) + def _style(self, retval): """