I am eager to rewrite a dash app I develop using streamlit. The only bit I am missing is the ability to react to click or select events on a chart, like updating another chart base on the click coordinates. Is it possible to do things like this in streamlit?
Hi @Alex_ml
It’s currently not directly supported in Streamlit. But you might figure an indirect way using the interactivity of some of the plotting libraries supported like Vega, Plotly or Bokeh. For inspiration see https://vega.github.io/vega-lite/examples/#interactive
is there any progress in “on click events” for the charts on streamlit?
Yes there is on click event on plotly charts.
Link below shows all and here is the code to get chart value by clicking.
import streamlit as st
import plotly.express as px
import pandas as pd
from streamlit_plotly_events import plotly_events
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
df=[]
df= pd.DataFrame(df)
df['year']= x
df['lifeExp']= y
fig = px.line(df, x="year", y="lifeExp", title='Life expectancy in Canada')
selected_points = plotly_events(fig)
a=selected_points[0]
a= pd.DataFrame.from_dict(a,orient='index')
a