ChartJS Python integration
Project description
pydacharts
Pydantic :heart: chartjs This is a code generator for ChartJS configuration JSON.
Set Up
- Pip install the package with
pip install pydacharts
,uv add pydacharts
, or clone the repo - Use the class generator to write a "config" file. One simple example
from pydacharts.models import Config, Data, Dataset
def spending_by_year_chartjs() -> Config:
"""
Return a chartjs "config" object for sip dataset
charting
"""
return Config(
type="bar",
data=Data(
labels=["Green is nice", "Red is angry", "Blue is calming"],
datasets=[Dataset(
backgroundColor = ["green", "red", "blue"],
data = [1,2,3],
label = "We love colors"
)]
)
)
(This example should work standalone)
For running examples
Run Examples
uv sync --extra serve
cd serve
flask run
go to localhost:5000
Building
Update the version
field in pyproject.toml
Create a git tag same as the version
uv build
uv publish
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
pydacharts-0.2.0.dev1.tar.gz
(105.8 kB
view hashes)
Built Distribution
Close
Hashes for pydacharts-0.2.0.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3156c7b3dd86b91be77716ea304843af644972057e9e3058da49a87d8ebebd0a |
|
MD5 | 681c29463ea85626dd9c485bb8d6f3c6 |
|
BLAKE2b-256 | a6b8c54d52a0a47f3655ba7f63b4db6a012967beb4adbd6f07afd7107c25079c |