chartletv0.23.0

CASOON Open Source

Charts and diagrams, finished at build time.

Describe a chart in a small JSON file, and chartlet compiles it into plain SVG or an HTML figure with caption, source and data table. A chart ships no JavaScript, and the same specification gives the same bytes on every build.

npm install @casoon/chartlet
cargo install chartlet
MITv0.23.00 bytes of chart JavaScript
From energy source to useSankey diagram of 11 nodes and 12 links; 690 enter it. Biggest links: Gas → Heating (160), Heating → Households (160), Oil → Transport (150).From energy source to useGas → Power: 120Gas → Heating: 160Coal → Power: 80Wind → Power: 90Solar → Power: 40Oil → Transport: 150Oil → Industry: 50Power → Industry: 120Power → Households: 100Power → Transport: 20Power → Losses: 90Heating → Households: 160Gas: 280Gas280Power: 330Power330Heating: 160Heating160Coal: 80Coal80Wind: 90Wind90Solar: 40Solar 40Oil: 200Oil200Transport: 170Transport170Industry: 170Industry170Households: 260Households260Losses: 90Losses90
From energy source to useSankey diagram of 11 nodes and 12 links; 690 enter it. Biggest links: Gas → Heating (160), Heating → Households (160), Oil → Transport (150).From energy source to useGas → Power: 120Gas → Heating: 160Coal → Power: 80Wind → Power: 90Solar → Power: 40Oil → Transport: 150Oil → Industry: 50Power → Industry: 120Power → Households: 100Power → Transport: 20Power → Losses: 90Heating → Households: 160Gas: 280Gas280Power: 330Power330Heating: 160Heating160Coal: 80Coal80Wind: 90Wind90Solar: 40Solar 40Oil: 200Oil200Transport: 170Transport170Industry: 170Industry170Households: 260Households260Losses: 90Losses90
Rendered by chartlet during this build from examples/energy-flow.json, with its phone variant on small screens.

Three ways to a first result

Status: before 1.0, so a minor release may change the specification; flow, state and class diagrams are experimental. The support matrix says what is verified and what is only designed."No browser JavaScript" means a chart: static SVG and HTML figures carry no script. The interactive module and the playground are optional JavaScript that a chart never loads.

Quiet when it works, exact when it does not

A valid specification renders without a word. Invalid input is refused with a code and the path of the field, and the exit code tells CI. A compromise such as a canvas that is too small still renders, with a warning that says what to change.

--strict turns warnings into failures, and --preview shows every save on a local page.

Terminal, real chartlet 0.21.0 runs. chartlet render energy-flow.json -o sankey.svg prints nothing, and ls lists sankey.svg. duplicate.json has the label January twice; chartlet render duplicate.json fails with 'chartlet: duplicate_label at /data/1/label: labels must be unique in a single-series chart', and echo $? prints 1. chartlet render narrow-flow.json renders with 'warning[canvas_too_small] at /width: the diagram needs 499 pixels here and was drawn that large; raise width to 499, shorten labels, or try the other orientation'.
bytes of chart JavaScript in the browser
0
examples, also the golden-file test inputs
150
minimum contrast of every series colour on white
4.5:1
types of chart and diagram, from one JSON schema
37

What it does

Where it runs

Generated at build time

All examples →
Focus
From commit to release
From commit to releaseFlow chart with 10 steps and 11 connections in 3 lanes: Development, Continuous integration and Operations. Main path: Commit pushed → Code review → Build → Run tests → All green? → Deploy to staging → Approved? → Deploy to production → Released. Loop: Code review → Build → Run tests → All green? → Deploy to staging → Approved? → Code review. Bottleneck: Approved?; without it the diagram falls apart. Commit pushed (start) in Development: leads to Code review. Code review in Development: leads to Build (merged). Build in Continuous integration: leads to Run tests. Run tests in Continuous integration: leads to All green?. All green? (decision) in Continuous integration: leads to Deploy to staging (yes) and Fix failures (no). Fix failures in Development: leads to Build (retry). Deploy to staging in Operations: leads to Approved?. Approved? (decision) in Operations: leads to Deploy to production (yes) and Code review (changes requested). Deploy to production in Operations: leads to Released. Released (end) in Operations: no further step. Group "Quality gates": Build, Run tests, All green?.DevelopmentContinuous integrationOperationsQuality gatesCommit pushed → Code reviewCode review → Build: mergedBuild → Run testsRun tests → All green?All green? → Deploy to staging: yesAll green? → Fix failures: noFix failures → Build: retryDeploy to staging → Approved?Approved? → Deploy to production: yesApproved? → Code review: changes requestedDeploy to production → Releasedmergedyesnoretryyeschanges requestedCommit pushedCommit pushedCode reviewCode reviewBuild – locked inputsBuildlocked inputsRun testsRun testsAll green?All green?Fix failuresFix failuresDeploy to stagingDeploy to stagingApproved?Approved?Deploy to productionDeploy to productionReleasedReleased

Source: Team handbook, release process

Show chart data
Data for From commit to release
StepKindLaneGroupLeads to
Commit pushedstartDevelopmentCode review
Code reviewstepDevelopmentBuild (merged)
BuildstepContinuous integrationQuality gatesRun tests
Run testsstepContinuous integrationQuality gatesAll green?
All green?decisionContinuous integrationQuality gatesDeploy to staging (yes), Fix failures (no)
Fix failuresstepDevelopmentBuild (retry)
Deploy to stagingstepOperationsApproved?
Approved?decisionOperationsDeploy to production (yes), Code review (changes requested)
Deploy to productionstepOperationsReleased
ReleasedendOperations

Diagrams too: this flow chart is laid out by chartlet from steps and edges alone. Click a step, or pick one under Focus, to see its neighbourhood.

examples/release-flow.json

Quickstart

From a specification to a finished chart. The CLI, the Astro component and the JavaScript API are covered in the documentation.

  1. Install the CLI, or the npm package for Astro and JavaScript.
  2. Describe the chart in a small JSON specification.
  3. Render it with chartlet render spec.json -o chart.svg or the <Chart> component.
spec.jsonSpecification
{
  "schemaVersion": 1,
  "type": "bar",
  "title": "Monthly revenue",
  "data": [
    { "label": "January", "value": 120 },
    { "label": "February", "value": 180 },
    { "label": "March", "value": 150 }
  ]
}

New in v0.23.0

Changelog →

Frequently asked questions

What does chartlet take as input?

A small, declarative JSON specification — the type of chart or diagram, the data, and optional styling. chartlet validates it against a public schema and compiles it to SVG or an HTML figure; it never runs in the browser.

How is this different from a JavaScript charting library?

There is no chart script to ship or hydrate. chartlet renders at build time to plain SVG or an HTML figure with a caption, a generated description and a data table, and the same specification always produces the same bytes.

What chart and diagram types does it support?

Dozens of chart types — bar, line, time series, scatter, box plot, Sankey, treemap, heatmap and more — plus diagrams (sequence, flow, state, architecture, class, tree, network, cycle, layers, floor plan, Venn, fishbone, kanban, story map, journey, value map) that chartlet lays out itself from what is connected.

Can an AI agent generate charts with chartlet?

Yes. The MCP server @casoon/chartlet-mcp lets an assistant inspect data or a request, draft a specification, and have chartlet validate and compile it — no model runs inside the server and your data is never altered.

Is chartlet stable enough to build on?

chartlet is before 1.0: a minor release may still change the specification, and flow, state and class diagrams are marked experimental. The support matrix in the documentation lists what is verified and what is only designed.