Following the discussion on Simple Panel example of map/time series interaction for data cube?
How would I wrap the
gv.tile_sources.CartoDark() * gv.Points([-122.76, 49.555]).opts(alpha=0)
in order to make it responsive (sizing_mode="stretch_width"
) as it seems if I wrap in pn.pane.Holoviews
I get the
AttributeError: 'HoloViews' object has no attribute '_plot_id'
class Example(pn.viewable.Viewer):
def get_map(self):
return (gv.tile_sources.CartoDark() * gv.Points([-122.76, 49.555]).opts(alpha=0)).opts(width=1000)
def tap_series(self, x, y):
lon, lat = to_lon_lat(x, y)
self.figs_col.clear()
self.figs_col.append( lon )
return hv.Div(
"""<hr style="border-top: 1px transparent; height: 1px;">"""
).opts(height=5)
def __init__(self):
self.figs_col = pn.Column()
self.map = self.get_map()
self.tap_stream = hv.streams.Tap(source=self.map, x=-122.76, y=49.555)
self.dynamic_map = hv.DynamicMap(self.tap_series, streams=[self.tap_stream])
super().__init__()
def view(self):
return pn.Column(self.dynamic_map, self.figs_col)
app = Example()
template = pn.template.MaterialTemplate(
site="Panel",
title="MRE",
main=[app.map, app.view],
sidebar_width=200,
).servable()