Hi all,
I’ve been using streamlit a lot, it’s amazing.
One thing that would be super awesome to have is to have two way communication for pydeck_chart
e.g. in Jupyter notebook:
import pandas as pd
import requests
json = requests.get(DATA_URL).json()
df = pd.DataFrame(json["features"][0]["geometry"]["coordinates"])
df.columns = ['lng', 'lat']
viewport = pdk.data_utils.compute_view(df[['lng', 'lat']])
layer = pdk.Layer(
'ScreenGridLayer',
df,
cell_size_pixels=20,
color_range=COLOR_RANGE,
get_position='[lng, lat]',
pickable=True,
auto_highlight=True)
r = pdk.Deck(layers=[layer], initial_view_state=viewport)
r.show()
and you can click on the map and get selected data by doing:
pd.DataFrame([r.deck_widget.selected_data])
is there anyway to have something like:
mychart = st.pydeck_chart(r)
then when I click on the map, I can access the data behind call back and get it by doing something like
df = pd.DataFrame([mychart.selected_data])