CLI reference — chartjs2img llm
This is a reference page, not a tutorial. Start with one of the tutorials (Claude plugin / gh skill / context7) if you haven't installed anything yet.
One chartjs2img subcommand exists specifically for LLM consumption: chartjs2img llm. It prints a self-contained Markdown reference of Chart.js core plus every bundled plugin. Pipe it into your agent's context on session start and configs come out right first try.
Usage
chartjs2img llm- No network access.
- No arguments.
- Stdout only.
The output covers:
- Usage guide — how to invoke chartjs2img (CLI vs HTTP), input JSON shape, constraints (JSON only, no functions), and caveats.
- Chart.js core — all 8 built-in chart types (
bar,line,pie,doughnut,radar,polarArea,scatter,bubble), dataset properties, scales, and thetitle/legend/tooltipplugin option trees. - Bundled plugin options — 12 sections:
chartjs-plugin-datalabelschartjs-plugin-annotationchartjs-plugin-zoomchartjs-plugin-gradientchartjs-chart-treemapchartjs-chart-matrixchartjs-chart-sankeychartjs-chart-wordcloudchartjs-chart-geochartjs-chart-graphchartjs-chart-vennchartjs-adapter-dayjs-4
Each section includes option tables (property path, type, default, description) and a JSON example.
The Markdown is regenerated from source (src/llm-docs/*.ts) on every build, so it can never drift from the implementation.
Output shape at a glance
Approximate structure:
# Usage
<input JSON shape, HTTP vs CLI, JSON constraint, error feedback, exit codes>
## Chart.js core (chart.js@4.4.9)
<type, data, datasets, options, scales, title, legend, tooltip>
## Datalabels (chartjs-plugin-datalabels)
<display, anchor, align, color, font — including the chartjs2img-specific
"off by default" policy>
## Annotation (chartjs-plugin-annotation)
<line, box, label, point, polygon, ellipse>
## Zoom (chartjs-plugin-zoom)
...
## Gradient (chartjs-plugin-gradient)
...
<plus the 7 additional chart-type plugins and the date adapter>Total output: ~1400 lines, ~135 KB. Fits comfortably in modern context windows.
Agent prompt templates
Minimal — opening turn
You are going to author Chart.js configurations that chartjs2img will
render to images. The complete reference follows. When you produce a
JSON config:
1. Validate with `chartjs2img render -i <file> -o /tmp/check.png 2> /tmp/check.err`.
2. If /tmp/check.err is non-empty, fix and retry.
3. Report the final JSON plus the rendered image path.
---
<paste output of `chartjs2img llm`>
---Richer — with explicit gotchas
<above>
Gotchas to remember:
- JSON has no functions — do not use `options.scales.y.ticks.callback` or `datalabels.formatter`.
- Animation is forced OFF internally — don't propose animated configs.
- Datalabels is disabled by default — set `options.plugins.datalabels.display: true` to show labels.
- Time-series axes need `"type": "time"` — the dayjs adapter is bundled.Piping into standard LLM CLIs
OpenAI / generic llm CLI
chartjs2img llm \
| llm -s "Generate a Chart.js config for monthly sales, Jan-Jun, values 12 19 3 5 2 15"Clipboard (macOS)
chartjs2img llm | pbcopyThen paste into your agent's system-prompt box.
File
chartjs2img llm > /tmp/chartjs2img-reference.mdRe-use across sessions.
Relationship to other AI channels
llms-full.txton the docs site has a superset — it appends every docs/en/ Markdown page to the same reference. Use it if your agent wants both the reference and the guide pages in one payload.- context7 retrieves the same content via MCP when a full-bundle is too big for your context window.
chartjs2img-authorSKILL.md inlines the JSON shape, the error feedback contract, and a plugin catalog so the skill is self-contained. Agents fall back tochartjs2img llmonly when they need the full option tables for a specific plugin.
Whichever channel an agent uses, the actual content is derived from the same src/llm-docs/*.ts files, so consistency is guaranteed.
Extending
To add / change what chartjs2img llm outputs, edit the relevant file under src/llm-docs/. See the Developer Guide → Adding LLM docs for the full format.
Troubleshooting
chartjs2img: command not found — install the binary first. See Install or run /chartjs2img-install if you have the Claude plugin.
Output is empty — that would be a bug; file an issue. The aggregator always has at least the usage section.
Output looks outdated — check chartjs2img --version. Each release rebuilds src/llm-docs/ from the pinned plugin versions in src/template.ts; old binaries reflect old plugin versions.
See also
- AI Guide overview — pick a tutorial.
- llms.txt — the same reference served as a static file.
- Developer Guide → Adding LLM docs — how to extend the output.