Beautiful, interactive charts in notebooks with Apache ECharts' powerful declarative API
Project description
notecharts
notecharts is an ultra-lightweight, zero-config wrapper for Apache ECharts in Jupyter environments. It brings the full power of ECharts' declarative JSON-like API directly into Python notebooks without the bloat.
Why notecharts?
If you've used ECharts in Python before, you likely encountered two extremes:
- pyecharts: Powerful, but wraps the API in a deep "Pythonic" abstraction that often deviates from the official ECharts documentation, making it hard to translate JS examples to Python.
- ipecharts: Often lacks the interactivity or ease of use, API is buggy or unclear sometimes.
notecharts bridges this gap. It provides a thin layer that allows you to write ECharts options exactly as they appear in the official docs, while handling the heavy lifting of library loading, font injection, and serialization.
Key Features
- Declarative API: Pass a dictionary, get a chart. No complex class hierarchies to learn.
JSCodeSupport: Inject raw JavaScript functions for formatters, tooltips, and custom logic.- Smart Font Discovery: Automatically detect
fontFamilydeclarations in your options fetch the corresponding fonts (if available) from Google Fonts. - Pre-built Modern Charts: Includes high-level classes like
Bar,Line,Scatter,Donut, andRadarwith beautiful default harmonies. - Environment Agnostic: Works seamlessly in VS Code, JupyterLab, and Google Colab.
Installation
pip install notecharts
Usage
The Declarative Way (Total Control)
If you can find an example on the ECharts Gallery, you can run it in notecharts.
from notecharts import Chart, JSCode
options = {
"title": {"text": "Basic Chart"},
"xAxis": {"data": ["Mon", "Tue", "Wed", "Thu", "Fri"]},
"yAxis": {},
"series": [{
"type": "bar",
"data": [23, 24, 18, 25, 27], # or any other object/variable
"label": {
"show": True,
"formatter": JSCode("function(p) { return p.value + ' units'; }")
}
}],
"textStyle": {
"fontFamily": "Inter" # Automatically loaded from Google Fonts!
}
}
Chart(options).display()
The Quick Way (Pre-built Charts)
Use the pre-configured classes for common visualizations with aesthetic defaults.
import pandas as pd
from notecharts import Bar
df = pd.DataFrame({ # or a list-of-lists, list-of-dicts format
"Day": ["Mon", "Tue", "Wed"],
"Sales": [150, 230, 224]
})
Bar(df, x="Day", y="Sales", title="Weekly Sales", theme="dark").display()
Important Considerations
- Security: Use of
JSCodeallows for arbitrary JavaScript execution in the browser/notebook context. Always ensure you are passing trusted code and data to your charts. - Connectivity: This library is ultra-lightweight because it does not ship with the ECharts binaries. It fetches them from
cdn.jsdelivr.netat runtime, so an active internet connection is required to render charts.
License & Attribution
- notecharts is licensed under the MIT License.
- Apache ECharts: This library is a wrapper for Apache ECharts (incubating), which is licensed under the Apache License 2.0.
- Apache ECharts, ECharts, Apache, the Apache feather, and the Apache ECharts project logo are either registered trademarks or trademarks of the Apache Software Foundation.
References
See the ECharts gallery for bespoke examples, or the official docs for an in-depth exaplanation of the options available.
Project details
Release history Release notifications | RSS feed
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 notecharts-0.1.0.tar.gz.
File metadata
- Download URL: notecharts-0.1.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de19b31ed5f3374b88d1bc2d2eaa64afac6b747741778ff03b7a57db3c1eab5
|
|
| MD5 |
b5f962823e9885207abc5d59ac19c240
|
|
| BLAKE2b-256 |
8c19e5cdc77c10fee499494faf747ebae2432bd74d563bb398ea717f00c5a865
|
File details
Details for the file notecharts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: notecharts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bee0150d7fd897642ea809bfb21982a3865fe9f8f8b258766325c5472082def0
|
|
| MD5 |
30342c1933eb143b24daf42f8b7b3605
|
|
| BLAKE2b-256 |
5bf95b6a43e5edc47008616e7f56995dfc449fbdd2342b8acee2ab2ab65ad047
|