rh-afk
another question i just want to combine
with solara.Card("map"):
with solara.Columns([1, 2],style={"min-width": "500px", "height": "500px"}):
solara.Markdown("map")
Map.element( # type: ignore
zoom=zoom.value,
on_zoom=zoom.set,
center=center.value,
on_center=center.set,
scroll_wheel_zoom=True,
#crs=my_projection,
toolbar_control=False,
#layers=[
)
@solara.component def Layout(children): route, routes = solara.use_route() return solara.AppLayout(children=children)
)
@solara.component def Layout(children): route, routes = solara.use_route() return solara.AppLayout(children=children)
6 replies
another question i just want to combine
@solara.component
def Page():
solara.Title("Test") with solara.Column(): filter, _set_filter = solara.use_cross_filter(id(df))
with solara.Sidebar(): solara.Markdown("## Test") solara.Markdown(f"Market set to: {marker_location.value}", style={"color": "#6e6e6e"}) def location_changed(location): # do things with the location marker_location.set(location) def goto_marker(): center.value = marker_location.value zoom.value = 13 def reset_view(): center.value = center_default zoom.value = zoom_default solara.SliderInt(label="Zoom level", value=zoom, min=1, max=16) with solara.Row(): solara.Button(label="Zoom to marker", on_click=goto_marker) solara.Button(label="Reset view", on_click=reset_view) with solara.Card("Test Filter"): with solara.Columns([2, 2]): filter, _set_filter = solara.use_cross_filter(id(df))
solara.CrossFilterSelect(df, "class") solara.CrossFilterSelect(df, "name") solara.CrossFilterSlider(df, "Time", mode=">=")
dff = df.loc[filter] if filter is not None else df with solara.Columns([2, 2]): class Map(leafmap.Map): def init(self, kwargs): super().init(kwargs)
self.add_points_from_xy( dff, x="lon", y="lat", spin=True, add_legend=True, )
solara.CrossFilterDataFrame(dff) solara.FigurePlotly(px.histogram(dff, "Time"))
solara.Title("Test") with solara.Column(): filter, _set_filter = solara.use_cross_filter(id(df))
with solara.Sidebar(): solara.Markdown("## Test") solara.Markdown(f"Market set to: {marker_location.value}", style={"color": "#6e6e6e"}) def location_changed(location): # do things with the location marker_location.set(location) def goto_marker(): center.value = marker_location.value zoom.value = 13 def reset_view(): center.value = center_default zoom.value = zoom_default solara.SliderInt(label="Zoom level", value=zoom, min=1, max=16) with solara.Row(): solara.Button(label="Zoom to marker", on_click=goto_marker) solara.Button(label="Reset view", on_click=reset_view) with solara.Card("Test Filter"): with solara.Columns([2, 2]): filter, _set_filter = solara.use_cross_filter(id(df))
solara.CrossFilterSelect(df, "class") solara.CrossFilterSelect(df, "name") solara.CrossFilterSlider(df, "Time", mode=">=")
dff = df.loc[filter] if filter is not None else df with solara.Columns([2, 2]): class Map(leafmap.Map): def init(self, kwargs): super().init(kwargs)
self.add_points_from_xy( dff, x="lon", y="lat", spin=True, add_legend=True, )
solara.CrossFilterDataFrame(dff) solara.FigurePlotly(px.histogram(dff, "Time"))
6 replies
another question i just want to combine
my example dataframe like this (just a dummy data):
df=pd.DataFrame(data={'class': [1, 2,3,25], 'name':['A1','A2','A3','A4'],'Time': [10, 20,30,40],'lat':[40.741895,40.73098527339601,40.66905379201422,-0.22470045920182688],'lon':[-73.989308,-74.12560713330078,-74.1163374189453,114.96660935839847]},dtype=np.int8)
zoom = solara.reactive(zoom_default)
center = solara.reactive(center_default)
marker_location = solara.reactive(center_default)
#map_name = solara.reactive(list(maps)[0])
6 replies