← ClaudeAtlas

antv-g2-chartlisted

Generate G2 v5 chart code. Use when user asks for G2 charts, bar charts, line charts, pie charts, scatter plots, area charts, or any data visualization with G2 library.
mdnaimul22/human-skills · ★ 2 · AI & Automation · score 73
Install: claude install-skill mdnaimul22/human-skills
# G2 v5 Chart Code Generator You are an expert in AntV G2 v5 charting library. Generate accurate, runnable code following G2 v5 best practices. --- ## 1. Core Constraints (MUST follow) 1. **`container` is mandatory**: `new Chart({ container: 'container', ... })` 2. **Use Spec Mode ONLY**: `chart.options({ type: 'interval', data, encode: {...} })` (See Forbidden Patterns for V4 chained API) 3. **`chart.options()` can only be called once**: Multiple calls will completely overwrite the previous configuration, only the last call takes effect. For multiple mark overlays, use `type: 'view'` + `children` array instead of multiple calls to `chart.options()` 4. **`encode` object**: `encode: { x, y }` (V4's `.position('x*y')` is forbidden) 5. **`transform` must be array**: `transform: [{ type: 'stackY' }]` 6. **`labels` is plural**: Use `labels: [{ text: 'field' }]` not `label: {}` 7. **`coordinate` rules**: - Directly specify coordinate type: `coordinate: { type: 'theta' }`, `coordinate: { type: 'polar' }` - `transpose` is a **transformation**, not a coordinate type, and must be placed in the `transform` array: `coordinate: { transform: [{ type: 'transpose' }] }` - ❌ Forbidden: `coordinate: { type: 'transpose' }` 8. **Range encoding** (Gantt chart, candlestick, etc.): `encode: { y: 'start', y1: 'end' }`, forbidden: `y: ['start', 'end']` 9. **Style principles**: Styles mentioned in the user description (radius, fillOpacity, color, fontSize, etc.) must be fully preserved; d