Often you will want to filter event streams (e.g. to throttle them so that you only get a signal every 5 seconds or so), or combine them.

A single event stream is defined as described above.

Streams can be filtered so that not all events trigger a signal. In the picture below, the top stream is the original and the bottom stream is the one that gets through to the signal. For example, a click event is only allowed to get into the target stream if the click is in a place that is at least 300 pixels from the left of the screen, and the price in the dtaset is smaller than 500.

You can also filter events in a stream by whether or not they are between two other events. In this example, only mousemoves that are between a mousedown and mouseup are passed on. This is basically a drag.

You can merge different streams into one.

And finally you can also throttle event streams so that only a certain number of events get through in a given period of time.

Exercise - Change the previous plot (which displays the mouse position) so that it only gets shown when the mouse is both pressed and dragged.