Metadata-Version: 2.4
Name: larzchart
Version: 0.1.0
Summary: Data to inline SVG charts in pure Python. Line, bar, pie, area, sparkline. No matplotlib. Zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzchart
Project-URL: Repository, https://github.com/larz-scripter/larzchart
Project-URL: Documentation, https://github.com/larz-scripter/larzchart#readme
Project-URL: Issues, https://github.com/larz-scripter/larzchart/issues
Keywords: charts,svg,plotting,dataviz,visualization,sparkline,line-chart,bar-chart,pie-chart,server-side,matplotlib-alternative,zero-dependency,pure-python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics :: Presentation
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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](https://github.com/larz-scripter/larzmark)
site — rendered on the server, in a few kilobytes.

```python
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 `dict` of `name -> values`, or
  `Series` objects. 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

```bash
pip install larzchart
```

## Chart types

```python
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

```python
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](https://github.com/larz-scripter/larzdb),
embed the SVG in a page built by
[larzmark](https://github.com/larz-scripter/larzmark), or drop a `Sparkline`
into a report — no image pipeline required.

## Tests

```bash
python -m unittest discover -s tests -v      # 25 tests, valid-XML checks, zero deps
```

## The Larz stack

Pure-Python, zero-dependency building blocks:

- **[larz](https://github.com/larz-scripter/larz)** — money-native web framework
- **[larzchain](https://github.com/larz-scripter/larzchain)** — from-scratch PoW blockchain
- **[larzmoney](https://github.com/larz-scripter/larzmoney)** — exact, penny-perfect money
- **[larzcrypt](https://github.com/larz-scripter/larzcrypt)** — pure-Python cryptography toolkit
- **[larzdb](https://github.com/larz-scripter/larzdb)** — crash-safe embedded database
- **[larzagent](https://github.com/larz-scripter/larzagent)** — zero-dep AI agent framework
- **larzchart** — this library

## License

MIT © larz-scripter
