How to know which stream called?

Hello,

I’m feeding multiple streams into a DynamicMap. One of those streams is a RangeXY. My aim is to distinguish between the user applied change of the axis limits, which makes the RangeXY stream change and call the callable provided to the DynamicMap, and changes to the axes limits, because the other stream has changed the plotted data and the axes ranges where reset automatically.

Would anyone know a method how to distinguish in the DynamicMap’s callable which stream has changed so that the callable was executed?

not sure if this is the best way (and didnt test it), but if you’re working inside a Class I think you can save the values of the streams the last time the function was called (e.g. self.last_x_range = x_range, etc).

Then you can add some logic that compares the (new) incoming stream values with those of the last call and determine which one has changed (with something like set().difference(set()).

1 Like