canvasxpress-anywidget
CanvasXpress interactive charts as notebook widgets, built on anywidget. One package renders in Jupyter, JupyterLab, Google Colab, VS Code notebooks and marimo — anywhere the anywidget protocol is supported.
The CanvasXpress library (CSS + JS) is loaded from the CanvasXpress CDN in the browser, so there is no JavaScript build step and nothing to bundle.
Install
pip install canvasxpress-anywidget
Use
from canvasxpress_anywidget import CanvasXpress
CanvasXpress(
data={
"y": {
"vars": ["Revenue"],
"smps": ["Q1", "Q2", "Q3", "Q4"],
"data": [[10, 14, 9, 17]],
}
},
config={"graphType": "Bar", "title": "Quarterly Revenue"},
)
data, config and events are exactly the arguments of new CanvasXpress({...}) in
JavaScript, so any spec from the gallery, the R /
Python packages, or the Quarto shortcode works unchanged.
From a shared spec file
The {"data", "config", "events"} JSON object used across CanvasXpress hosts loads directly:
import json
from canvasxpress_anywidget import CanvasXpress
spec = json.load(open("chart.json"))
CanvasXpress.from_spec(spec)
Update in place
Assigning to an attribute re-renders the chart without creating a new cell output:
w = CanvasXpress(data=..., config={"graphType": "Bar"})
w # display it
w.config = {**w.config, "graphType": "Line"} # morphs to a line chart
Parameters
| Attribute | Type | Default | Meaning |
|---|---|---|---|
data |
dict | {} |
CanvasXpress data object (y, x, z, …). |
config |
dict | {} |
CanvasXpress configuration (graphType, title, …). |
events |
dict | {} |
Optional event handlers. |
width |
int | 600 |
Canvas width in pixels. |
height |
int | 400 |
Canvas height in pixels. |
License
Dual-licensed. The core library is LGPL-3.0-or-later; commercial terms are available — see
https://canvasxpress.org/license.html.
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 canvasxpress_anywidget-0.1.0.tar.gz.
File metadata
- Download URL: canvasxpress_anywidget-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35f363af598b94e8dcba204d518e52a8f948549f303d91622157655d87231fe4
|
|
| MD5 |
986524d76fa4b95a3a689d61021f31d3
|
|
| BLAKE2b-256 |
0713a25db8d5333c1756fd8ec67f023a83cfda98b5149ec441bd12f7b80e0ee5
|
File details
Details for the file canvasxpress_anywidget-0.1.0-py3-none-any.whl.
File metadata
- Download URL: canvasxpress_anywidget-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29be48b69c67f5c2f8ec2455e9ac1b11fe945bd1109aeb1e742ad7721aff3910
|
|
| MD5 |
392a709e3c34475959137971829a7819
|
|
| BLAKE2b-256 |
a58198f96dc7e4d29ade40e707bc8d27e03c19b6111086ff16588352f69c232f
|