πΌοΈΒ Β Chart container
Submitted by Arnaud Miribel
Summary
Embed your chart in a nice tabs container to let viewers explore and export its underlying data.
Functions
chart_container
Embed chart in a (chart, data, export, explore) tabs container to let the viewer explore and export its underlying data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
DataFrame
|
Dataframe used in the dataframe tab. |
required |
tabs |
Sequence
|
Tab labels. Defaults to ("Chart π", "Dataframe π", "Export π"). |
('Chart π', 'Dataframe π', 'Export π')
|
export_formats |
Sequence
|
Export file formats. Defaults to ("CSV", "Parquet") |
_SUPPORTED_EXPORT_KEYS
|
Source code in src/streamlit_extras/chart_container/__init__.py
Import:
- You should add this to the top of your .py file
Examples
example_one
def example_one():
chart_data = _get_random_data()
with chart_container(chart_data):
st.write("Here's a cool chart")
st.area_chart(chart_data)
Output (beta)
example_two
def example_two():
chart_data = _get_random_data()
with chart_container(chart_data):
st.write(
"I can use a subset of the data for my chart... "
"but still give all the necessary context in "
"`chart_container`!"
)
st.area_chart(chart_data[["a", "b"]])