streamlit-component-gallery / pages /charts.vega_lite_chart.py
whitphx's picture
whitphx HF staff
Copy https://github.com/whitphx/stlite/tree/main/packages/sharing-editor/public/samples/011_component_gallery
dd0ef30
raw history blame
No virus
601 Bytes
import streamlit as st
import pandas as pd
import numpy as np
@st.experimental_memo
def load_data():
df = pd.DataFrame(np.random.randn(200, 3), columns=["a", "b", "c"])
return df
df = load_data()
st.vega_lite_chart(
df,
{
"mark": {"type": "circle", "tooltip": True},
"encoding": {
"x": {"field": "a", "type": "quantitative"},
"y": {"field": "b", "type": "quantitative"},
"size": {"field": "c", "type": "quantitative"},
"color": {"field": "c", "type": "quantitative"},
},
},
use_container_width=True,
)