larzchart
Data to inline SVG charts, in pure Python. Zero dependencies.
No matplotlib, no numpy, no browser, no fonts to bundle. Give it numbers, get
back a self-contained <svg> string you can drop straight into an HTML page, an
email, a README, a dashboard, or a larzmark
site — rendered on the server, in a few kilobytes.
from larzchart import LineChart, BarChart, PieChart, Sparkline, Series
svg = LineChart(
{"revenue": [10, 14, 12, 20, 25], "cost": [8, 9, 11, 12, 15]},
labels=["Jan", "Feb", "Mar", "Apr", "May"],
title="Q1 performance", theme="dark",
).render() # -> '<svg ...>...</svg>'
Sparkline([3, 5, 2, 8, 6, 9]).render() # a tiny inline trend line
Why
- Zero dependencies. Pure standard library. Nothing to compile, no native wheels, works anywhere Python does — including tiny/serverless environments where matplotlib won't fit.
- Server-side & inline. Output is a self-contained SVG string (inline styles, no external fonts or scripts), so it renders in an email or a static page with no JavaScript and no image files to host.
- Just numbers in. Accepts a bare list, a
dictofname -> values, orSeriesobjects. Multi-series, titles, axes, gridlines, legends handled for you. - Themed. Light and dark themes and a ten-colour categorical palette out of the box; set per-series colours when you want.
- Deterministic. The same data always produces the same SVG — great for snapshot tests and reproducible reports.
Install
pip install larzchart
Chart types
from larzchart import LineChart, AreaChart, BarChart, PieChart, Sparkline
LineChart([1, 4, 2, 8, 5]).render() # line
AreaChart([1, 4, 2, 8, 5]).render() # filled area
BarChart({"a": [3, 5, 2], "b": [4, 1, 6]}).render() # grouped bars
PieChart([30, 50, 20], labels=["A", "B", "C"]).render() # pie
PieChart([30, 50, 20], donut=True).render() # donut
Sparkline([3, 5, 2, 8, 6, 9]).render() # inline mini-line
Common options: title, labels, width, height, theme="light"|"dark",
legend=True/False, and per-Series color.
Save to a file
LineChart([1, 2, 3, 4]).to_html("chart.html") # minimal standalone HTML page
Great with the rest of the stack
Feed it query results from larzdb,
embed the SVG in a page built by
larzmark, or drop a Sparkline
into a report — no image pipeline required.
Tests
python -m unittest discover -s tests -v # 25 tests, valid-XML checks, zero deps
The Larz stack
Pure-Python, zero-dependency building blocks:
- larz — money-native web framework
- larzchain — from-scratch PoW blockchain
- larzmoney — exact, penny-perfect money
- larzcrypt — pure-Python cryptography toolkit
- larzdb — crash-safe embedded database
- larzagent — zero-dep AI agent framework
- larzchart — this library
License
MIT © larz-scripter
Metadata
Release files for larzchart 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| larzchart-0.1.0.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larzchart-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / larzchart-0.1.0.tar.gz
| Download URL | larzchart-0.1.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cc54427f5ce15329a5d93482e2196a40d6d6f7ed6cdf9c501c551f141f9c2c3
|
|
BLAKE2b-256 checksum How to use checksums |
20f0c564e405e4d257fbd7b9ef2d474183602993eef74725e9141a541b27a478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / larzchart-0.1.0-py3-none-any.whl
| Download URL | larzchart-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09b0172df915e8919f1dc490206f04187323d49859a856bdaadb63a3bf63177d
|
|
BLAKE2b-256 checksum How to use checksums |
669920cce0814d7d471da37a1e7310e2acbe24038a7ae9c752f6f986540ae73d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|