vega
27
总安装量
27
周安装量
#7584
全站排名
安装命令
npx skills add https://github.com/markdown-viewer/skills --skill vega
Agent 安装分布
github-copilot
25
opencode
25
gemini-cli
24
codex
24
kimi-cli
23
amp
23
Skill 文档
Vega / Vega-Lite Visualizer
Quick Start: Structure data as array of objects â Choose mark type (bar/line/point/area/arc/rect) â Map encodings (x, y, color, size) to fields â Set data types (quantitative/nominal/ordinal/temporal) â Wrap in ```vega-lite or ```vega fence. Always include $schema, use valid JSON with double quotes, field names are case-sensitive. Use Vega-Lite for 90% of charts; Vega only for radar, word cloud, force-directed.
Critical Syntax Rules
Rule 1: Always Include Schema
"$schema": "https://vega.github.io/schema/vega-lite/v5.json"
Rule 2: Valid JSON Only
â {field: "x",} â Trailing comma, unquoted key
â
{"field": "x"} â Proper JSON
Rule 3: Field Names Must Match Data
â "field": "Category" when data has "category"
â
"field": "category" â Case-sensitive match
Rule 4: Type Must Be Valid
â
quantitative | nominal | ordinal | temporal
â numeric | string | date
Common Pitfalls
| Issue | Solution |
|---|---|
| Chart not rendering | Check JSON validity, verify $schema |
| Data not showing | Field names must match exactly |
| Wrong chart type | Match mark to data structure |
| Colors not visible | Check color scale contrast |
| Dual-axis issues | Add resolve: {scale: {y: "independent"}} |
Output Format
```vega-lite
{...}
```
Or for full Vega:
```vega
{...}
```
Related Files
For advanced chart patterns and complex visualizations, refer to references below:
- examples.md â Stacked bar, grouped bar, multi-series line, area, heatmap, radar (Vega), word cloud (Vega), and interactive chart examples