A Streamlit component to display ECharts.
Project description
streamlit-echarts
A Streamlit component to display ECharts.
Installation instructions
uv pip install streamlit-echarts
Development install (editable)
When developing locally, install in editable mode so Streamlit picks up Python code changes without rebuilding a wheel:
uv pip install -e . --force-reinstall
For frontend (TypeScript/React) changes, you still need to rebuild. Use Vite's watch mode for automatic rebuilds on save:
cd streamlit_echarts/frontend
npm run dev
Usage instructions
import streamlit as st
from streamlit_echarts import st_echarts
options = {
"xAxis": {
"type": "category",
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
"yAxis": {"type": "value"},
"series": [{"data": [820, 932, 901, 934, 1290, 1330, 1320], "type": "bar"}],
}
st_echarts(options=options, height="400px")
Using with PyECharts
The v2 version of streamlit-echarts intentionally drops the pyecharts and simplejson dependencies to keep the package lightweight. You can still easily render PyECharts figures by dumping their configuration to JSON and passing it as a dictionary:
import json
import streamlit as st
from pyecharts import options as opts
from pyecharts.charts import Bar
from streamlit_echarts import st_echarts
b = (
Bar()
.add_xaxis(["Microsoft", "Amazon", "IBM", "Oracle", "Google", "Alibaba"])
.add_yaxis(
"2017-2018 Revenue in (billion $)", [21.2, 20.4, 10.3, 6.08, 4, 2.2]
)
.set_global_opts(
title_opts=opts.TitleOpts(
title="Top cloud providers 2018", subtitle="2017-2018 Revenue"
)
)
)
# Render by converting the PyECharts instance to a JSON dictionary
st_echarts(options=json.loads(b.dump_options()), height="500px")
Demo Application
A comprehensive demo application containing dozens of ECharts and PyECharts examples is available in the root of the repository. You can use it as an integration test to verify the component's functionality:
Note: You will need extra dependencies installed to run all examples in the demo:
uv pip install pyecharts pandas faker
streamlit run demo_app.py
Build and Publish
To package this component for distribution:
-
Build the frontend assets (from
streamlit_echarts/frontend):npm i --legacy-peer-deps npm run build
-
Build the Python package (from the project root):
uv build -
Publish to PyPI:
uv publishYou will need a PyPI API token. You can pass it via
--tokenor set theUV_PUBLISH_TOKENenvironment variable.To bump the version, edit
versioninpyproject.tomlbefore building.
Requirements
- Python >= 3.10
- Node.js >= 24 (LTS)
Expected output
dist/streamlit_echarts-0.5.0-py3-none-any.whldist/streamlit_echarts-0.5.0.tar.gz
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_echarts-0.5.0.tar.gz.
File metadata
- Download URL: streamlit_echarts-0.5.0.tar.gz
- Upload date:
- Size: 779.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec026e361de9aa6478cb9f9a573cd62b72b0b4192901ff1a8a240839c4aa90b
|
|
| MD5 |
f7055111cbec0810b2393f800d4b2835
|
|
| BLAKE2b-256 |
a42281789e408893fb64a8c5cb6af61f3cc787db56c425a6efa5b0be65257c00
|
File details
Details for the file streamlit_echarts-0.5.0-py3-none-any.whl.
File metadata
- Download URL: streamlit_echarts-0.5.0-py3-none-any.whl
- Upload date:
- Size: 786.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4ac403eb1975ffb86b501a2350935d71392e0f74e0c061f47b43f95a2c8ae9
|
|
| MD5 |
f98c98d76eadf35ff28c9f2e215be3a1
|
|
| BLAKE2b-256 |
3a9ee2eb25cceae0b197f3c30bde22a6c9ace128553a546f26a581cac9e50a3e
|