Skip to content

chartjs2img

Chart.js charts, rendered anywhere.

One JSON, two destinations

Chart.js renders the same configuration in a browser for an interactive chart. chartjs2img takes that same JSON and returns a PNG you can attach to Slack, an email, or a PDF report — no browser required on the receiving side.

Diagram — Chart.js JSON branches into two flows. Top path goes into Chart.js and renders live inside a browser. Bottom path goes into chartjs2img which produces a PNG, then the PNG is attached to Slack and email.

Chart.js + 12 plugins bundled

Core plus datalabels, annotation, zoom, gradient, treemap, matrix, sankey, wordcloud, geo, graph, venn, and the date-fns adapter. No extra installation.

HTTP API + CLI

POST JSON, get an image back. Or pipe JSON into the CLI and redirect to a file. Same engine, cache, and plugin bundle.

Hash-based caching

Identical requests return cached images instantly. SHA-256 hashes travel in headers so clients can build CDN-friendly URLs.

LLM-native

`chartjs2img llm` dumps the full Chart.js + plugin reference as Markdown. Pipe it into an agent to get valid configs first try.

JSON in, image out

Send any Chart.js configuration as JSON; chartjs2img returns the rendered PNG. Left is the exact output of the config on the right.

Chart.js configuration (JSON)
Rendered PNG (800 × 600)
bar-chart
Showcase

Complex charts render, too

Multi-plugin composites — time axes, annotations, data labels, stacked and dual-axis layouts — all from a single JSON request.

showcase-revenue-with-forecast

Revenue with forecast band

Time-series line + gradient stroke, forecast window (annotation), goal threshold, peak-point marker, and on-point data labels.

showcase-ops-dashboard

Ops dashboard snapshot

Stacked-bar ticket backlog with an overlay SLA-breach-rate line on a secondary Y axis, plus threshold line and peak-load window annotations.

Ready to render?

No signup, no API key — everything runs locally.

Built on open source

chartjs2img stands on the shoulders of these projects. Licenses and notices are reproduced inside the Docker image and the source tree.