Adding Interactivity with Widgets
To make your dashboards interactive and responsive to user input, Streamlit provides a variety of widgets. These widgets allow users to control parameters, filter data, or provide information directly through the app interface. Some of the most commonly used widgets include st.slider, st.selectbox, and st.text_input.
- The
st.sliderwidget lets users select a numeric value or range by moving a slider; - The
st.selectboxallows users to choose a single option from a dropdown list; - The
st.text_inputwidget enables users to enter freeform text.
By incorporating these widgets, you can build dashboards that react instantly to user choices, making the data exploration experience much more engaging and tailored.
In this example, the st.slider widget gives users control over the number of bins in the histogram. When a user moves the slider, the value of num_bins updates instantly. This value is then used to set the bins parameter in the ax.hist function, which redraws the histogram with the new bin count. As a result, the chart displayed in the dashboard updates in real time based on the user's selection, demonstrating how widget values can be directly used to make dashboard content interactive and dynamic.
Obrigado pelo seu feedback!
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Incrível!
Completion taxa melhorada para 11.11
Adding Interactivity with Widgets
Deslize para mostrar o menu
To make your dashboards interactive and responsive to user input, Streamlit provides a variety of widgets. These widgets allow users to control parameters, filter data, or provide information directly through the app interface. Some of the most commonly used widgets include st.slider, st.selectbox, and st.text_input.
- The
st.sliderwidget lets users select a numeric value or range by moving a slider; - The
st.selectboxallows users to choose a single option from a dropdown list; - The
st.text_inputwidget enables users to enter freeform text.
By incorporating these widgets, you can build dashboards that react instantly to user choices, making the data exploration experience much more engaging and tailored.
In this example, the st.slider widget gives users control over the number of bins in the histogram. When a user moves the slider, the value of num_bins updates instantly. This value is then used to set the bins parameter in the ax.hist function, which redraws the histogram with the new bin count. As a result, the chart displayed in the dashboard updates in real time based on the user's selection, demonstrating how widget values can be directly used to make dashboard content interactive and dynamic.
Obrigado pelo seu feedback!