Hi, I want to interactively select two ranges on a timeseries curve for further processing. I tried to use to streams that link to the same source curve and overlay the dmaps. I expect to see multiple range select tools for each of them. However, I only have one selection tool that set the ranges of both streams simultaneously. I wonder whether there is an easy way to achieve this function?
import holoviews as hv import numpy as np hv.extension("bokeh") x = np.arange(100) y = np.random.random(x.shape) curve = hv.Curve((x, y)) boundsx1 = hv.streams.BoundsX(source=curve, boundsx=(0,0)) boundsx2 = hv.streams.BoundsX(source=curve, boundsx=(0,0)) def get_range_func(name, color="b"): def _range(boundsx): y = 0 x = boundsx return hv.Overlay([ hv.VSpan(boundsx, boundsx).opts(color=color), hv.Text(x, y, name) ]) return _range dmap1 = hv.DynamicMap(get_range_func("Range1", "b"), streams=[boundsx1]) dmap2 = hv.DynamicMap(get_range_func("Range2", "g"), streams=[boundsx2]) fig = curve * dmap1 * dmap2 fig.opts(responsive=True, height=400)
My expectation: There were two box-select tools on the tool bar for each stream, so the two ranges are not linked all the time.