@x-cmd/draw 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -297
- package/dist/lib.d.ts +26 -3
- package/dist/lib.js +31 -4
- package/dist/node/cli.js +1 -1
- package/dist/render/anno.d.ts +50 -0
- package/dist/render/anno.js +589 -0
- package/dist/render/arch.d.ts +106 -0
- package/dist/render/arch.js +1011 -0
- package/dist/render/archmap.d.ts +90 -3
- package/dist/render/archmap.js +174 -102
- package/dist/render/area.js +9 -7
- package/dist/render/banner.d.ts +8 -0
- package/dist/render/banner.js +204 -0
- package/dist/render/bar-grouped.js +3 -2
- package/dist/render/bar-stacked.js +3 -2
- package/dist/render/bar.js +3 -2
- package/dist/render/butterfly.d.ts +3 -0
- package/dist/render/butterfly.js +355 -0
- package/dist/render/calendar.d.ts +6 -0
- package/dist/render/calendar.js +448 -0
- package/dist/render/combo.js +3 -2
- package/dist/render/compass.d.ts +6 -0
- package/dist/render/compass.js +77 -0
- package/dist/render/dispatch.js +26 -1
- package/dist/render/echarts-ssr.d.ts +30 -0
- package/dist/render/echarts-ssr.js +337 -16
- package/dist/render/gantt.d.ts +11 -0
- package/dist/render/gantt.js +12 -19
- package/dist/render/gantt2.d.ts +24 -0
- package/dist/render/gantt2.js +198 -0
- package/dist/render/hbar.js +8 -4
- package/dist/render/icons.d.ts +3 -0
- package/dist/render/icons.js +78 -0
- package/dist/render/kinds.d.ts +11 -0
- package/dist/render/kinds.js +176 -0
- package/dist/render/ladder.d.ts +21 -0
- package/dist/render/ladder.js +230 -0
- package/dist/render/layout.d.ts +46 -0
- package/dist/render/layout.js +57 -0
- package/dist/render/line-multi.js +2 -2
- package/dist/render/line.js +2 -2
- package/dist/render/maps.d.ts +34 -0
- package/dist/render/maps.js +197 -2
- package/dist/render/mermaid.js +25 -6
- package/dist/render/mindmap.js +3 -2
- package/dist/render/onepage.d.ts +62 -0
- package/dist/render/onepage.js +670 -0
- package/dist/render/orgicon.d.ts +12 -0
- package/dist/render/orgicon.js +31 -0
- package/dist/render/png.js +3 -1
- package/dist/render/quadrant.d.ts +6 -0
- package/dist/render/quadrant.js +201 -0
- package/dist/render/query.d.ts +2 -0
- package/dist/render/query.js +100 -1
- package/dist/render/route.d.ts +86 -0
- package/dist/render/route.js +1077 -0
- package/dist/render/scatter.js +73 -7
- package/dist/render/seq.d.ts +41 -0
- package/dist/render/seq.js +248 -0
- package/dist/render/src-spec.d.ts +5 -0
- package/dist/render/src-spec.js +49 -0
- package/dist/render/svg.d.ts +16 -2
- package/dist/render/svg.js +85 -7
- package/dist/render/table.d.ts +30 -0
- package/dist/render/table.js +134 -0
- package/dist/render/tokei.d.ts +18 -0
- package/dist/render/tokei.js +230 -0
- package/dist/render/uc.d.ts +58 -0
- package/dist/render/uc.js +319 -0
- package/dist/render/units.d.ts +32 -0
- package/dist/render/units.js +84 -0
- package/dist/render/vendor/au.js +10 -0
- package/dist/render/vendor/br.js +10 -0
- package/dist/render/vendor/china.js +11 -0
- package/dist/render/vendor/de.js +10 -0
- package/dist/render/vendor/eu.js +10 -0
- package/dist/render/vendor/japan.js +10 -0
- package/dist/render/vendor/kr.js +10 -0
- package/dist/render/vendor/us-states.js +4 -6
- package/dist/render/vendor/world-geo.d.ts +22 -0
- package/dist/render/vendor/world-geo.js +9 -0
- package/dist/render/vendor/world.d.ts +13 -0
- package/dist/render/vendor/world.js +12 -0
- package/dist/specs/base.d.ts +5 -0
- package/dist/specs/base.js +14 -1
- package/dist/specs/butterfly.d.ts +46 -0
- package/dist/specs/butterfly.js +241 -0
- package/dist/specs/calendar.d.ts +90 -0
- package/dist/specs/calendar.js +296 -0
- package/dist/specs/compass.d.ts +27 -0
- package/dist/specs/compass.js +111 -0
- package/dist/specs/index.d.ts +5 -0
- package/dist/specs/index.js +5 -0
- package/dist/specs/ladder.d.ts +43 -0
- package/dist/specs/ladder.js +268 -0
- package/dist/specs/quadrant.d.ts +41 -0
- package/dist/specs/quadrant.js +200 -0
- package/dist/specs/scatter.d.ts +14 -8
- package/dist/specs/scatter.js +54 -5
- package/dist/specs/table.d.ts +24 -0
- package/dist/specs/table.js +154 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/styles/butterfly.d.ts +2 -0
- package/dist/styles/butterfly.js +74 -0
- package/dist/styles/calendar.d.ts +2 -0
- package/dist/styles/calendar.js +51 -0
- package/dist/styles/compass.d.ts +2 -0
- package/dist/styles/compass.js +19 -0
- package/dist/styles/index.js +13 -0
- package/dist/styles/ladder.d.ts +3 -0
- package/dist/styles/ladder.js +66 -0
- package/dist/styles/quadrant.d.ts +2 -0
- package/dist/styles/quadrant.js +19 -0
- package/dist/styles/table.d.ts +2 -0
- package/dist/styles/table.js +12 -0
- package/dist/styles/types.d.ts +1 -0
- package/dist/styles/types.js +1 -0
- package/dist/types/dagre.d.ts +39 -0
- package/dist/types/dagre.js +3 -0
- package/package.json +17 -1
package/README.md
CHANGED
|
@@ -5,376 +5,158 @@
|
|
|
5
5
|
[](https://jsr.io/@x-cmd/draw/score)
|
|
6
6
|
[](https://securityscorecards.dev/viewer/?uri=github.com/x-cmd/draw)
|
|
7
7
|
|
|
8
|
-
SVG chart generation for the AI era. One endpoint — `/draw?type=...` — with the data in the URL, machine-readable `<metadata>` embedded in every output, and SVG rendered directly by TypeScript. The style system mirrors a designer spec (13 SVGs), with multiple style variants per chart type.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
All the data lives in the URL — open it in a browser, drop it into an `<img>`, paste it into your repo README: the SVG renders right away.
|
|
13
|
-
|
|
14
|
-
### Sankey — pull-request lifecycle: type → outcome → age (`type=sankey&t=pipeline`)
|
|
15
|
-
|
|
16
|
-
```text
|
|
17
|
-
https://x-cmd.com/draw?type=sankey&t=pipeline&labels=feat,fix,docs,chore,merged,closed,rejected,0-1y,1-2y,2y+&links=feat>merged:38;feat>closed:12;feat>rejected:8;fix>merged:33;fix>closed:6;fix>rejected:2;docs>merged:16;docs>closed:4;chore>merged:5;chore>closed:6;chore>rejected:6;merged>0-1y:52;merged>1-2y:28;merged>2y+:12;closed>0-1y:14;closed>1-2y:9;closed>2y+:5;rejected>0-1y:9;rejected>1-2y:5;rejected>2y+:2&title=Pull%20requests%20lifecycle&unit=prs
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
[](https://x-cmd.com/draw/explore?type=sankey&t=pipeline&labels=feat,fix,docs,chore,merged,closed,rejected,0-1y,1-2y,2y+&links=feat>merged:38;feat>closed:12;feat>rejected:8;fix>merged:33;fix>closed:6;fix>rejected:2;docs>merged:16;docs>closed:4;chore>merged:5;chore>closed:6;chore>rejected:6;merged>0-1y:52;merged>1-2y:28;merged>2y+:12;closed>0-1y:14;closed>1-2y:9;closed>2y+:5;rejected>0-1y:9;rejected>1-2y:5;rejected>2y+:2&title=Pull%20requests%20lifecycle&unit=prs)
|
|
21
|
-
|
|
22
|
-
### Radar — three-way software comparison (`type=radar&t=evil`, multi-series)
|
|
23
|
-
|
|
24
|
-
```text
|
|
25
|
-
https://x-cmd.com/draw?type=radar&t=evil&labels=startup,ecosystem,extensibility,memory,ease&series=vscode:60,95,90,55,80&series=neovim:95,65,85,95,35&series=zed:92,50,55,90,60&title=Editor%20comparison
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
[](https://x-cmd.com/draw/explore?type=radar&t=evil&labels=startup,ecosystem,extensibility,memory,ease&series=vscode:60,95,90,55,80&series=neovim:95,65,85,95,35&series=zed:92,50,55,90,60&title=Editor%20comparison)
|
|
29
|
-
|
|
30
|
-
### Combo — weekly downloads vs star-growth rate (`type=combo`, dual y-axis)
|
|
31
|
-
|
|
32
|
-
```text
|
|
33
|
-
https://x-cmd.com/draw?type=combo&labels=Mon,Tue,Wed,Thu,Fri,Sat,Sun&series=Downloads:120,180,150,210,240,200,260&line=Star%20growth:3.1,3.4,3.2,3.8,4.1,3.9,4.5&title=Weekly%20npm%20downloads&unit=dl
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
[](https://x-cmd.com/draw/explore?type=combo&labels=Mon,Tue,Wed,Thu,Fri,Sat,Sun&series=Downloads:120,180,150,210,240,200,260&line=Star%20growth:3.1,3.4,3.2,3.8,4.1,3.9,4.5&title=Weekly%20npm%20downloads&unit=dl)
|
|
37
|
-
|
|
38
|
-
### Archmap — three-tier web app (`/draw/archmap`: grid cells you author, the engine packs & routes)
|
|
39
|
-
|
|
40
|
-
```text
|
|
41
|
-
https://x-cmd.com/draw/archmap?title=Web%20App&n=user;ext;User;;r0c0&n=cdn;cloud;CDN;;r0c1&n=web;fe;Web%20App;SSR;r0c2&n=api;be;API;;r1c1&n=db;db;Postgres;;r2c1&n=redis;db;Redis;;r2c2&e=user;cdn;https&e=cdn;web&e=web;api;json&e=api;db;sql;dash&e=api;redis&b=Data%20Layer;db%20redis
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
[](https://x-cmd.com/draw/explore/archmap?title=Web%20App&n=user;ext;User;;r0c0&n=cdn;cloud;CDN;;r0c1&n=web;fe;Web%20App;SSR;r0c2&n=api;be;API;;r1c1&n=db;db;Postgres;;r2c1&n=redis;db;Redis;;r2c2&e=user;cdn;https&e=cdn;web&e=web;api;json&e=api;db;sql;dash&e=api;redis&b=Data%20Layer;db%20redis)
|
|
45
|
-
|
|
46
|
-
`n=id;type;label;sublabel;r0c1` — the cell address **is** the layout: rows read as tiers, adjacency is legible straight from the URL. `ext/fe/be/db/cloud/sec/bus/svc` map to semantic colors; `b=` wraps a boundary; `e=` takes `main`/`dash` variants.
|
|
47
|
-
|
|
48
|
-
### Archmap — RAG pipeline (`t=evil`; spans `w2`, two boundaries, emphasis + dashed edges)
|
|
49
|
-
|
|
50
|
-
```text
|
|
51
|
-
https://x-cmd.com/draw/archmap?title=RAG%20Pipeline&t=evil&n=user;ext;User;Chat%20API;r0c0&n=gw;be;API%20Gateway;rate%20limit;r0c1w2&n=guard;sec;Guardrail;;r1c1&n=llm;be;LLM;embed+rerank;r1c2&n=vec;db;Vector%20Store;;r2c1&n=kb;db;Knowledge%20Base;docs;r2c2&n=obs;cloud;Object%20Storage;;r3c0w2&e=user;gw;question;main&e=gw;guard&e=gw;llm;context&e=guard;llm&e=llm;vec;knn&e=kb;vec;index;dash&e=llm;obs;artifacts&b=Retrieval;vec%20kb&b=Query%20Runtime;gw%20guard%20llm
|
|
52
|
-
```
|
|
9
|
+
X-CMD Draw is an open-source SVG chart generator: put your data and styling in a URL to create bar charts, line charts, Sankey diagrams, system architecture diagrams, mind maps, and more.
|
|
53
10
|
|
|
54
|
-
|
|
11
|
+
Embed charts directly in READMEs, issues, PRs, blog posts, and web pages without exporting or uploading image files. Links and SVGs retain machine-readable data and parameters: readers see the chart, while AI agents can read, modify, and regenerate it without image recognition.
|
|
55
12
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
https://x-cmd.com/draw/archmap?title=Codex%20CLI%20architecture&n=user;ext;Developer;terminal;r0c0&n=cli;fe;Codex%20CLI;Rust%20%C2%B7%20TUI;r0c1&n=api;cloud;OpenAI;responses%20API;r0c2&n=cfg;svc;config.toml;profiles%20%C2%B7%20sandbox;r1c0&n=core;be;Agent%20Core;turns%20%C2%B7%20tools;r1c1&n=auth;sec;Auth;ChatGPT%20%C2%B7%20API%20key;r1c2&n=agents;svc;AGENTS.md;repo%20context;r2c0&n=tools;svc;Tools;shell%20%C2%B7%20web;r2c1&n=mcp;bus;MCP;servers;r2c2&n=sandbox;sec;Sandbox;seatbelt%20%C2%B7%20landlock;r3c1&e=user;cli;prompt;main&e=cli;core&e=core;api;model;main&e=api;auth;OAuth;dash&e=cli;cfg;load&e=core;tools;exec&e=tools;sandbox;isolated;dash&e=core;mcp&e=agents;core;context&b=CLI%20process;cli%20cfg%20core%20tools%20agents%20mcp&b=OS%20sandbox;sandbox
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
[](https://x-cmd.com/draw/explore/archmap?title=Codex%20CLI%20architecture&n=user;ext;Developer;terminal;r0c0&n=cli;fe;Codex%20CLI;Rust%20%C2%B7%20TUI;r0c1&n=api;cloud;OpenAI;responses%20API;r0c2&n=cfg;svc;config.toml;profiles%20%C2%B7%20sandbox;r1c0&n=core;be;Agent%20Core;turns%20%C2%B7%20tools;r1c1&n=auth;sec;Auth;ChatGPT%20%C2%B7%20API%20key;r1c2&n=agents;svc;AGENTS.md;repo%20context;r2c0&n=tools;svc;Tools;shell%20%C2%B7%20web;r2c1&n=mcp;bus;MCP;servers;r2c2&n=sandbox;sec;Sandbox;seatbelt%20%C2%B7%20landlock;r3c1&e=user;cli;prompt;main&e=cli;core&e=core;api;model;main&e=api;auth;OAuth;dash&e=cli;cfg;load&e=core;tools;exec&e=tools;sandbox;isolated;dash&e=core;mcp&e=agents;core;context&b=CLI%20process;cli%20cfg%20core%20tools%20agents%20mcp&b=OS%20sandbox;sandbox)
|
|
63
|
-
|
|
64
|
-
A row per tier: terminal → the CLI process (TUI · config · core · tools · MCP · AGENTS.md inside one boundary) → OpenAI; tool exec drops one row further into the OS sandbox.
|
|
13
|
+
## Sneak peek
|
|
65
14
|
|
|
66
|
-
|
|
15
|
+
From performance analysis to architecture design, and from maps to schedules, the complete chart definition lives in the link. Click an image to inspect the data, adjust the styling, and regenerate it. [Explore more chart examples ↗](https://x-cmd.com/draw)
|
|
67
16
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
17
|
+
| | |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| **Downloads and growth**<br>[](https://www.x-cmd.com/draw/explore?type=combo&title=Downloads+and+growth&labels=Jan%2CFeb%2CMar%2CApr%2CMay%2CJun%2CJul%2CAug%2CSep%2COct%2CNov%2CDec&series=downloads%3A900%2C1200%2C1050%2C1600%2C1400%2C1800%2C2100%2C1950%2C2200%2C2500%2C2300%2C2700&line=growth%3A5%2C8%2C6%2C12%2C10%2C15%2C18%2C16%2C20%2C23%2C21%2C26) | **Compression algorithm comparison**<br>[%22%2C%22min%22%3A0%2C%22max%22%3A800%2C%22nameLocation%22%3A%22middle%22%2C%22nameGap%22%3A32%2C%22nameTextStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22axisLabel%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22splitLine%22%3A%7B%22lineStyle%22%3A%7B%22color%22%3A%22%231e293b%22%7D%7D%7D%2C%22yAxis%22%3A%7B%22name%22%3A%22Ratio%20(smaller%20output%20%E2%86%91)%22%2C%22min%22%3A1.9%2C%22max%22%3A3%2C%22nameLocation%22%3A%22middle%22%2C%22nameGap%22%3A45%2C%22nameTextStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22axisLabel%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22splitLine%22%3A%7B%22lineStyle%22%3A%7B%22color%22%3A%22%231e293b%22%7D%7D%7D%2C%22series%22%3A%5B%7B%22type%22%3A%22scatter%22%2C%22data%22%3A%5B%7B%22name%22%3A%22zstd%20-1%22%2C%22value%22%3A%5B510%2C2.896%5D%2C%22symbolSize%22%3A28%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2322d3ee%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22zstd%20--fast%3D1%22%2C%22value%22%3A%5B545%2C2.439%5D%2C%22symbolSize%22%3A30%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2322d3ee%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22zstd%20--fast%3D4%22%2C%22value%22%3A%5B665%2C2.146%5D%2C%22symbolSize%22%3A31%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2322d3ee%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22brotli%20-1%22%2C%22value%22%3A%5B290%2C2.883%5D%2C%22symbolSize%22%3A21%2C%22itemStyle%22%3A%7B%22color%22%3A%22%23a78bfa%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22zlib%20-1%22%2C%22value%22%3A%5B105%2C2.743%5D%2C%22symbolSize%22%3A20%2C%22itemStyle%22%3A%7B%22color%22%3A%22%23f87171%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22lz4%22%2C%22value%22%3A%5B675%2C2.101%5D%2C%22symbolSize%22%3A38%2C%22itemStyle%22%3A%7B%22color%22%3A%22%23fbbf24%22%7D%2C%22label%22%3A%7B%22position%22%3A%22right%22%7D%7D%2C%7B%22name%22%3A%22lzo1x%22%2C%22value%22%3A%5B650%2C2.106%5D%2C%22symbolSize%22%3A24%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22left%22%7D%7D%2C%7B%22name%22%3A%22snappy%22%2C%22value%22%3A%5B520%2C2.089%5D%2C%22symbolSize%22%3A28%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22bottom%22%7D%7D%2C%7B%22name%22%3A%22quicklz%22%2C%22value%22%3A%5B520%2C2.238%5D%2C%22symbolSize%22%3A23%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22lzf%22%2C%22value%22%3A%5B410%2C2.077%5D%2C%22symbolSize%22%3A24%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22bottom%22%7D%7D%5D%2C%22itemStyle%22%3A%7B%22opacity%22%3A0.85%2C%22borderColor%22%3A%22%23fff%22%2C%22borderWidth%22%3A1%7D%2C%22label%22%3A%7B%22show%22%3Atrue%2C%22formatter%22%3A%22%7Bb%7D%22%2C%22color%22%3A%22%23e2e8f0%22%2C%22fontSize%22%3A12%7D%7D%5D%7D&w=960&h=540)](https://www.x-cmd.com/draw/explore/echarts?d=%7B%22backgroundColor%22%3A%22%230f172a%22%2C%22title%22%3A%7B%22text%22%3A%22Compression%3A%20speed%20vs%20ratio%22%2C%22subtext%22%3A%22Silesia%20%C2%B7%20i7-9700K%20%C2%B7%20lzbench%20%C2%B7%20bubble%20size%20%3D%20decompression%20speed%22%2C%22left%22%3A%22center%22%2C%22textStyle%22%3A%7B%22color%22%3A%22%23f8fafc%22%7D%2C%22subtextStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%7D%2C%22grid%22%3A%7B%22left%22%3A70%2C%22right%22%3A40%2C%22top%22%3A80%2C%22bottom%22%3A60%7D%2C%22xAxis%22%3A%7B%22name%22%3A%22Compression%20speed%20MB%2Fs%20(faster%20%E2%86%92)%22%2C%22min%22%3A0%2C%22max%22%3A800%2C%22nameLocation%22%3A%22middle%22%2C%22nameGap%22%3A32%2C%22nameTextStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22axisLabel%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22splitLine%22%3A%7B%22lineStyle%22%3A%7B%22color%22%3A%22%231e293b%22%7D%7D%7D%2C%22yAxis%22%3A%7B%22name%22%3A%22Ratio%20(smaller%20output%20%E2%86%91)%22%2C%22min%22%3A1.9%2C%22max%22%3A3%2C%22nameLocation%22%3A%22middle%22%2C%22nameGap%22%3A45%2C%22nameTextStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22axisLabel%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22splitLine%22%3A%7B%22lineStyle%22%3A%7B%22color%22%3A%22%231e293b%22%7D%7D%7D%2C%22series%22%3A%5B%7B%22type%22%3A%22scatter%22%2C%22data%22%3A%5B%7B%22name%22%3A%22zstd%20-1%22%2C%22value%22%3A%5B510%2C2.896%5D%2C%22symbolSize%22%3A28%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2322d3ee%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22zstd%20--fast%3D1%22%2C%22value%22%3A%5B545%2C2.439%5D%2C%22symbolSize%22%3A30%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2322d3ee%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22zstd%20--fast%3D4%22%2C%22value%22%3A%5B665%2C2.146%5D%2C%22symbolSize%22%3A31%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2322d3ee%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22brotli%20-1%22%2C%22value%22%3A%5B290%2C2.883%5D%2C%22symbolSize%22%3A21%2C%22itemStyle%22%3A%7B%22color%22%3A%22%23a78bfa%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22zlib%20-1%22%2C%22value%22%3A%5B105%2C2.743%5D%2C%22symbolSize%22%3A20%2C%22itemStyle%22%3A%7B%22color%22%3A%22%23f87171%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22lz4%22%2C%22value%22%3A%5B675%2C2.101%5D%2C%22symbolSize%22%3A38%2C%22itemStyle%22%3A%7B%22color%22%3A%22%23fbbf24%22%7D%2C%22label%22%3A%7B%22position%22%3A%22right%22%7D%7D%2C%7B%22name%22%3A%22lzo1x%22%2C%22value%22%3A%5B650%2C2.106%5D%2C%22symbolSize%22%3A24%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22left%22%7D%7D%2C%7B%22name%22%3A%22snappy%22%2C%22value%22%3A%5B520%2C2.089%5D%2C%22symbolSize%22%3A28%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22bottom%22%7D%7D%2C%7B%22name%22%3A%22quicklz%22%2C%22value%22%3A%5B520%2C2.238%5D%2C%22symbolSize%22%3A23%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22top%22%7D%7D%2C%7B%22name%22%3A%22lzf%22%2C%22value%22%3A%5B410%2C2.077%5D%2C%22symbolSize%22%3A24%2C%22itemStyle%22%3A%7B%22color%22%3A%22%2394a3b8%22%7D%2C%22label%22%3A%7B%22position%22%3A%22bottom%22%7D%7D%5D%2C%22itemStyle%22%3A%7B%22opacity%22%3A0.85%2C%22borderColor%22%3A%22%23fff%22%2C%22borderWidth%22%3A1%7D%2C%22label%22%3A%7B%22show%22%3Atrue%2C%22formatter%22%3A%22%7Bb%7D%22%2C%22color%22%3A%22%23e2e8f0%22%2C%22fontSize%22%3A12%7D%7D%5D%7D) |
|
|
20
|
+
| [](https://www.x-cmd.com/draw/explore/arch2?title=OpenCode+Project+Architecture&t=shadcn&n=tui%3Bfe%3BTerminal+UI%3BCommand-line+interface%3Br0c0&n=web%3Bfe%3BWeb+UI%3BBrowser+access%3Br0c1&n=desktop%3Bfe%3BDesktop+App%3BElectron+client%3Br0c2&n=sdk%3Bbe%3BJavaScript+SDK%3BProgrammatic+access%3Br1c0&n=server%3Bsvc%3BOpenCode+Core+Service%3BCLI+and+HTTP+server%3Br1c1&n=session%3Bsvc%3BSessions+%26+Messages%3BContext+management%3Br2c0&n=agent%3Bsvc%3BAgent+System%3BBuild+and+Plan+subagents%3Br2c1&n=provider%3Bsvc%3BModel+Providers%3BModel+requests+and+responses%3Br2c2&n=tools%3Bsvc%3BTool+System%3BFile+I%2FO%2C+Bash+and+search%3Br3c0&n=mcp%3Bsvc%3BMCP+Services%3BExternal+tool+integrations%3Br3c1&n=plugin%3Bsvc%3BPlugins+%26+Extensions%3BEvent+hooks+and+custom+capabilities%3Br3c2&n=storage%3Bdb%3BLocal+Storage%3BSQLite+session+data%3Br4c1&e=tui%3Bserver%3BTerminal+request&e=web%3Bserver%3BHTTP+API&e=desktop%3Bserver%3BClient+request&e=sdk%3Bserver%3BAPI+call&e=server%3Bsession%3BManage+sessions&e=server%3Bagent%3BCoordinate+agents&e=agent%3Bprovider%3BModel+request&e=agent%3Btools%3BInvoke+tools&e=tools%3Bmcp%3BExternal+tool+sources&e=server%3Bplugin%3BLoad+plugins&e=session%3Bstorage%3BRead%2Fwrite+sessions&e=agent%3Bsession%3BMessage+context&b=Client+Interfaces%3B+tui+web+desktop+sdk&b=Core+Runtime%3B+server+session+agent+provider&b=Extensions+%26+Execution%3B+tools+mcp+plugin&b=Data+Persistence%3B+storage) | [](https://www.x-cmd.com/draw/explore/echarts?d=%7B%22title%22%3A%7B%22text%22%3A%22US%20states%20%C2%B7%20GDP%20per%20capita%202024%20%C2%B7%20thousand%20USD%22%7D%2C%22visualMap%22%3A%7B%22min%22%3A50%2C%22max%22%3A120%2C%22orient%22%3A%22horizontal%22%2C%22left%22%3A%22center%22%2C%22bottom%22%3A8%2C%22text%22%3A%5B%22high%22%2C%22low%22%5D%2C%22itemWidth%22%3A12%2C%22itemHeight%22%3A200%2C%22inRange%22%3A%7B%22color%22%3A%5B%22%23eff6ff%22%2C%22%23bfdbfe%22%2C%22%2393c5fd%22%2C%22%2360a5fa%22%5D%7D%7D%2C%22series%22%3A%5B%7B%22type%22%3A%22map%22%2C%22map%22%3A%22USA%22%2C%22label%22%3A%7B%22show%22%3Atrue%2C%22fontSize%22%3A9%2C%22formatter%22%3A%22%7Bb%7D%5Cn%7Bc%7D%22%2C%22color%22%3A%22%230f172a%22%7D%2C%22labelLayout%22%3A%7B%22hideOverlap%22%3Atrue%7D%2C%22itemStyle%22%3A%7B%22areaColor%22%3A%22%23f1f5f9%22%2C%22borderColor%22%3A%22%23ffffff%22%2C%22borderWidth%22%3A0.6%7D%2C%22data%22%3A%5B%7B%22name%22%3A%22New%20York%22%2C%22value%22%3A117%7D%2C%7B%22name%22%3A%22Massachusetts%22%2C%22value%22%3A109%7D%2C%7B%22name%22%3A%22Washington%22%2C%22value%22%3A108%7D%2C%7B%22name%22%3A%22Delaware%22%2C%22value%22%3A105%7D%2C%7B%22name%22%3A%22California%22%2C%22value%22%3A103%7D%2C%7B%22name%22%3A%22North%20Dakota%22%2C%22value%22%3A101%7D%2C%7B%22name%22%3A%22Connecticut%22%2C%22value%22%3A97%7D%2C%7B%22name%22%3A%22Alaska%22%2C%22value%22%3A97%7D%2C%7B%22name%22%3A%22Nebraska%22%2C%22value%22%3A94%7D%2C%7B%22name%22%3A%22Colorado%22%2C%22value%22%3A94%7D%2C%7B%22name%22%3A%22Illinois%22%2C%22value%22%3A90%7D%2C%7B%22name%22%3A%22New%20Jersey%22%2C%22value%22%3A89%7D%2C%7B%22name%22%3A%22Texas%22%2C%22value%22%3A89%7D%2C%7B%22name%22%3A%22Wyoming%22%2C%22value%22%3A88%7D%2C%7B%22name%22%3A%22Minnesota%22%2C%22value%22%3A88%7D%2C%7B%22name%22%3A%22Maryland%22%2C%22value%22%3A87%7D%2C%7B%22name%22%3A%22Virginia%22%2C%22value%22%3A86%7D%2C%7B%22name%22%3A%22Utah%22%2C%22value%22%3A85%7D%2C%7B%22name%22%3A%22New%20Hampshire%22%2C%22value%22%3A85%7D%2C%7B%22name%22%3A%22South%20Dakota%22%2C%22value%22%3A83%7D%2C%7B%22name%22%3A%22Nevada%22%2C%22value%22%3A82%7D%2C%7B%22name%22%3A%22Iowa%22%2C%22value%22%3A82%7D%2C%7B%22name%22%3A%22Hawaii%22%2C%22value%22%3A81%7D%2C%7B%22name%22%3A%22Georgia%22%2C%22value%22%3A79%7D%2C%7B%22name%22%3A%22Ohio%22%2C%22value%22%3A78%7D%2C%7B%22name%22%3A%22Tennessee%22%2C%22value%22%3A78%7D%2C%7B%22name%22%3A%22Kansas%22%2C%22value%22%3A78%7D%2C%7B%22name%22%3A%22Oregon%22%2C%22value%22%3A77%7D%2C%7B%22name%22%3A%22Pennsylvania%22%2C%22value%22%3A77%7D%2C%7B%22name%22%3A%22North%20Carolina%22%2C%22value%22%3A76%7D%2C%7B%22name%22%3A%22Wisconsin%22%2C%22value%22%3A76%7D%2C%7B%22name%22%3A%22Arizona%22%2C%22value%22%3A75%7D%2C%7B%22name%22%3A%22Indiana%22%2C%22value%22%3A75%7D%2C%7B%22name%22%3A%22Florida%22%2C%22value%22%3A74%7D%2C%7B%22name%22%3A%22Rhode%20Island%22%2C%22value%22%3A72%7D%2C%7B%22name%22%3A%22Missouri%22%2C%22value%22%3A72%7D%2C%7B%22name%22%3A%22Louisiana%22%2C%22value%22%3A72%7D%2C%7B%22name%22%3A%22Vermont%22%2C%22value%22%3A71%7D%2C%7B%22name%22%3A%22Maine%22%2C%22value%22%3A71%7D%2C%7B%22name%22%3A%22Michigan%22%2C%22value%22%3A69%7D%2C%7B%22name%22%3A%22New%20Mexico%22%2C%22value%22%3A69%7D%2C%7B%22name%22%3A%22Montana%22%2C%22value%22%3A69%7D%2C%7B%22name%22%3A%22South%20Carolina%22%2C%22value%22%3A65%7D%2C%7B%22name%22%3A%22Idaho%22%2C%22value%22%3A64%7D%2C%7B%22name%22%3A%22Oklahoma%22%2C%22value%22%3A64%7D%2C%7B%22name%22%3A%22Kentucky%22%2C%22value%22%3A64%7D%2C%7B%22name%22%3A%22Alabama%22%2C%22value%22%3A63%7D%2C%7B%22name%22%3A%22Arkansas%22%2C%22value%22%3A61%7D%2C%7B%22name%22%3A%22West%20Virginia%22%2C%22value%22%3A60%7D%2C%7B%22name%22%3A%22Mississippi%22%2C%22value%22%3A54%7D%5D%7D%5D%7D&w=960&h=540) |
|
|
21
|
+
| [](https://www.x-cmd.com/draw/explore/mindmap?style=radial&title=LLM+Technology+Landscape&n=LLM%2FPretraining%2FData%2FCleaning+%26+Deduplication&n=LLM%2FPretraining%2FData%2FSynthetic+Data&n=LLM%2FPretraining%2FTraining%2FMoE+Architecture&n=LLM%2FAlignment%2FSFT&n=LLM%2FAlignment%2FRLHF&n=LLM%2FAlignment%2FDPO&n=LLM%2FInference%2FSampling%2Ftemperature&n=LLM%2FInference%2FSampling%2Ftop-p&n=LLM%2FInference%2FAcceleration%2FKV+Cache&n=LLM%2FInference%2FAcceleration%2FSpeculative+Decoding&n=LLM%2FInference%2FAcceleration%2FQuantization&n=LLM%2FInference%2FDeployment%2FvLLM&n=LLM%2FRAG%2FVector+Database&n=LLM%2FRAG%2FEmbedding+Models&n=LLM%2FRAG%2FReranking&n=LLM%2FAgent%2FTool+Calling&n=LLM%2FAgent%2FTask+Planning&n=LLM%2FAgent%2FMulti-Agent+Systems&n=LLM%2FAgent%2FMCP+Protocol&n=LLM%2FFine-tuning%2FLoRA&n=LLM%2FFine-tuning%2FFull-Parameter+Fine-Tuning&n=LLM%2FFine-tuning%2FKnowledge+Distillation&n=LLM%2FEvaluation%2FMMLU&n=LLM%2FEvaluation%2FHumanEval&n=LLM%2FEvaluation%2FLLM-as-a-Judge&n=LLM%2FMultimodal%2FVision+Encoders&n=LLM%2FMultimodal%2FSpeech&n=LLM%2FMultimodal%2FVideo) | [](https://www.x-cmd.com/draw/explore/chem?smiles=CC%28%3DO%29Oc1ccccc1C%28%3DO%29O) |
|
|
71
22
|
|
|
72
|
-
|
|
23
|
+
## Quick start
|
|
73
24
|
|
|
74
|
-
|
|
25
|
+
### 1. Teach your agent to use draw
|
|
75
26
|
|
|
76
|
-
|
|
27
|
+
Give the following prompt to an agent that can read web pages. The hosted draw service requires no account registration or API key:
|
|
77
28
|
|
|
78
29
|
```text
|
|
79
|
-
https://x-cmd
|
|
30
|
+
Read and follow https://raw.githubusercontent.com/x-cmd/draw/main/SKILL.md. From now on, whenever you write a README, issue, pull request, blog post, or chat message and need a chart, use x-cmd Draw to generate a link and embed it with image syntax instead of attaching image files.
|
|
80
31
|
```
|
|
81
32
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Same paths as the tree above — swap `style=`: `organic` (bezier), `tree` (boxes + elbows), `radial` (root-centred fan; leaf slots size themselves to label width). All three sit side by side in the Endpoints table below.
|
|
85
|
-
|
|
86
|
-
## Six ways to use it (one render core)
|
|
87
|
-
|
|
88
|
-
Every way below hits the same render core with the same parameters — a URL tested one way works every other way.
|
|
89
|
-
|
|
90
|
-
### 1. Prompt — tell your AI agent (skill)
|
|
91
|
-
|
|
92
|
-
Zero install: point any web-connected agent at the skill by URL and ask in plain language —
|
|
93
|
-
|
|
94
|
-
> Follow the draw skill at https://raw.githubusercontent.com/x-cmd/draw/main/SKILL.md:
|
|
95
|
-
> chart language stars as a pie — TypeScript 4821, Python 2312, Go 980
|
|
33
|
+
### 2. Describe what you need
|
|
96
34
|
|
|
97
|
-
|
|
35
|
+
Tell the agent what data to use, what relationship to express, and where the chart will go:
|
|
98
36
|
|
|
99
37
|
```text
|
|
100
|
-
|
|
38
|
+
Add an architecture diagram to the README, showing the request path from the CLI through the API to the database.
|
|
101
39
|
```
|
|
102
40
|
|
|
103
|
-
|
|
41
|
+
For regular use, install [`SKILL.md`](SKILL.md) in an agent that supports local skills. For Claude Code, save it as `~/.claude/skills/draw/SKILL.md`; after this one-time setup, you can describe your request directly.
|
|
104
42
|
|
|
105
|
-
|
|
43
|
+
## Features
|
|
106
44
|
|
|
107
|
-
|
|
45
|
+
- **🔗 A URL is a chart**: Data and styling remain readable, comparable, version-controlled text, and the link embeds directly in Markdown and web pages.
|
|
46
|
+
- **🤖 Readable by people and AI**: SVG handles presentation while machine-readable data and parameters support modification and regeneration—no need to infer data from an image.
|
|
47
|
+
- **📊 Broad visualization support**: Create data charts, flowcharts, architecture diagrams, mind maps, maps, and schedules, or use ECharts for more complex data relationships.
|
|
48
|
+
- **🖱️ Interactive editing**: Open an example in the interactive editor to inspect data, adjust parameters and styles, and copy the updated chart link.
|
|
49
|
+
- **🚀 Open and self-hostable**: Built with TypeScript and licensed under Apache-2.0, with a hosted service, CLI, npm / JSR libraries, and Cloudflare Workers deployment.
|
|
108
50
|
|
|
109
|
-
|
|
51
|
+
## Not using an agent? Choose your workflow
|
|
110
52
|
|
|
111
|
-
|
|
53
|
+
### Make a quick chart: use a URL
|
|
112
54
|
|
|
113
|
-
|
|
55
|
+
Ideal for documentation, sharing, and ad-hoc visualization. Open the [demo and interactive editor](https://x-cmd.com/draw), adjust the data and styling, then copy the link—or edit the URL parameters directly:
|
|
114
56
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
```sh
|
|
118
|
-
curl 'https://x-cmd.com/draw?type=bar&labels=Mon,Tue,Wed,Thu,Fri&values=12,18,9,22,15' > barchart.svg
|
|
119
|
-
curl 'https://x-cmd.com/draw?type=pie&labels=TS,Py,Go&values=4821,2312,980' -o pie.svg && open pie.svg
|
|
120
|
-
curl 'http://localhost:8787/draw?type=line&labels=Q1,Q2,Q3,Q4&values=8,14,23,37' > line.svg # your own service (way 4), same URLs
|
|
57
|
+
```md
|
|
58
|
+

|
|
121
59
|
```
|
|
122
60
|
|
|
123
|
-
|
|
61
|
+
Your readers see a chart; you keep text that is easy to modify and review.
|
|
124
62
|
|
|
125
|
-
|
|
126
|
-
draw --type pie --labels TS,Py,Go --values 4821,2312,980 > pie.svg
|
|
127
|
-
draw --type pie --labels TS,Py,Go --values 4821,2312,980 --out pie.png --scheme dark # .png = rasterized (resvg-wasm)
|
|
128
|
-
draw "?type=bar&labels=Mon,Tue&values=3,5" # bare query string, same params as the URL
|
|
129
|
-
draw echarts '{"series":[{"type":"treemap","data":[{"name":"a","value":3}]}]}' > treemap.svg # ECharts layer (also: file / stdin)
|
|
130
|
-
```
|
|
63
|
+
### Generate charts in bulk or integrate them: use the CLI or a library
|
|
131
64
|
|
|
132
|
-
|
|
65
|
+
Ideal for updating charts in CI, generating reports in bulk, working offline, and integrating charts into applications. The CLI, libraries, and hosted service share the same parameters:
|
|
133
66
|
|
|
134
67
|
```sh
|
|
135
|
-
|
|
136
|
-
deno task serve # = deno run --allow-net --allow-env --sloppy-imports src/node/server.ts
|
|
137
|
-
# ONLY net+env granted; fs/subprocess/ffi stay denied — the render core needs
|
|
138
|
-
# none of them, so Deno's permission sandbox is the security boundary
|
|
139
|
-
npm run serve # same server on Node (http://localhost:8787/draw, demo page included)
|
|
68
|
+
npx @x-cmd/draw --type pie --labels A,B --values 3,2 --out pie.svg
|
|
140
69
|
```
|
|
141
70
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
### 5. Deploy on Cloudflare — one shot
|
|
145
|
-
|
|
146
|
-
Hand it to your agent (deploy skill in this repo):
|
|
147
|
-
|
|
148
|
-
> Follow the deploy skill at https://raw.githubusercontent.com/x-cmd/draw/main/deploy-on-cloudflare.SKILL.md:
|
|
149
|
-
> deploy x-cmd/draw to my Cloudflare account, serving at charts.example.com/draw
|
|
150
|
-
|
|
151
|
-
Or run the script yourself:
|
|
152
|
-
|
|
153
|
-
```sh
|
|
154
|
-
bash scripts/setup.sh # inside the repo: wrangler login → deploy to workers.dev → smoke test
|
|
155
|
-
# or from anywhere:
|
|
156
|
-
curl -fsSL https://raw.githubusercontent.com/x-cmd/draw/main/scripts/setup.sh | bash
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
The script writes a workers.dev config (no routes/vars), deploys, and prints your URL. From then on: `npx wrangler deploy` to update; custom domain via dashboard → Workers → Domains & Routes (the path prefix auto-adapts — `/draw` subpath or root both work, no code change). Local workerd dev: `npm run dev`.
|
|
160
|
-
|
|
161
|
-
### 6. Embed into your own service
|
|
162
|
-
|
|
163
|
-
In-process library (npm / JSR) — the core renders synchronously with no network or files; params identical to the URL:
|
|
71
|
+
To generate SVG synchronously in code, install the library and call `draw`:
|
|
164
72
|
|
|
165
73
|
```sh
|
|
166
74
|
npm install @x-cmd/draw
|
|
167
75
|
```
|
|
168
76
|
```ts
|
|
169
|
-
import { draw
|
|
170
|
-
const { svg } = draw({ type: 'pie', labels: 'A,B', values: '3,2', t: 'evil', scheme: 'dark' });
|
|
171
|
-
draw('?type=bar&labels=Mon,Tue&values=3,5'); // query-string form
|
|
172
|
-
draw({ type: 'bar', labels: ['Q1, 2024', 'Q2'], values: [1, 2] }); // arrays = repeated params
|
|
173
|
-
const e = await renderEchartsOption({ series: [{ type: 'bar', data: [1, 2] }] }, new URLSearchParams());
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Wire it into any route:
|
|
177
|
-
|
|
178
|
-
```ts
|
|
179
|
-
app.get('/chart', (req, res) => res.type('image/svg+xml').send(draw(req.query).svg));
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Deno: `import { draw } from "jsr:@x-cmd/draw";`
|
|
183
|
-
|
|
184
|
-
Or mount the full HTTP layer from this repo (routing, short links, error handling — web-standard `Request`/`Response`, runs on Node/Deno/Bun/Workers):
|
|
185
|
-
|
|
186
|
-
```ts
|
|
187
|
-
import { handleRequest } from './src/handler.js';
|
|
188
|
-
const response = await handleRequest(request, env, {});
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## Endpoints
|
|
192
|
-
|
|
193
|
-
**`GET /draw?type=<pie|bar|hbar|line|area|radar|gauge|scatter|combo|sankey|qr|archmap|mindmap>`** — render a chart
|
|
194
|
-
|
|
195
|
-
| type | chart | example |
|
|
196
|
-
|---|---|---|
|
|
197
|
-
| `pie` | donut; `donut=0` for a solid pie<br><br>**<u>≤100 categories (>9 auto-merge into Other)</u>** | [](https://x-cmd.com/draw/explore?type=pie&t=market-mono&title=Languages&unit=%25&labels=TypeScript,Shell,JavaScript,Rust,Other&values=68,14,9,6,3) |
|
|
198
|
-
| `bar` | grouped columns; multi-series with `stack=1` for stacked<br><br>**<u>≤30 groups</u>** | [](https://x-cmd.com/draw/explore?type=bar&labels=Mon,Tue,Wed&series=dev:12,18,9&series=ci:8,11,6) |
|
|
199
|
-
| `hbar` | horizontal bars (rankings; labels left, values right)<br><br>**<u>≤30 bars, single series (some styles take two)</u>** | [](https://x-cmd.com/draw/explore?type=hbar&t=xcmd-issue&labels=cli,core,docs,ci,ui&series=open:12,8,15,4,9&series=closed:38,52,20,11,26&title=Issues%20by%20area) [](https://x-cmd.com/draw/explore?type=hbar&labels=deno,node,bun&values=7238,6553,4972&title=Runtime%20throughput&unit=ops%2Fs) |
|
|
200
|
-
| `line` | smooth line + gradient area / multi-line<br><br>**<u>≤60 points</u>** | [](https://x-cmd.com/draw/explore?type=line&labels=Jan,Feb,Mar,Apr,May,Jun&values=12,19,15,25,22,30&title=Stars) |
|
|
201
|
-
| `area` | area / multi-series area (gradient fill)<br><br>**<u>≤60 points</u>** | [](https://x-cmd.com/draw/explore?type=area&labels=Q1,Q2,Q3,Q4&values=8,14,23,37&title=Downloads) |
|
|
202
|
-
| `radar` | radar chart<br><br>**<u>3–12 axes</u>** | [](https://x-cmd.com/draw/explore?type=radar&t=evil&labels=perf,docs,tests,dx&series=v1:7,5,8,6&series=v2:8,8,9,8) |
|
|
203
|
-
| `gauge` | gauge (240° arc + center value)<br><br>**<u>`value`+`max` (default 100), value ≤ max; multi-ring ≤8</u>** | [](https://x-cmd.com/draw/explore?type=gauge&title=CI%20pass%20rate&value=87&max=100) |
|
|
204
|
-
| `scatter` | scatter (two numeric axes, negatives supported; no value labels by default)<br><br>**<u>`x=&y=`, ≤200 points</u>** | [](https://x-cmd.com/draw/explore?type=scatter&x=1,2,3,4,5&y=4,5,3,6,5&title=Latency) |
|
|
205
|
-
| `combo` | bars (`series=`) + line (`line=`) in one chart; `stack=1` to stack the bars<br><br>**<u>≤30 groups, ≤6 series total</u>** | [](https://x-cmd.com/draw/explore?type=combo&labels=Mon,Tue,Wed,Thu,Fri&series=dl:120,180,150,210,240&line=growth:3.1,3.4,3.2,3.8,4.1&title=Downloads) |
|
|
206
|
-
| `sankey` | flow diagram with weighted bands<br><br>**<u>`labels=`+`links=A>B:30`, ≤24 nodes/60 links</u>** | [](https://x-cmd.com/draw/explore?type=sankey&labels=Visitors,Stars,Forks,PRs,Merged&links=Visitors>Stars:84;Stars>Forks:17;Forks>PRs:9;PRs>Merged:7&title=Contributor%20funnel) |
|
|
207
|
-
| `qr` | QR code<br><br>**<u>`d`=text (≤1000 chars), `fg`/`bg` colors, `title`/`unit` captions</u>** | [](https://x-cmd.com/draw/explore?type=qr&d=https://github.com/x-cmd/draw&title=scan%20me) |
|
|
208
|
-
| `archmap` | architecture map: you author grid cells (`r0c1`, `w`/`h` spans ≤3, pixel escape `p40,80`), the engine auto-sizes tracks and routes orthogonal edges<br><br>**<u>`n=id;type;label[;sub][;pos]` (types `ext/fe/be/db/cloud/sec/bus/svc`), `e=from;to[;label[;main\|dash]]`, `b=label;ids`; ≤500 nodes</u>** | <a href="https://x-cmd.com/draw/explore/archmap?title=Web%20App&n=user;ext;User;;r0c0&n=cdn;cloud;CDN;;r0c1&n=web;fe;Web%20App;SSR;r0c2&n=api;be;API;;r1c1&n=db;db;Postgres;;r2c1&n=redis;db;Redis;;r2c2&e=user;cdn;https&e=cdn;web&e=web;api;json&e=api;db;sql;dash&e=api;redis&b=Data%20Layer;db%20redis"><img src="https://x-cmd.com/draw/archmap?title=Web%20App&n=user;ext;User;;r0c0&n=cdn;cloud;CDN;;r0c1&n=web;fe;Web%20App;SSR;r0c2&n=api;be;API;;r1c1&n=db;db;Postgres;;r2c1&n=redis;db;Redis;;r2c2&e=user;cdn;https&e=cdn;web&e=web;api;json&e=api;db;sql;dash&e=api;redis&b=Data%20Layer;db%20redis" width="300" alt="archmap: web app"></a> <a href="https://x-cmd.com/draw/explore/archmap?title=Codex%20CLI%20architecture&n=user;ext;Developer;terminal;r0c0&n=cli;fe;Codex%20CLI;Rust%20%C2%B7%20TUI;r0c1&n=api;cloud;OpenAI;responses%20API;r0c2&n=cfg;svc;config.toml;profiles%20%C2%B7%20sandbox;r1c0&n=core;be;Agent%20Core;turns%20%C2%B7%20tools;r1c1&n=auth;sec;Auth;ChatGPT%20%C2%B7%20API%20key;r1c2&n=agents;svc;AGENTS.md;repo%20context;r2c0&n=tools;svc;Tools;shell%20%C2%B7%20web;r2c1&n=mcp;bus;MCP;servers;r2c2&n=sandbox;sec;Sandbox;seatbelt%20%C2%B7%20landlock;r3c1&e=user;cli;prompt;main&e=cli;core&e=core;api;model;main&e=api;auth;OAuth;dash&e=cli;cfg;load&e=core;tools;exec&e=tools;sandbox;isolated;dash&e=core;mcp&e=agents;core;context&b=CLI%20process;cli%20cfg%20core%20tools%20agents%20mcp&b=OS%20sandbox;sandbox"><img src="https://x-cmd.com/draw/archmap?title=Codex%20CLI%20architecture&n=user;ext;Developer;terminal;r0c0&n=cli;fe;Codex%20CLI;Rust%20%C2%B7%20TUI;r0c1&n=api;cloud;OpenAI;responses%20API;r0c2&n=cfg;svc;config.toml;profiles%20%C2%B7%20sandbox;r1c0&n=core;be;Agent%20Core;turns%20%C2%B7%20tools;r1c1&n=auth;sec;Auth;ChatGPT%20%C2%B7%20API%20key;r1c2&n=agents;svc;AGENTS.md;repo%20context;r2c0&n=tools;svc;Tools;shell%20%C2%B7%20web;r2c1&n=mcp;bus;MCP;servers;r2c2&n=sandbox;sec;Sandbox;seatbelt%20%C2%B7%20landlock;r3c1&e=user;cli;prompt;main&e=cli;core&e=core;api;model;main&e=api;auth;OAuth;dash&e=cli;cfg;load&e=core;tools;exec&e=tools;sandbox;isolated;dash&e=core;mcp&e=agents;core;context&b=CLI%20process;cli%20cfg%20core%20tools%20agents%20mcp&b=OS%20sandbox;sandbox" width="300" alt="archmap: codex cli"></a> |
|
|
209
|
-
| `mindmap` | mind map: repeated `n=root/branch/leaf` paths, shared prefixes merge, engine lays out the tree<br><br>**<u>`style=organic\|tree\|radial`; ≤500 nodes, ≤8 levels</u>** | <a href="https://x-cmd.com/draw/explore/mindmap?title=%E5%A4%A7%E6%A8%A1%E5%9E%8B%E6%8A%80%E6%9C%AF%E5%85%A8%E6%99%AF&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E9%A2%84%E8%AE%AD%E7%BB%83/%E6%95%B0%E6%8D%AE/%E6%B8%85%E6%B4%97%E5%8E%BB%E9%87%8D&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E9%A2%84%E8%AE%AD%E7%BB%83/%E6%95%B0%E6%8D%AE/%E5%90%88%E6%88%90%E6%95%B0%E6%8D%AE&n=%E5%A4%A7%E6%A8%A1%E5%9E%8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9E%8B/Agent/%E4%BB%BB%E5%8A%A1%E8%A7%84%E5%88%92&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/Agent/%E5%A4%9A%E6%99%BA%E8%83%BD%E4%BD%93&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/Agent/MCP%E5%8D%8F%E8%AE%AE&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%BE%AE%E8%B0%83/LoRA&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%BE%AE%E8%B0%83/%E5%85%A8%E5%8F%82%E6%95%B0%E5%BE%AE%E8%B0%83&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%BE%AE%E8%B0%83/%E7%9F%A5%E8%AF%86%E8%92%B8%E9%A6%8F&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E8%AF%84%E6%B5%8B/MMLU&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E8%AF%84%E6%B5%8B/HumanEval&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E8%AF%84%E6%B5%8B/LLM%E8%AF%84%E5%AE%A1&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%A7%86%E8%A7%89%E7%BC%96%E7%A0%81%E5%99%A8&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%AF%AD%E9%9F%B3&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%A7%86%E9%A2%91" width="230" alt="mindmap organic: LLM landscape"></a> <a href="https://x-cmd.com/draw/explore/mindmap?style=tree&title=%E5%A4%A7%E6%A8%A1%E5%9E%8B%E6%8A%80%E6%9C%AF%E5%85%A8%E6%99%AF&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E9%A2%84%E8%AE%AD%E7%BB%83/%E6%95%B0%E6%8D%AE/%E6%B8%85%E6%B4%97%E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8B&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/RAG/%E9%87%8D%E6%8E%92%E5%BA%8F&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/Agent/%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/Agent/%E4%BB%BB%E5%8A%A1%E8%A7%84%E5%88%92&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/Agent/%E5%A4%9A%E6%99%BA%E8%83%BD%E4%BD%93&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/Agent/MCP%E5%8D%8F%E8%AE%AE&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%BE%AE%E8%B0%83/LoRA&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%BE%AE%E8%B0%83/%E5%85%A8%E5%8F%82%E6%95%B0%E5%BE%AE%E8%B0%83&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%BE%AE%E8%B0%83/%E7%9F%A5%E8%AF%86%E8%92%B8%E9%A6%8F&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E8%AF%84%E6%B5%8B/MMLU&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E8%AF%84%E6%B5%8B/HumanEval&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E8%AF%84%E6%B5%8B/LLM%E8%AF%84%E5%AE%A1&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%A7%86%E8%A7%89%E7%BC%96%E7%A0%81%E5%99%A8&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%AF%AD%E9%9F%B3&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%A7%86%E9%A2%91" width="280" alt="mindmap tree: LLM landscape"></a> <a href="https://x-cmd.com/draw/explore/mindmap?style=radial&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1%E6%80%81/%E8%AF%AD%E9%9F%B3&n=%E5%A4%A7%E6%A8%A1%E5%9E%8B/%E5%A4%9A%E6%A8%A1%E6%80%81/%E8%A7%86%E9%A2%91" width="280" alt="mindmap radial: LLM landscape"></a> |
|
|
210
|
-
|
|
211
|
-
**`GET /draw`** (no params) or `?tab=pie` — the demo page (11 chart types, all style variants, dual URL forms)
|
|
212
|
-
**`GET /draw/archmap?n=...`** (alias `/draw/arch`) — architecture map sub-path, same params as `type=archmap`
|
|
213
|
-
**`GET /draw/mindmap?n=...`** — mind map sub-path, same params as `type=mindmap`
|
|
214
|
-
**`GET /draw/x-cmd/release-banner?title=<slogan|slogan2>&version=<x.y.z>&cmd=<cmd>[&paper=<yellow|orange|pink|purple|green|cyan|blue|gray|apple>]`** — x-cmd release OG cover (1200×630): paper wash + grain, Inter-Bold slogan, `X-CMD - vX.Y.Z` tag bottom-left, bare terminal with `❯` prompt; `paper=apple` for Apple-white. `&format=png` rasterizes for og:image. [Try it](https://po6.sh/draw/x-cmd/release-banner?title=Validate%20files%7Cagainst%20JSON%20Schema&version=0.10.13&cmd=x%20ajv)
|
|
215
|
-
**`GET/POST /draw/x-cmd/onepage?d=<markdown>`** — mobile long-image one-pager (#28): markdown (+yfm `title/subtitle/tagline/website/contact/qr`) in, a 1800px-wide strip that grows as tall as the content (white editorial style, Chinese-ordinal section heads, inline bold, full-width dark footer with contact + QR card). POST the body for long docs. `&format=png` rasterizes for phone sharing (very tall CJK strips may exceed free-tier CPU — SVG always works).
|
|
216
|
-
**`POST /draw?type=...`** — submit a JSON/CSV body to create a permanent short link
|
|
217
|
-
**`GET /draw/c/<hash>`** — short-link render (immutable)
|
|
218
|
-
|
|
219
|
-
Common parameters:
|
|
220
|
-
|
|
221
|
-
- `t` style family (per chart type, see below; falls back to default when not built for that type)
|
|
222
|
-
- `scheme` `auto` (default, follows system) / `dark` / `light`
|
|
223
|
-
- `v` pin a version; `w`/`h` size (200–1600 / 140–1200; qr is 120–1000 / 140–1000)
|
|
224
|
-
- `format=png` rasterize instead of SVG (`scale=1–3` pixel ratio; scheme is baked — omitting it means light). Latin text only: the embedded Inter subset has no CJK glyphs
|
|
225
|
-
- `num` value labels: `all` / `peak` (highest only) / `none`. Defaults follow the style; applies to pie/bar/hbar/line/area/scatter/combo (radar/gauge/sankey/qr ignore it)
|
|
226
|
-
- `subtitle` editorial subtitle (only rendered by area's editorial style `t=opendata`), `source` data-source footnote (area only, any `t`); other types parse but ignore these
|
|
227
|
-
|
|
228
|
-
## Styles (`?t=`)
|
|
229
|
-
|
|
230
|
-
Per-type reference: [pie](docs/2-chart-types/01-pie/en.md) · [bar](docs/2-chart-types/02-bar/en.md) · [hbar](docs/2-chart-types/03-hbar/en.md) · [line](docs/2-chart-types/04-line/en.md) · [area](docs/2-chart-types/05-area/en.md) · [radar](docs/2-chart-types/06-radar/en.md) · [gauge](docs/2-chart-types/07-gauge/en.md) · [scatter](docs/2-chart-types/08-scatter/en.md) · [combo](docs/2-chart-types/09-combo/en.md) · [sankey](docs/2-chart-types/10-sankey/en.md) · [qr](docs/2-chart-types/11-qr/en.md) — each page has the parameters, the style families, the pitfalls and its own `faq.yml`.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Per chart type, with automatic light/dark palettes:
|
|
234
|
-
|
|
235
|
-
| type | available families |
|
|
236
|
-
|---|---|
|
|
237
|
-
| `pie` | `opendata` (default, all labels outside), `evil` (rounded ring + inner values), `evil-mono` (solid pie + leader lines), `market-mono` (grayscale + ring total), `progress` (dotted progress ring), `revenue` (gradient wedges + dashed inner ring) |
|
|
238
|
-
| `bar` | `evil` (default, grouped), `base` (card), `grid` (table bars) |
|
|
239
|
-
| `hbar` | `base` (default), `opendata` (supports `ref=`/`reflabel=` reference line), `xcmd` (pixel bars, %), `xcmd-issue` (two-series butterfly), `rank` (two-series solid + hatching) |
|
|
240
|
-
| `line` | `shadcn` (default), `evil`, `evil-glow` (glow), `evil-mono`, `opendata` (line-end labels) |
|
|
241
|
-
| `area` | `evil` (default, two-series dashed areas), `star` (hand-drawn), `opendata` (dense gradient + editorial title), `pixel`, `polka` |
|
|
242
|
-
| `radar` | `base` (default), `evil` (multi-series), `xcmd` |
|
|
243
|
-
| `sankey` | `base` (default), `fund`, `pipeline` |
|
|
244
|
-
| `gauge` | `base` (default), `gradient`, `reliability` (zoned ring gauge) |
|
|
245
|
-
| `scatter` / `combo` / `qr` | `base` (combo also has `evil`) |
|
|
246
|
-
|
|
247
|
-
## Two ways to pass data
|
|
248
|
-
|
|
249
|
-
Full catalogue with one row per type: [styles quick reference](docs/3-styles/01-style-families/en.md).
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
**Flat params** (URL stays readable — recommended):
|
|
77
|
+
import { draw } from '@x-cmd/draw';
|
|
253
78
|
|
|
254
|
-
|
|
255
|
-
/draw?type=pie&title=Stars by language&unit=stars&labels=TypeScript,Python,Go,Rust&values=4821,2312,980,645
|
|
256
|
-
/draw?type=bar&title=Weekly downloads&labels=Mon,Tue&values=1200,1800
|
|
79
|
+
const { svg } = draw({ type: 'pie', labels: 'A,B', values: '3,2', t: 'evil', scheme: 'dark' });
|
|
257
80
|
```
|
|
258
81
|
|
|
259
|
-
|
|
82
|
+
Deno users can run `deno add jsr:@x-cmd/draw` and import from `jsr:@x-cmd/draw`. The rendering core accesses neither the network nor the filesystem, making it suitable for restricted environments.
|
|
260
83
|
|
|
261
|
-
|
|
84
|
+
### Control the endpoint and data boundary: run your own service
|
|
262
85
|
|
|
263
|
-
|
|
264
|
-
/draw?type=area&labels=Mon,Tue,Wed&series=Desktop:120,180,150&series=Mobile:80,90,85
|
|
265
|
-
```
|
|
86
|
+
Ideal for a shared team endpoint, internal networks, or avoiding dependence on a public service:
|
|
266
87
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
88
|
+
```sh
|
|
89
|
+
git clone https://github.com/x-cmd/draw && cd draw && npm install
|
|
90
|
+
npm run serve # Local service: http://localhost:8787/draw
|
|
91
|
+
bash scripts/setup.sh # One-command deployment to your Cloudflare account
|
|
271
92
|
```
|
|
272
93
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
QR code: `/draw?type=qr&d=https://github.com/tzw&fg=%236366f1`
|
|
94
|
+
Configure `DATA_REPO`, `DATA_BRANCH`, and `GITHUB_TOKEN` to enable permanent short links; regular GET rendering works without them. See the [self-hosting guide](docs/1-overview/05-self-hosting/en.md).
|
|
276
95
|
|
|
277
|
-
|
|
96
|
+
## Documentation and API
|
|
278
97
|
|
|
279
|
-
|
|
98
|
+
Complete chart references, parameters, and examples are organized by topic:
|
|
280
99
|
|
|
281
|
-
|
|
100
|
+
| Topic | Documentation |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| Browse all chart types and scenarios | [Documentation index](docs/README.md) · [Reference charts](docs/9-showcases/12-reference-examples/en.md) · [Cloud architecture examples](docs/9-showcases/14-cloud-architecture/en.md) |
|
|
103
|
+
| Common parameters and URL encoding | [Parameters](docs/1-overview/07-params/en.md) |
|
|
104
|
+
| JSON data | [Data formats and API](docs/1-overview/04-data-and-api/en.md) |
|
|
105
|
+
| Create short links or configure their storage | [Self-hosting and short-link configuration](docs/1-overview/05-self-hosting/en.md) |
|
|
106
|
+
| Architecture, sequence, ERD, and other structural diagrams | [Diagram URL grammar](docs/1-overview/06-diagram-urls/en.md) |
|
|
107
|
+
| Run locally or deploy to Cloudflare | [Self-hosting guide](docs/1-overview/05-self-hosting/en.md) |
|
|
108
|
+
| Generate charts with an AI agent | [Agent skill](SKILL.md) |
|
|
282
109
|
|
|
283
|
-
|
|
110
|
+
<details>
|
|
111
|
+
<summary>Inside draw: generated project diagrams</summary>
|
|
284
112
|
|
|
285
|
-
|
|
113
|
+
<!-- BEGIN draw-diagrams -->
|
|
114
|
+
<!-- 由 scripts/diagrams.mjs 生成:node scripts/diagrams.mjs(改完用 --check 对一遍) -->
|
|
286
115
|
|
|
287
|
-
|
|
288
|
-
{"title":"GDP per capita 2024",
|
|
289
|
-
"visualMap":{"min":50000,"max":120000,"inRange":{"color":["#dbeafe","#1d4ed8"]}},
|
|
290
|
-
"series":[{"type":"map","map":"USA","data":[{"name":"California","value":102662},{"name":"Mississippi","value":53751}]}]}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
[](https://po6.sh/draw/explore/echarts?d=%7B%22title%22%3A%7B%22text%22%3A%22US%20states%20%C2%B7%20GDP%20per%20capita%202024%20%28USD%29%22%7D%2C%22visualMap%22%3A%7B%22min%22%3A50000%2C%22max%22%3A120000%2C%22orient%22%3A%22horizontal%22%2C%22left%22%3A%22center%22%2C%22bottom%22%3A8%2C%22calculable%22%3Afalse%2C%22text%22%3A%5B%22high%22%2C%22low%22%5D%2C%22itemWidth%22%3A12%2C%22itemHeight%22%3A200%2C%22inRange%22%3A%7B%22color%22%3A%5B%22%23dbeafe%22%2C%22%2393c5fd%22%2C%22%233b82f6%22%2C%22%231d4ed8%22%5D%7D%7D%2C%22series%22%3A%5B%7B%22type%22%3A%22map%22%2C%22map%22%3A%22USA%22%2C%22roam%22%3Afalse%2C%22selectedMode%22%3Afalse%2C%22label%22%3A%7B%22show%22%3Atrue%2C%22fontSize%22%3A9%2C%22lineHeight%22%3A11%7D%2C%22labelLayout%22%3A%7B%22hideOverlap%22%3Atrue%7D%2C%22itemStyle%22%3A%7B%22areaColor%22%3A%22%23f1f5f9%22%2C%22borderColor%22%3A%22%23ffffff%22%2C%22borderWidth%22%3A0.6%7D%2C%22data%22%3A%5B%7B%22name%22%3A%22New%20York%22%2C%22value%22%3A116882.8%2C%22label%22%3A%7B%22formatter%22%3A%22NY%5Cn%24117k%22%2C%22color%22%3A%22%23ffffff%22%7D%7D%2C%7B%22name%22%3A%22Massachusetts%22%2C%22value%22%3A109095.4%2C%22label%22%3A%7B%22formatter%22%3A%22MA%5Cn%24109k%22%2C%22color%22%3A%22%23ffffff%22%7D%7D%2C%7B%22name%22%3A%22Washington%22%2C%22value%22%3A107564.0%2C%22label%22%3A%7B%22formatter%22%3A%22WA%5Cn%24108k%22%2C%22color%22%3A%22%23ffffff%22%7D%7D%2C%7B%22name%22%3A%22Delaware%22%2C%22value%22%3A105494.8%2C%22label%22%3A%7B%22formatter%22%3A%22DE%5Cn%24105k%22%2C%22color%22%3A%22%23ffffff%22%7D%7D%2C%7B%22name%22%3A%22California%22%2C%22value%22%3A102662.4%2C%22label%22%3A%7B%22formatter%22%3A%22CA%5Cn%24103k%22%2C%22color%22%3A%22%23ffffff%22%7D%7D%2C%7B%22name%22%3A%22North%20Dakota%22%2C%22value%22%3A100504.0%2C%22label%22%3A%7B%22formatter%22%3A%22ND%5Cn%24101k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Connecticut%22%2C%22value%22%3A97096.1%2C%22label%22%3A%7B%22formatter%22%3A%22CT%5Cn%2497k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Alaska%22%2C%22value%22%3A96695.1%2C%22label%22%3A%7B%22formatter%22%3A%22AK%5Cn%2497k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Nebraska%22%2C%22value%22%3A94363.5%2C%22label%22%3A%7B%22formatter%22%3A%22NE%5Cn%2494k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Colorado%22%2C%22value%22%3A93602.0%2C%22label%22%3A%7B%22formatter%22%3A%22CO%5Cn%2494k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Illinois%22%2C%22value%22%3A90329.8%2C%22label%22%3A%7B%22formatter%22%3A%22IL%5Cn%2490k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22New%20Jersey%22%2C%22value%22%3A89044.7%2C%22label%22%3A%7B%22formatter%22%3A%22NJ%5Cn%2489k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Texas%22%2C%22value%22%3A88516.9%2C%22label%22%3A%7B%22formatter%22%3A%22TX%5Cn%2489k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Wyoming%22%2C%22value%22%3A87638.7%2C%22label%22%3A%7B%22formatter%22%3A%22WY%5Cn%2488k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Minnesota%22%2C%22value%22%3A87635.9%2C%22label%22%3A%7B%22formatter%22%3A%22MN%5Cn%2488k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Maryland%22%2C%22value%22%3A87180.1%2C%22label%22%3A%7B%22formatter%22%3A%22MD%5Cn%2487k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Virginia%22%2C%22value%22%3A86450.7%2C%22label%22%3A%7B%22formatter%22%3A%22VA%5Cn%2486k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Utah%22%2C%22value%22%3A85475.0%2C%22label%22%3A%7B%22formatter%22%3A%22UT%5Cn%2485k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22New%20Hampshire%22%2C%22value%22%3A84694.0%2C%22label%22%3A%7B%22formatter%22%3A%22NH%5Cn%2485k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22South%20Dakota%22%2C%22value%22%3A83052.2%2C%22label%22%3A%7B%22formatter%22%3A%22SD%5Cn%2483k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Nevada%22%2C%22value%22%3A82330.0%2C%22label%22%3A%7B%22formatter%22%3A%22NV%5Cn%2482k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Iowa%22%2C%22value%22%3A81997.7%2C%22label%22%3A%7B%22formatter%22%3A%22IA%5Cn%2482k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Hawaii%22%2C%22value%22%3A81338.5%2C%22label%22%3A%7B%22formatter%22%3A%22HI%5Cn%2481k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Georgia%22%2C%22value%22%3A78840.7%2C%22label%22%3A%7B%22formatter%22%3A%22GA%5Cn%2479k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Ohio%22%2C%22value%22%3A77683.8%2C%22label%22%3A%7B%22formatter%22%3A%22OH%5Cn%2478k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Tennessee%22%2C%22value%22%3A77645.4%2C%22label%22%3A%7B%22formatter%22%3A%22TN%5Cn%2478k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Kansas%22%2C%22value%22%3A77601.0%2C%22label%22%3A%7B%22formatter%22%3A%22KS%5Cn%2478k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Oregon%22%2C%22value%22%3A77299.0%2C%22label%22%3A%7B%22formatter%22%3A%22OR%5Cn%2477k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Pennsylvania%22%2C%22value%22%3A77061.9%2C%22label%22%3A%7B%22formatter%22%3A%22PA%5Cn%2477k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22North%20Carolina%22%2C%22value%22%3A76426.5%2C%22label%22%3A%7B%22formatter%22%3A%22NC%5Cn%2476k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Wisconsin%22%2C%22value%22%3A76044.4%2C%22label%22%3A%7B%22formatter%22%3A%22WI%5Cn%2476k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Arizona%22%2C%22value%22%3A75185.9%2C%22label%22%3A%7B%22formatter%22%3A%22AZ%5Cn%2475k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Indiana%22%2C%22value%22%3A75028.3%2C%22label%22%3A%7B%22formatter%22%3A%22IN%5Cn%2475k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Florida%22%2C%22value%22%3A73878.7%2C%22label%22%3A%7B%22formatter%22%3A%22FL%5Cn%2474k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Rhode%20Island%22%2C%22value%22%3A72265.1%2C%22label%22%3A%7B%22formatter%22%3A%22RI%5Cn%2472k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Missouri%22%2C%22value%22%3A71846.3%2C%22label%22%3A%7B%22formatter%22%3A%22MO%5Cn%2472k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Louisiana%22%2C%22value%22%3A71594.5%2C%22label%22%3A%7B%22formatter%22%3A%22LA%5Cn%2472k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Vermont%22%2C%22value%22%3A71359.4%2C%22label%22%3A%7B%22formatter%22%3A%22VT%5Cn%2471k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Maine%22%2C%22value%22%3A70585.9%2C%22label%22%3A%7B%22formatter%22%3A%22ME%5Cn%2471k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Michigan%22%2C%22value%22%3A69273.7%2C%22label%22%3A%7B%22formatter%22%3A%22MI%5Cn%2469k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22New%20Mexico%22%2C%22value%22%3A69045.6%2C%22label%22%3A%7B%22formatter%22%3A%22NM%5Cn%2469k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Montana%22%2C%22value%22%3A68975.3%2C%22label%22%3A%7B%22formatter%22%3A%22MT%5Cn%2469k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22South%20Carolina%22%2C%22value%22%3A65173.5%2C%22label%22%3A%7B%22formatter%22%3A%22SC%5Cn%2465k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Idaho%22%2C%22value%22%3A64456.9%2C%22label%22%3A%7B%22formatter%22%3A%22ID%5Cn%2464k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Oklahoma%22%2C%22value%22%3A64388.2%2C%22label%22%3A%7B%22formatter%22%3A%22OK%5Cn%2464k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Kentucky%22%2C%22value%22%3A64374.7%2C%22label%22%3A%7B%22formatter%22%3A%22KY%5Cn%2464k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Alabama%22%2C%22value%22%3A63079.5%2C%22label%22%3A%7B%22formatter%22%3A%22AL%5Cn%2463k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Arkansas%22%2C%22value%22%3A60983.8%2C%22label%22%3A%7B%22formatter%22%3A%22AR%5Cn%2461k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22West%20Virginia%22%2C%22value%22%3A60156.1%2C%22label%22%3A%7B%22formatter%22%3A%22WV%5Cn%2460k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%2C%7B%22name%22%3A%22Mississippi%22%2C%22value%22%3A53751.3%2C%22label%22%3A%7B%22formatter%22%3A%22MS%5Cn%2454k%22%2C%22color%22%3A%22%230f172a%22%7D%7D%5D%7D%5D%7D)
|
|
116
|
+
### Inside draw — the code structure
|
|
294
117
|
|
|
295
|
-
|
|
118
|
+
One edge worker, one render core, four directories that matter: `specs/` parses, `styles/` skins, `render/` draws, `store.ts` keeps the short links.
|
|
296
119
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
```json
|
|
300
|
-
{"name":"California","value":116882.8,"label":{"formatter":"CA\n$117k","color":"#ffffff"}}
|
|
120
|
+
```text
|
|
121
|
+
https://x-cmd.com/draw/arch2?n=entry;fe;Worker%20entry;src/index.ts;r0c0&n=node;svc;Node%20server%20%2B%20CLI;src/node/;r0c1&n=handler;be;handler.ts;routing%20%2B%20responses;r1c0&n=demo;fe;demo/;gallery%20%2B%20landing;r1c1&n=specs;be;specs/;parse%20%2B%20validate;r2c0&n=store;db;store.ts;short%20links%20in%20a%20Git%20repo;r2c1&n=render;be;render/;draw%20the%20SVG;r3c0&n=styles;be;styles/;skins%20%2B%20families;r3c1&e=entry;handler&e=node;handler&e=handler;specs&e=handler;store&e=handler;demo&e=handler;render&e=render;styles&b=Edge%20worker;handler%20specs%20store%20render%20styles&title=Inside%20draw
|
|
301
122
|
```
|
|
302
123
|
|
|
303
|
-
|
|
124
|
+

|
|
304
125
|
|
|
305
|
-
|
|
126
|
+
### One request, step by step
|
|
306
127
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
```
|
|
311
|
-
POST /draw?type=pie body = chart spec JSON
|
|
312
|
-
POST /draw?type=bar&t=evil body = CSV (text/csv, header row)
|
|
313
|
-
→ 201 {"hash":"a3f9c2d4e5f60718","url":"https://x-cmd.com/draw/c/a3f9c2d4e5f60718"}
|
|
128
|
+
The URL is parsed, a skin is picked, the SVG is drawn, and it comes back with `<metadata>` inside — one path for every chart type.
|
|
314
129
|
|
|
315
|
-
|
|
130
|
+
```text
|
|
131
|
+
https://x-cmd.com/draw/seq?n=app;fe;Your%20app;;r0c0&n=worker;be;Worker;;r0c1&n=specs;be;specs/;parse%20%2B%20validate;r0c2&n=render;be;render/;draw%20the%20SVG;r0c3&e=app;worker;GET%20/draw%3Ftype=pie&e=worker;specs;parse%20the%20spec&e=specs;worker;spec;dash&e=worker;render;draw&e=render;worker;SVG;dash&e=worker;app;200%20%2B%20%3Cmetadata%3E;dash&title=One%20request
|
|
316
132
|
```
|
|
317
133
|
|
|
318
|
-
-
|
|
319
|
-
- Multi-series is supported for bar/line/area/radar, plus hbar (only `t=xcmd-issue`/`t=rank`, exactly 2 series); other types reject multi-series bodies with 400. POST is rate-limited to 30/min/IP
|
|
320
|
-
- Server-side config: `DATA_REPO` (public repo, `owner/name`, in wrangler.jsonc) and `GITHUB_TOKEN` (secret; fine-grained PAT with **Contents: write** on that repo only — reads go through raw, tokenless). Data files live at `charts/<hash>.json`
|
|
321
|
-
- Visibility: the data repo is public and browsable — **do not create short links with sensitive data** (private storage is planned, as a paid feature)
|
|
322
|
-
- Compared to quickchart: their short links expire (6 months / days); ours never do
|
|
323
|
-
|
|
324
|
-
## Version semantics
|
|
325
|
-
|
|
326
|
-
- No `v`: renders the **latest** version, `Cache-Control: max-age=300` (output changes as the service upgrades)
|
|
327
|
-
- `?v=1`: pins a version, `Cache-Control: max-age=86400` (1 day; rendering still evolves with deploys — not frozen forever). `v` accepts 1..current; out of range → 400
|
|
328
|
-
- `immutable` is reserved for short links `/c/<hash>` (content-addressed, truly unchanging; `v` is ignored there)
|
|
329
|
-
|
|
330
|
-
## AI-friendly
|
|
134
|
+

|
|
331
135
|
|
|
332
|
-
|
|
136
|
+
### What draw is for
|
|
333
137
|
|
|
334
|
-
|
|
138
|
+
Four kinds of callers: your code, an AI agent, your README, and whoever runs their own copy.
|
|
335
139
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
```sh
|
|
339
|
-
curl -fsSL https://raw.githubusercontent.com/x-cmd/draw/main/scripts/setup.sh | bash
|
|
140
|
+
```text
|
|
141
|
+
https://x-cmd.com/draw/uc?n=caller;actor;Your%20app%20or%20CI&n=agent;actor;AI%20agent&n=writer;actor;README%20or%20docs&n=ops;actor;Self-host%20operator&n=uc1;uc;Render%20a%20chart;GET%20/draw%3Ftype=...&n=uc2;uc;Store%20a%20short%20link;POST%20/draw&n=uc3;uc;Embed%20the%20SVG;markdown%20%2B%20img&n=uc4;uc;Run%20it%20yourself;npm%20%2B%20wrangler&e=caller;uc1&e=caller;uc2&e=agent;uc1&e=writer;uc3&e=ops;uc4&b=draw;uc1%20uc2%20uc3%20uc4&title=What%20draw%20is%20for
|
|
340
142
|
```
|
|
341
143
|
|
|
342
|
-
|
|
144
|
+

|
|
145
|
+
<!-- END draw-diagrams -->
|
|
343
146
|
|
|
344
|
-
|
|
345
|
-
- Already cloned the repo? Run `npm run setup` inside it (skips the clone)
|
|
346
|
-
- Path prefix auto-adapts: both the workers.dev root and a `/draw` sub-route work with zero code changes; or pin it explicitly with the `BASE_PATH` var
|
|
347
|
-
- Custom domain: dashboard → Workers → Settings → Domains & Routes, add a route (any path prefix)
|
|
348
|
-
- On Windows, run under WSL or Git Bash
|
|
147
|
+
</details>
|
|
349
148
|
|
|
350
149
|
## Development
|
|
351
150
|
|
|
352
|
-
Full deployment guide (Workers, local Node, npm library, short links): [deploy it yourself](docs/5-self-hosting/01-deploy/en.md).
|
|
353
|
-
|
|
354
|
-
|
|
355
151
|
```sh
|
|
356
152
|
npm install
|
|
357
|
-
npm run dev # wrangler dev
|
|
358
|
-
npm test #
|
|
153
|
+
npm run dev # Start wrangler dev locally
|
|
154
|
+
npm test # Vitest
|
|
359
155
|
npm run check # tsc --noEmit × 3 (worker / node / build)
|
|
360
|
-
npm run build #
|
|
156
|
+
npm run build # Build dist/ (npm library + CLI)
|
|
361
157
|
npm run deploy # wrangler deploy
|
|
362
158
|
```
|
|
363
159
|
|
|
364
160
|
## License
|
|
365
161
|
|
|
366
|
-
Code is [Apache-2.0](LICENSE). Bundled fonts
|
|
367
|
-
|
|
368
|
-
## Documentation
|
|
369
|
-
|
|
370
|
-
Reference pages live in [`docs/`](docs/README.md), grouped the same way this README is: what the endpoint is, then one page per chart type, then styles, data formats and self-hosting. Every page exists in 19 languages and ships its own `faq.yml` with the questions that page raises.
|
|
371
|
-
|
|
372
|
-
| section | pages |
|
|
373
|
-
|---|---|
|
|
374
|
-
| 1 · Overview | [What is draw](docs/1-overview/01-what-is-draw/en.md) · [Quick start](docs/1-overview/02-quick-start/en.md) |
|
|
375
|
-
| 2 · Chart types | [pie](docs/2-chart-types/01-pie/en.md) · [bar](docs/2-chart-types/02-bar/en.md) · [hbar](docs/2-chart-types/03-hbar/en.md) · [line](docs/2-chart-types/04-line/en.md) · [area](docs/2-chart-types/05-area/en.md) · [radar](docs/2-chart-types/06-radar/en.md) · [gauge](docs/2-chart-types/07-gauge/en.md) · [scatter](docs/2-chart-types/08-scatter/en.md) · [combo](docs/2-chart-types/09-combo/en.md) · [sankey](docs/2-chart-types/10-sankey/en.md) · [qr](docs/2-chart-types/11-qr/en.md) |
|
|
376
|
-
| 3 · Styles | [Style families](docs/3-styles/01-style-families/en.md) |
|
|
377
|
-
| 4 · Data and API | [Data formats](docs/4-data-and-api/01-data-formats/en.md) |
|
|
378
|
-
| 5 · Self-hosting | [Deploy it yourself](docs/5-self-hosting/01-deploy/en.md) |
|
|
379
|
-
|
|
380
|
-
Start with [quick start](docs/1-overview/02-quick-start/en.md) for a first chart, or the per-type page when you already know which chart you want.
|
|
162
|
+
Code is licensed under [Apache-2.0](LICENSE). Bundled fonts retain their own licenses: Inter (OFL, see [`inter-OFL.txt`](src/styles/inter-OFL.txt)) and Handlee (OFL, see [`handlee-OFL.txt`](src/styles/handlee-OFL.txt)).
|