Charted is a zero dependency SVG chart generator that aims to provide a simple interface for generating beautiful and customisable graphs. This project is inspired by chart libraries like mermaid.js.
Project description
Charted is a zero dependency SVG chart generator that aims to provide a simple interface for generating beautiful and customisable graphs. This project is inspired by chart libraries like mermaid.js
.
The following chart types are available:
- Column
- Line
- Scatter
The following chart types are planned to be implemented.
- Bar
- Donut
- Pie
Installation
pip install charted
tkinter
I've tried to avoid using tkinter
in this library as it can be fiddly to install depending on your OS. However, it's still partially used if you're looking to expand Charted. Instead of using tkinter
to calculate text dimensions on the fly, font definitions are created in fonts/definitions/
.
New font definitions can be created by using:
poetry run python charted/fonts/creator.py Helvetica
Links
Examples
Column
from charted.charts import Column
graph = ColumnChart(
title="Example Column Graph",
data=[
[9.8, -29.8, 22.6, 45.0, 33.8, 35.4, 44.2],
[8.9, 33.1, -27.1, 31.2, -15.4, 32.6, 19.8],
[-32.0, 32.3, 45.7, -3.3, -33.3, -15.7, -38.6],
],
labels=["January", "February", "March", "April", "May", "June", "July"],
width=600,
height=400,
theme={
"padding": {
"v_padding": 0.1,
"h_padding": 0.1,
}
},
)
Labelled Line Chart
from charted.charts import LineChart
graph = LineChart(
title="Example Labelled Line Graph",
data=[5 * (1.5**n) for n in range(0, 11)],
labels=["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"],
theme={
"colors": ["#204C9E"],
},
)
Dual Axis Line Chart
from charted.charts import LineChart
graph = LineChart(
title="Example XY Line Graph",
data=[
[5 * (1.5**n) for n in range(0, 11)],
[-5 * (1.5**n) for n in range(0, 11)],
],
x_data=[-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4],
width=600,
height=400,
)
Scatter
from charted.charts import ScatterChart
graph = ScatterChart(
title="Example Scatter Graph",
y_data=[
[random.random() * i for i in range(-25, 25, 1)],
[random.random() * i for i in range(-25, 25, 1)],
],
x_data=[
[random.random() * i for i in range(-25, 25, 1)],
[random.random() * i for i in range(-25, 25, 1)],
],
)
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
File details
Details for the file charted-0.1.8.tar.gz
.
File metadata
- Download URL: charted-0.1.8.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5383bf1878fe8fbc5de2f9361b12d291d2744d3026e05cb1cbf2cb73ebb1427a |
|
MD5 | 265727c5b1823101d241755fb24b7fe3 |
|
BLAKE2b-256 | 2702c9ecab4ea849fd8ad30c621a1d046c81ea1d1f73d9e884ee69eee942b58f |
File details
Details for the file charted-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: charted-0.1.8-py3-none-any.whl
- Upload date:
- Size: 36.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5692c518e4cd39315cdcffc0c2842c53349e1a0fb19335705ff697202acf7882 |
|
MD5 | 15c8c04f8defb7a5394bb22f2c4c1ecd |
|
BLAKE2b-256 | 6f204e20ab48b9e0a48a1ff95e121fe7addcfc260ef0825087bab2409ba119f6 |