Is it possible to pass streams.Selection1D value to ipywidgets?

103 views Asked by At

I saw examples of pyviz streams with hv.DynamicMap only.

I need to visualize selected items streams.Selection1D() from hv.Nodes() stream - on some kind of Label or TextArea - not on DynamicMap object.

Is it possible?

1

There are 1 answers

0
Dimas51 On

Ok, I found proper approach in this post: https://github.com/holoviz/holoviz/issues/222

gNodes = hv.Nodes(nodes_data, kdims=['lon_conv', 'lat_conv','name'])
stream1 = streams.Selection1D(source=gNodes)

def listnodes(index):
    if not index:
        return hv.Table([['','','']],['Node', 'Lon','Lat']).opts(editable=False)
    nlist = gNodes.array()[stream1.index][:,2:]
    return hv.Table(nlist,['Node', 'Lon','Lat']).opts(editable=True)    

dmap = hv.DynamicMap(listnodes, streams=[stream1])
panel = pn.Row(gNodes, dmap)
panel