apexcharts-skill 1.2.1 → 2.0.0

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/.cursorrules ADDED
@@ -0,0 +1,272 @@
1
+ # ApexCharts.js — AI Coding Rules
2
+
3
+ You are working with ApexCharts.js (v6), a JavaScript charting library.
4
+ Documentation: https://apexcharts.com/docs/
5
+ NPM: apexcharts
6
+ GitHub: https://github.com/apexcharts/apexcharts.js
7
+
8
+ v6 is backward compatible: existing v5 configs keep working. New chart types (violin, funnel, pyramid, gauge) and the feature platform (plugins, canvas renderer, custom series, undo/redo, shareable views, themes, crossfilter, annotation authoring, storyboard, streaming, drilldown) are opt-in and tree-shakeable. Two behaviors changed on by default (both respect prefers-reduced-motion): coherent add/remove data-transition animations, and mobile pinch-zoom / two-finger pan.
9
+
10
+ ## Framework wrapper detection — check `package.json` first
11
+
12
+ - `react` → use **`react-apexcharts`** instead of the core API.
13
+ - `vue` (Vue 3) → use **`vue3-apexcharts`**. Vue 2 → **`vue-apexcharts`**.
14
+ - `@angular/core` → use **`ng-apexcharts`**.
15
+
16
+ Wrappers handle `destroy()` automatically on unmount, accept reactive props, and forward events idiomatically. Use the core API directly only when no framework is detected, or when the user explicitly asks for vanilla.
17
+
18
+ ## Critical Rules
19
+
20
+ 1. **Always call `chart.render()`** after `new ApexCharts(el, options)`. The constructor does not render.
21
+ 2. **Always call `chart.destroy()`** before creating a new chart on the same element.
22
+ 3. **Series data format is chart-type-specific.** See the Data Format Table below.
23
+ 4. **`yaxis` must be an array** when using multiple y-axes. Each entry needs `seriesName`.
24
+ 5. **`tooltip.shared` and `tooltip.intersect` are mutually exclusive.**
25
+ 6. **Use `null` (not `undefined`)** for missing data points.
26
+ 7. **`chart.stacked: true`** only works with `bar` and `area` chart types.
27
+ 8. **Responsive breakpoints** must be in ascending order.
28
+ 9. **For mixed/combo charts**, set `type` on each series object.
29
+ 10. **RadialBar values must be 0–100** (percentages).
30
+ 11. **Color hex values must include `#`** (e.g., `'#FF5733'`).
31
+ 12. **Tree-shaking**: `apexcharts/core` requires separate chart-type + feature imports.
32
+ 13. **v6 aliases**: `funnel`/`pyramid` render through bar, `gauge` through radialBar. Use them as `chart.type` directly (no `plotOptions.bar.isFunnel`); covered by `apexcharts/bar` and `apexcharts/radialBar`.
33
+ 14. **`violin`** points use a density profile: `data: [{ x, y: { density: [[value, weight], ...], points?: [num] } }]`.
34
+ 15. **`render()` is idempotent (v6)**: a repeated `render()` returns the same promise; still `destroy()` before a new instance on the same element.
35
+
36
+ ---
37
+
38
+ ## Series Data Format Table
39
+
40
+ ### Axis Charts
41
+
42
+ | Chart Type | `chart.type` | Series Format | Example |
43
+ |---|---|---|---|
44
+ | Line | `'line'` | `[{ name, data: [num\|null] }]` or `[{ name, data: [{ x, y }] }]` | `[{ data: [30, 40, null, 50] }]` |
45
+ | Area | `'area'` | Same as line | `[{ data: [10, 20, 30] }]` |
46
+ | Bar/Column | `'bar'` | Same as line. `plotOptions.bar.horizontal: false` for columns. | `[{ data: [44, 55, 41] }]` |
47
+ | Scatter | `'scatter'` | `[{ name, data: [{ x, y }] }]` | `[{ data: [{ x: 1, y: 5 }] }]` |
48
+ | Bubble | `'bubble'` | `[{ name, data: [{ x, y, z }] }]` — z required | `[{ data: [{ x: 1, y: 30, z: 10 }] }]` |
49
+ | Range Area | `'rangeArea'` | `[{ data: [{ x, y: [low, high] }] }]` | `[{ data: [{ x: 'Jan', y: [5, 15] }] }]` |
50
+ | Range Bar | `'rangeBar'` | `[{ data: [{ x, y: [start, end] }] }]` | `[{ data: [{ x: 'Task', y: [1, 5] }] }]` |
51
+ | Candlestick | `'candlestick'` | `[{ data: [{ x, y: [O,H,L,C] }] }]` — 4 values | `[{ data: [{ x: new Date(), y: [51,56,48,53] }] }]` |
52
+ | Box Plot | `'boxPlot'` | `[{ data: [{ x, y: [min,Q1,med,Q3,max] }] }]` — 5 values | `[{ data: [{ x: 'A', y: [10,20,30,40,50] }] }]` |
53
+ | Violin *(v6)* | `'violin'` | `[{ name, data: [{ x, y: { density: [[value,weight],...], points?: [num] } }] }]` | `[{ data: [{ x: 'A', y: { density: [[20,0.1],[30,0.2]], points: [21,29] } }] }]` |
54
+ | Heatmap | `'heatmap'` | `[{ name, data: [{ x, y: number }] }]` — y is intensity | `[{ name: 'Mon', data: [{ x: '10am', y: 45 }] }]` |
55
+ | Treemap | `'treemap'` | `[{ data: [{ x, y: number }] }]` — y is area value | `[{ data: [{ x: 'Item', y: 100 }] }]` |
56
+ | Radar | `'radar'` | `[{ name, data: [num] }]` + `xaxis.categories` | `[{ data: [80, 50, 30] }]` |
57
+ | Funnel *(v6)* | `'funnel'` | `[{ name, data: [num] }]` + `xaxis.categories`; order largest→smallest | `[{ data: [1380, 990, 548, 200] }]` |
58
+ | Pyramid *(v6)* | `'pyramid'` | Same as funnel; order smallest→largest | `[{ data: [200, 548, 990, 1380] }]` |
59
+
60
+ ### Non-Axis Charts (flat number array — NOT object format)
61
+
62
+ ```js
63
+ // Pie, Donut, Polar Area
64
+ { chart: { type: 'pie' }, series: [44, 55, 13], labels: ['A', 'B', 'C'] }
65
+
66
+ // Radial Bar (values 0–100)
67
+ { chart: { type: 'radialBar' }, series: [76, 67, 61], labels: ['X', 'Y', 'Z'] }
68
+
69
+ // Gauge (v6): single value; domain via plotOptions.radialBar.min/max
70
+ { chart: { type: 'gauge' }, series: [72], labels: ['Progress'] }
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Core Lifecycle
76
+
77
+ ```js
78
+ import ApexCharts from 'apexcharts'
79
+
80
+ const chart = new ApexCharts(document.querySelector('#chart'), {
81
+ chart: { type: 'line', height: 350 },
82
+ series: [{ name: 'Sales', data: [30, 40, 35, 50] }],
83
+ xaxis: { categories: ['Q1', 'Q2', 'Q3', 'Q4'] }
84
+ })
85
+
86
+ await chart.render() // REQUIRED
87
+ await chart.updateSeries([{ data: [10, 20, 30, 40] }]) // update data
88
+ await chart.updateOptions({ title: { text: 'New' } }) // update config
89
+ chart.destroy() // cleanup
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Import Paths
95
+
96
+ ```
97
+ apexcharts # Full bundle (all types + features)
98
+ apexcharts/core # Bare core (must register types + features manually)
99
+ apexcharts/line # line, area, scatter, bubble, rangeArea
100
+ apexcharts/bar # bar, column, rangeBar, funnel, pyramid (v6 aliases)
101
+ apexcharts/candlestick # candlestick, boxPlot
102
+ apexcharts/violin # violin (v6)
103
+ apexcharts/pie # pie, donut, polarArea
104
+ apexcharts/radialBar # radialBar, gauge (v6 alias)
105
+ apexcharts/radar # radar
106
+ apexcharts/heatmap # heatmap
107
+ apexcharts/treemap # treemap
108
+ apexcharts/ssr # Server-side rendering (Node.js)
109
+ apexcharts/client # Explicit browser import
110
+
111
+ # Optional features (side-effect imports)
112
+ apexcharts/features/exports # dataURI(), exportToCSV()
113
+ apexcharts/features/legend # Legend component
114
+ apexcharts/features/toolbar # Zoom, pan, download
115
+ apexcharts/features/annotations # X/Y/point annotations
116
+ apexcharts/features/keyboard # Keyboard navigation
117
+ # v6 feature platform (all opt-in):
118
+ apexcharts/features/morph # animated chart-type morphs
119
+ apexcharts/features/drilldown # hierarchical drill-down
120
+ apexcharts/features/history # undo/redo (Rewind)
121
+ apexcharts/features/perspectives # shareable view state
122
+ apexcharts/features/storyboard # scrollytelling
123
+ apexcharts/features/facet # design tokens + OS themes
124
+ apexcharts/features/weave # plugin platform
125
+ apexcharts/features/renderer-canvas # hybrid SVG + canvas renderer (Strata)
126
+ apexcharts/features/marks # custom series types (registerSeriesType)
127
+ apexcharts/features/link # crossfilter / linked views
128
+ apexcharts/features/ink # on-chart annotation authoring
129
+ apexcharts/features/measure # measure / delta ruler
130
+ apexcharts/features/context-menu # right-click context menu
131
+ apexcharts/features/all # All features
132
+ ```
133
+ (Cadence easing and real-time streaming are core: no feature import needed.)
134
+
135
+ ---
136
+
137
+ ## Formatter Signatures
138
+
139
+ | Config Path | Signature |
140
+ |---|---|
141
+ | `xaxis.labels.formatter` | `(value, timestamp?, opts?) => string` |
142
+ | `yaxis.labels.formatter` | `(value, opts?) => string` |
143
+ | `tooltip.x.formatter` | `(value, opts?) => string` |
144
+ | `tooltip.y.formatter` | `(value, opts?) => string` |
145
+ | `tooltip.y.title.formatter` | `(seriesName, opts?) => string` |
146
+ | `dataLabels.formatter` | `(value, opts?) => string \| number` |
147
+ | `legend.formatter` | `(legendName, opts?) => string` |
148
+ | `plotOptions.pie.donut.labels.total.formatter` | `(w) => string` |
149
+ | `plotOptions.radialBar.dataLabels.value.formatter` | `(val) => string` |
150
+
151
+ ---
152
+
153
+ ## Pitfalls — ❌ Wrong vs ✅ Correct
154
+
155
+ ### 1. Pie/donut data format
156
+ ❌ `{ chart: { type: 'pie' }, series: [{ name: 'A', data: [44, 55] }] }`
157
+ ✅ `{ chart: { type: 'pie' }, series: [44, 55], labels: ['A', 'B'] }`
158
+
159
+ ### 2. Missing render()
160
+ ❌ `const chart = new ApexCharts(el, opts)` — nothing displays
161
+ ✅ `const chart = new ApexCharts(el, opts); await chart.render()`
162
+
163
+ ### 3. React/Vue memory leak
164
+ ❌ No cleanup on unmount
165
+ ✅ `useEffect(() => { const c = new ApexCharts(el, opts); c.render(); return () => c.destroy() }, [])`
166
+
167
+ ### 4. Datetime axis with strings
168
+ ❌ `xaxis: { type: 'datetime' }, data: [{ x: 'January 2024', y: 30 }]`
169
+ ✅ `xaxis: { type: 'datetime' }, data: [{ x: new Date('2024-01-01').getTime(), y: 30 }]`
170
+
171
+ ### 5. Multiple y-axes as object
172
+ ❌ `yaxis: { title: { text: 'Value' } }`
173
+ ✅ `yaxis: [{ seriesName: 'Revenue', title: {...} }, { seriesName: 'Profit', opposite: true }]`
174
+
175
+ ### 6. Both shared and intersect tooltips
176
+ ❌ `tooltip: { shared: true, intersect: true }`
177
+ ✅ `tooltip: { shared: true, intersect: false }` or `{ shared: false, intersect: true }`
178
+
179
+ ### 7. undefined for missing data
180
+ ❌ `data: [10, undefined, 30]`
181
+ ✅ `data: [10, null, 30]`
182
+
183
+ ### 8. Stacking on unsupported types
184
+ ❌ `chart: { type: 'scatter', stacked: true }`
185
+ ✅ `chart: { type: 'bar', stacked: true }` (or area)
186
+
187
+ ### 9. Mixed chart without per-series type
188
+ ❌ `series: [{ name: 'A', data: [...] }, { name: 'B', data: [...] }]` — all same type
189
+ ✅ `series: [{ name: 'A', type: 'column', data: [...] }, { name: 'B', type: 'line', data: [...] }]`
190
+
191
+ ### 10. RadialBar > 100
192
+ ❌ `series: [340, 520]`
193
+ ✅ `series: [76, 67]` (percentages 0–100)
194
+
195
+ ### 11. Colors without #
196
+ ❌ `colors: ['FF5733']`
197
+ ✅ `colors: ['#FF5733']`
198
+
199
+ ### 12. Tree-shaking without features
200
+ ❌ `import ApexCharts from 'apexcharts/line'` — no legend/toolbar
201
+ ✅ `import ApexCharts from 'apexcharts/line'; import 'apexcharts/features/legend'`
202
+
203
+ ### 13. SSR with wrong import
204
+ ❌ Server: `import ApexCharts from 'apexcharts'; ApexCharts.renderToString(opts)` — method missing
205
+ ✅ Server: `import ApexCharts from 'apexcharts/ssr'; await ApexCharts.renderToString(opts)`
206
+
207
+ ### 14. updateOptions just to change data
208
+ ❌ `chart.updateOptions({ series: [{ data: newData }] })`
209
+ ✅ `chart.updateSeries([{ name: 'Sales', data: newData }])`
210
+
211
+ ### 15. Bar chart defaults to vertical columns
212
+ ❌ Expecting horizontal bars with just `type: 'bar'`
213
+ ✅ `plotOptions: { bar: { horizontal: true } }` for horizontal bars
214
+
215
+ ### 16. Categories with {x,y} data
216
+ ❌ `xaxis: { categories: ['A','B'] }, series: [{ data: [{ x: 'A', y: 10 }] }]` — categories ignored
217
+ ✅ Either use categories + simple array, OR use {x,y} without categories
218
+
219
+ ---
220
+
221
+ ## API Methods
222
+
223
+ | Method | Description |
224
+ |---|---|
225
+ | `render()` | Render chart. Returns Promise. |
226
+ | `destroy()` | Destroy and clean up. |
227
+ | `updateOptions(opts)` | Merge options and re-render. |
228
+ | `updateSeries(series)` | Replace series data. |
229
+ | `appendSeries(series)` | Add new series. |
230
+ | `appendData(data)` | Append data points. |
231
+ | `toggleSeries(name)` | Show/hide series. |
232
+ | `resetSeries()` | Reset to initial data. |
233
+ | `zoomX(min, max)` | Programmatic zoom. |
234
+ | `addXaxisAnnotation(opts)` | Dynamic annotation. |
235
+ | `addYaxisAnnotation(opts)` | Dynamic annotation. |
236
+ | `addPointAnnotation(opts)` | Dynamic annotation. |
237
+ | `removeAnnotation(id)` | Remove by id. |
238
+ | `clearAnnotations()` | Remove all. |
239
+ | `dataURI()` | Export as image (needs features/exports). |
240
+ | `exportToCSV()` | Export as CSV (needs features/exports). |
241
+
242
+ ### Static Methods
243
+
244
+ | Method | Description |
245
+ |---|---|
246
+ | `ApexCharts.exec(id, fn, ...args)` | Call method on chart by id. |
247
+ | `ApexCharts.getChartByID(id)` | Get instance by id. |
248
+
249
+ ### SSR Methods (apexcharts/ssr only)
250
+
251
+ | Method | Description |
252
+ |---|---|
253
+ | `ApexCharts.renderToString(opts, { width, height })` | SVG string (server). |
254
+ | `ApexCharts.renderToHTML(opts, { width, height })` | HTML wrapper + SVG (server). |
255
+ | `ApexCharts.hydrate(el, clientOpts?)` | Hydrate SSR chart (client). |
256
+ | `ApexCharts.hydrateAll(selector?)` | Hydrate all SSR charts. |
257
+
258
+ ---
259
+
260
+ ## Framework Wrappers
261
+
262
+ ```
263
+ npm install react-apexcharts apexcharts # React
264
+ npm install vue3-apexcharts apexcharts # Vue 3
265
+ npm install ng-apexcharts apexcharts # Angular
266
+ ```
267
+
268
+ React: `<Chart options={opts} series={series} type="line" height={350} />`
269
+ Vue 3: `<apexchart type="bar" :options="opts" :series="series" height="350" />`
270
+ Angular: `<apx-chart [series]="series" [chart]="chart" [xaxis]="xaxis" />`
271
+
272
+ All wrappers handle destroy() on unmount automatically.
package/README.md CHANGED
@@ -16,11 +16,14 @@ AI coding skill for building [ApexCharts.js](https://apexcharts.com/) charts and
16
16
 
17
17
  AI models frequently generate incorrect ApexCharts code — wrong series data formats, missing `render()` calls, broken formatter signatures, etc. This skill provides structured reference files that help AI assistants generate correct ApexCharts code on the first try.
18
18
 
19
+ This skill targets **ApexCharts v6** (backward compatible with v5 configs).
20
+
19
21
  ### Coverage
20
22
 
21
- - **16 chart types**: line, area, bar, pie, donut, radialBar, scatter, bubble, heatmap, candlestick, boxPlot, radar, polarArea, rangeBar, rangeArea, treemap
23
+ - **20 chart types**: line, area, bar, pie, donut, radialBar, scatter, bubble, heatmap, candlestick, boxPlot, violin, radar, polarArea, rangeBar, rangeArea, treemap, funnel, pyramid, gauge
22
24
  - **Correct data formats** for every chart type
23
- - **16 common pitfalls** with wrong/correct code examples
25
+ - **Common pitfalls** with wrong/correct code examples
26
+ - **v6 feature platform**: plugins (Weave), canvas renderer (Strata), custom series (Marks), undo/redo (Rewind), shareable views (Perspectives), themes (Facet), easing (Cadence), crossfilter (Link), annotation authoring (Ink), measure ruler, context menu, storyboard, streaming, drilldown
24
27
  - **Tree-shaking** and bundle optimization patterns
25
28
  - **SSR** (server-side rendering) and hydration
26
29
  - **Framework integration**: React, Vue 3, Angular
@@ -76,11 +79,12 @@ const barCharts = await readFile(referencePath('bar-charts.md'), 'utf8');
76
79
  ├── .cursorrules # Self-contained version for Cursor/Windsurf
77
80
  ├── references/
78
81
  │ ├── cartesian-charts.md # line, area, scatter, bubble, rangeArea
79
- │ ├── bar-charts.md # bar, column, rangeBar, timeline/Gantt
80
- │ ├── financial-charts.md # candlestick, boxPlot
81
- │ ├── circular-charts.md # pie, donut, polarArea, radialBar
82
+ │ ├── bar-charts.md # bar, column, rangeBar, timeline/Gantt, funnel, pyramid
83
+ │ ├── financial-charts.md # candlestick, boxPlot, violin
84
+ │ ├── circular-charts.md # pie, donut, polarArea, radialBar, gauge
82
85
  │ ├── grid-charts.md # heatmap, treemap
83
86
  │ ├── radar-charts.md # radar
87
+ │ ├── v6-features.md # v6 feature platform (plugins, canvas, undo/redo, themes, ...)
84
88
  │ ├── tree-shaking.md # bundle optimization
85
89
  │ ├── ssr.md # server-side rendering
86
90
  │ └── framework-wrappers.md # React, Vue, Angular
package/SKILL.md CHANGED
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  name: apexcharts
3
3
  description: >
4
- AI skill for building ApexCharts.js charts and data visualizations.
4
+ AI skill for building ApexCharts.js charts and data visualizations (targets v6).
5
5
  Use when the user asks to create, configure, or troubleshoot any chart using ApexCharts
6
6
  (line, area, bar, pie, donut, radialBar, scatter, bubble, heatmap, candlestick, boxPlot,
7
- radar, polarArea, rangeBar, rangeArea, treemap). Covers correct data formats, lifecycle,
8
- formatters, tree-shaking, SSR, and framework integration. In React /
7
+ violin, radar, polarArea, rangeBar, rangeArea, treemap, funnel, pyramid, gauge). Covers
8
+ correct data formats, lifecycle, formatters, tree-shaking, SSR, and the v6 feature
9
+ platform (plugins, canvas renderer, custom series, undo/redo, shareable views, themes,
10
+ crossfilter, annotation authoring, storyboard, streaming, drilldown). In React /
9
11
  Vue / Angular projects, prefer the framework wrapper packages
10
12
  (`react-apexcharts`, `vue3-apexcharts`, `ng-apexcharts`) over the core API.
11
13
  metadata:
12
14
  author: ApexCharts
13
- version: "1.2.1"
14
- library_version: "5.15.2"
15
+ version: "2.0.0"
16
+ library_version: "6.1.0"
15
17
  category: data-visualization
16
18
  tags: [charts, visualization, javascript, typescript, svg, apexcharts]
17
19
  docs: https://apexcharts.com/docs/
@@ -28,6 +30,8 @@ metadata:
28
30
  >
29
31
  > Wrappers handle `destroy()` automatically on unmount, accept reactive props, and forward events as idiomatic framework events. Use the core API directly only when no framework is detected, or when the user explicitly asks for vanilla. See `references/framework-wrappers.md`.
30
32
 
33
+ > **Targets ApexCharts v6.** v6 is backward compatible: existing v5 configs keep working unchanged. Everything new (the plugin platform, canvas renderer, custom series, undo/redo, shareable views, themes, crossfilter, annotation authoring, storyboard, streaming, drilldown) is opt-in and tree-shakeable. Two behaviors changed *on by default* (both respect `prefers-reduced-motion`): (1) data updates that add/remove points now animate coherently, and (2) mobile pinch-zoom / two-finger pan gestures are enabled. See `references/v6-features.md` for the full v6 surface.
34
+
31
35
  ## 1. Critical Rules
32
36
 
33
37
  1. **Always call `chart.render()`** after `new ApexCharts(el, options)`. The constructor does not render.
@@ -42,6 +46,9 @@ metadata:
42
46
  10. **RadialBar values must be 0–100** (they represent percentages).
43
47
  11. **Color hex values must include the `#` prefix** (e.g., `'#FF5733'`, not `'FF5733'`).
44
48
  12. **Tree-shaking**: importing `apexcharts/core` gives you a bare class — you must also import chart-type entries and feature entries separately.
49
+ 13. **v6 first-class aliases**: `funnel` and `pyramid` render through the bar engine; `gauge` renders through radialBar. Use them as `chart.type` directly (no `plotOptions.bar.isFunnel` needed). They are covered by the `apexcharts/bar` and `apexcharts/radialBar` tree-shaking entries respectively.
50
+ 14. **`violin` (v6, statistical)** uses a per-point density profile: `data: [{ x, y: { density: [[value, weight], ...], points?: [number] } }]`, not a plain number.
51
+ 15. **`render()` is idempotent (v6)**: calling `render()` twice on the same instance returns the same promise instead of building a duplicate chart. You still must `destroy()` before creating a *new* instance on the same element.
45
52
 
46
53
  ---
47
54
 
@@ -62,23 +69,28 @@ This is the most critical reference. Using the wrong data format is the #1 cause
62
69
  | Range Bar | `'rangeBar'` | `[{ name, data: [{ x, y: [start, end] }] }]` — for timeline/Gantt, use timestamps | `series: [{ name: 'Tasks', data: [{ x: 'Design', y: [1, 5] }] }]` |
63
70
  | Candlestick | `'candlestick'` | `[{ data: [{ x, y: [O, H, L, C] }] }]` — array of 4: Open, High, Low, Close | `series: [{ data: [{ x: new Date('2024-01-01'), y: [51, 56, 48, 53] }] }]` |
64
71
  | Box Plot | `'boxPlot'` | `[{ data: [{ x, y: [min, Q1, median, Q3, max] }] }]` — array of 5 | `series: [{ data: [{ x: 'Group A', y: [10, 20, 30, 40, 50] }] }]` |
72
+ | Violin *(v6)* | `'violin'` | `[{ name, data: [{ x, y: { density: [[value, weight], ...], points?: [number] } }] }]` | `series: [{ name: 'Sessions', data: [{ x: 'A', y: { density: [[20, 0.1], [30, 0.2]], points: [21, 29] } }] }]` |
65
73
  | Heatmap | `'heatmap'` | `[{ name, data: [{ x, y: number }] }]` — y is the intensity value | `series: [{ name: 'Mon', data: [{ x: '10am', y: 45 }] }]` |
66
74
  | Treemap | `'treemap'` | `[{ data: [{ x, y: number }] }]` — y is the area/value | `series: [{ data: [{ x: 'Item A', y: 100 }, { x: 'Item B', y: 60 }] }]` |
67
75
  | Radar | `'radar'` | `[{ name, data: [number] }]` + `xaxis: { categories: [...] }` | `series: [{ name: 'Skill', data: [80, 50, 30, 40, 100] }]` |
76
+ | Funnel *(v6)* | `'funnel'` | `[{ name, data: [number] }]` + `xaxis: { categories: [...] }`. Order values **largest→smallest**. | `series: [{ data: [1380, 990, 548, 200] }]` |
77
+ | Pyramid *(v6)* | `'pyramid'` | Same as funnel; order values **smallest→largest** (wide base at bottom). | `series: [{ data: [200, 548, 990, 1380] }]` |
68
78
 
69
- ### Non-Axis Charts (pie, donut, radialBar, polarArea)
79
+ ### Non-Axis Charts (pie, donut, radialBar, polarArea, gauge)
70
80
 
71
81
  These use a **flat number array** for `series`, NOT the object format:
72
82
 
73
83
  ```js
74
84
  // CORRECT — flat number array + labels
75
85
  {
76
- chart: { type: 'pie' }, // or 'donut', 'polarArea', 'radialBar'
86
+ chart: { type: 'pie' }, // or 'donut', 'polarArea', 'radialBar', 'gauge'
77
87
  series: [44, 55, 13, 43, 22],
78
88
  labels: ['Team A', 'Team B', 'Team C', 'Team D', 'Team E']
79
89
  }
80
90
  ```
81
91
 
92
+ **Gauge *(v6)*** is a single-value radialBar alias: `series: [72]`, `labels: ['Progress']`. Configure the arc/needle, colored bands, ticks, and `min`/`max` domain through `plotOptions.radialBar` (see `references/circular-charts.md`).
93
+
82
94
  ---
83
95
 
84
96
  ## 3. Package / Module Map
@@ -101,21 +113,37 @@ import ApexCharts from 'apexcharts/column' # same as /bar
101
113
  import ApexCharts from 'apexcharts/rangeBar' # same as /bar
102
114
  import ApexCharts from 'apexcharts/candlestick' # candlestick, boxPlot
103
115
  import ApexCharts from 'apexcharts/boxPlot' # same as /candlestick
116
+ import ApexCharts from 'apexcharts/violin' # violin (v6)
104
117
  import ApexCharts from 'apexcharts/pie' # pie, donut, polarArea
105
118
  import ApexCharts from 'apexcharts/donut' # same as /pie
106
119
  import ApexCharts from 'apexcharts/polarArea' # same as /pie
107
- import ApexCharts from 'apexcharts/radialBar' # radialBar only
120
+ import ApexCharts from 'apexcharts/radialBar' # radialBar + gauge (v6)
108
121
  import ApexCharts from 'apexcharts/radar' # radar only
109
122
  import ApexCharts from 'apexcharts/heatmap' # heatmap only
110
123
  import ApexCharts from 'apexcharts/treemap' # treemap only
124
+ # funnel + pyramid (v6) render through the bar engine; use apexcharts/bar
111
125
 
112
126
  # Optional features (side-effect imports — just import, no default export needed)
113
- import 'apexcharts/features/exports' # PNG/SVG/CSV export methods
114
- import 'apexcharts/features/legend' # Interactive legend component
115
- import 'apexcharts/features/toolbar' # Toolbar (zoom, pan, download buttons)
116
- import 'apexcharts/features/annotations' # X/Y/point/text/image annotations
117
- import 'apexcharts/features/keyboard' # Keyboard navigation (accessibility)
118
- import 'apexcharts/features/all' # All features at once
127
+ import 'apexcharts/features/exports' # PNG/SVG/CSV export methods
128
+ import 'apexcharts/features/legend' # Interactive legend component
129
+ import 'apexcharts/features/toolbar' # Toolbar (zoom, pan, download buttons)
130
+ import 'apexcharts/features/annotations' # X/Y/point/text/image annotations
131
+ import 'apexcharts/features/keyboard' # Keyboard navigation (accessibility)
132
+ # v6 feature platform (all opt-in, all tree-shakeable)
133
+ import 'apexcharts/features/morph' # Animated chart-type morphs
134
+ import 'apexcharts/features/drilldown' # Hierarchical drill-down
135
+ import 'apexcharts/features/history' # Undo/redo (Rewind)
136
+ import 'apexcharts/features/perspectives' # Shareable view state
137
+ import 'apexcharts/features/storyboard' # Scrollytelling (includes perspectives)
138
+ import 'apexcharts/features/facet' # Design tokens + OS-aware themes
139
+ import 'apexcharts/features/weave' # Public plugin platform
140
+ import 'apexcharts/features/renderer-canvas' # Hybrid SVG + canvas renderer (Strata)
141
+ import 'apexcharts/features/marks' # Custom series types (registerSeriesType)
142
+ import 'apexcharts/features/link' # Crossfilter / linked views
143
+ import 'apexcharts/features/ink' # On-chart annotation authoring
144
+ import 'apexcharts/features/measure' # Measure / delta ruler
145
+ import 'apexcharts/features/context-menu' # Right-click / long-press context menu
146
+ import 'apexcharts/features/all' # All features at once
119
147
 
120
148
  # SSR (server-side rendering)
121
149
  import ApexCharts from 'apexcharts/ssr' # Node.js: renderToString, renderToHTML
@@ -484,6 +512,19 @@ await chart.updateOptions({ title: { text: 'New Title' } })
484
512
  | `addEventListener(name, handler)` | Subscribe to chart event. |
485
513
  | `removeEventListener(name, handler)` | Unsubscribe from chart event. |
486
514
 
515
+ ### v6 Instance Methods (require the matching feature import)
516
+
517
+ | Method | Feature | Description |
518
+ |---|---|---|
519
+ | `chart.history.undo() / redo() / jump(id) / transaction(fn)` | history | Undo/redo over the command journal. |
520
+ | `chart.perspectives.capture() / toURL() / apply(token)` | perspectives | Serialize / restore the exact view. |
521
+ | `chart.getActiveRenderer()` | renderer-canvas | Returns `'svg' \| 'canvas'` currently in use. |
522
+ | `chart.refreshTokens()` | facet | Re-read `--apx-*` CSS custom properties. |
523
+ | `chart.startMeasure() / stopMeasure() / clearMeasures()` | measure | Drive the measure ruler from code. |
524
+ | `chart.storyboard.bind({ beats }) / goTo() / unbind()` | storyboard | Scroll-driven choreography. |
525
+ | `chart.drillDown(id) / drillUp() / drillToRoot()` | drilldown | Navigate the drill-down hierarchy. |
526
+ | `chart.clearCrossfilter()` | link | Clear active crossfilter selections. |
527
+
487
528
  ### Static Methods
488
529
 
489
530
  | Method | Description |
@@ -493,15 +534,21 @@ await chart.updateOptions({ title: { text: 'New Title' } })
493
534
  | `ApexCharts.merge(target, source)` | Deep-merge objects. |
494
535
  | `ApexCharts.use(typeMap)` | Register chart type constructors (tree-shaking). |
495
536
  | `ApexCharts.registerFeatures(featureMap)` | Register optional feature modules. |
537
+ | `ApexCharts.registerPlugin(def) / unregisterPlugin(name)` | *(v6, Weave)* Register a reusable plugin. |
538
+ | `ApexCharts.registerSeriesType(name, def) / unregisterSeriesType(name)` | *(v6, Marks)* Register a custom series type. |
539
+ | `ApexCharts.registerTheme(name, def) / unregisterTheme(name)` | *(v6, Facet)* Register a named brand theme. |
540
+ | `ApexCharts.registerEasing(name, fn)` | *(v6, Cadence)* Register a custom easing curve. |
541
+ | `ApexCharts.crossfilter({ id, records }) / getCrossfilter(id)` | *(v6, Link)* Create / fetch a crossfilter engine. |
542
+ | `ApexCharts.perspectives.fromURL(href)` | *(v6)* Decode a perspective token from a URL. |
496
543
 
497
544
  ### SSR Static Methods (available with `apexcharts/ssr`)
498
545
 
499
546
  | Method | Description |
500
547
  |---|---|
501
- | `ApexCharts.renderToString(options)` | Render chart to SVG string (Node.js). |
502
- | `ApexCharts.renderToHTML(options)` | Render chart to HTML string with wrapper (Node.js). |
503
- | `ApexCharts.hydrate(element)` | Hydrate server-rendered chart (browser). |
504
- | `ApexCharts.hydrateAll()` | Hydrate all server-rendered charts on page. |
548
+ | `ApexCharts.renderToString(options, { width, height, scale })` | Render chart to raw SVG string (Node.js). |
549
+ | `ApexCharts.renderToHTML(options, { width, height, scale, className })` | Render hydration-ready HTML string (Node.js). |
550
+ | `ApexCharts.hydrate(element, clientOptions?)` | Hydrate a server-rendered chart (browser). |
551
+ | `ApexCharts.hydrateAll(selector?, clientOptions?)` | Hydrate all server-rendered charts on page. |
505
552
  | `ApexCharts.isHydrated(element)` | Check if element is already hydrated. |
506
553
 
507
554
  ---
@@ -537,6 +584,17 @@ await chart.updateOptions({ title: { text: 'New Title' } })
537
584
  beforeResetZoom: (chart, options) => {}, // return false to cancel
538
585
  scrolled: (chart, { xaxis }) => {},
539
586
  selection: (chart, { xaxis, yaxis }) => {},
587
+
588
+ // v6 feature events (fire only when the matching feature is enabled)
589
+ annotationDragged: (chart, options) => {}, // ink
590
+ annotationEdited: (chart, options) => {}, // ink
591
+ annotationStyled: (chart, options) => {}, // ink
592
+ annotationDeleted: (chart, options) => {}, // ink
593
+ measured: (chart, { from, to, dx, dy, percentChange, slope }) => {}, // measure
594
+ beatChange: (chart, beatInfo) => {}, // storyboard
595
+ drillDownStart: (info, chart, options) => {},// drilldown
596
+ drillDownEnd: (info, chart, options) => {}, // drilldown
597
+ drillUp: (info, chart, options) => {}, // drilldown
540
598
  }
541
599
  }
542
600
  }
@@ -544,18 +602,40 @@ await chart.updateOptions({ title: { text: 'New Title' } })
544
602
 
545
603
  ---
546
604
 
547
- ## 9. Reference Routing Table
605
+ ## 9. v6 Feature Platform (opt-in, tree-shakeable)
606
+
607
+ All of the following are new in v6, off by default, and each ships as a `apexcharts/features/*` entry. Full config shapes, APIs, and examples are in `references/v6-features.md`. Quick map:
608
+
609
+ | Feature | Opt-in | One-liner |
610
+ |---|---|---|
611
+ | **Weave** (plugins) | `apexcharts/features/weave` | Publish reusable chart plugins against a stable `ApexCharts.registerPlugin({ name, setup })` API; activate per chart with `plugins: [{ name }]`. |
612
+ | **Strata** (canvas) | `apexcharts/features/renderer-canvas` | `chart: { renderer: 'auto', rendererThreshold }` paints the dense series layer to canvas while axes/tooltips/exports stay SVG. |
613
+ | **Marks** (custom series) | `apexcharts/features/marks` | `ApexCharts.registerSeriesType(name, { renderItem })` for first-class custom marks (lollipop, dumbbell, bullet). Baseline is `scales.y(0)`, **not** `api.zeroY`. |
614
+ | **Rewind** (undo/redo) | `apexcharts/features/history` | `chart: { history: { enabled: true } }`, then `chart.history.undo()/redo()/jump()/transaction()`. |
615
+ | **Perspectives** (view state) | `apexcharts/features/perspectives` | `chart.perspectives.capture()/toURL()/apply()` to serialize and restore the exact view. |
616
+ | **Facet** (themes/tokens) | `apexcharts/features/facet` | `theme: { follow: 'os', name }`, `--apx-*` CSS custom props, `ApexCharts.registerTheme`. |
617
+ | **Cadence** (easing) | core | `chart.animations.easing` accepts a named curve, cubic-bezier array, or function; `ApexCharts.registerEasing`. |
618
+ | **Link** (crossfilter) | `apexcharts/features/link` | `chart: { group, link: { enabled, mode } }` for highlight linking; `ApexCharts.crossfilter({ id, records })` for a filter engine. |
619
+ | **Ink** (annotation authoring) | `apexcharts/features/ink` | `chart: { ink: { enabled: true } }` makes annotations draggable/resizable with a floating editor. |
620
+ | **Measure** (ruler) | `apexcharts/features/measure` | `chart: { measure: { enabled, mode } }`; hold a key and drag to read change/percent/slope. v6.1 adds a toolbar tool (`toolbar.tools.measure`, `toolbar.autoSelected: 'measure'`). |
621
+ | **Context menu** | `apexcharts/features/context-menu` | `chart: { contextMenu: { enabled, items } }` for point-specific right-click actions. |
622
+ | **Storyboard** (scrollytelling) | `apexcharts/features/storyboard` | `chart.storyboard.bind({ beats })` pairs prose sections with saved views. |
623
+ | **Streaming** | core | `chart: { streaming: { enabled, maxPoints } }` for constant-velocity rolling-window scroll. |
624
+ | **Drilldown** | `apexcharts/features/drilldown` | `drilldown: { enabled, series }` + a `drilldown` id on data points; `chart.drillDown()/drillUp()`. |
625
+
626
+ ## 10. Reference Routing Table
548
627
 
549
628
  For detailed chart-family-specific options, data format variants, and full working examples, refer to:
550
629
 
551
630
  | Topic | Reference File |
552
631
  |---|---|
553
632
  | Line, Area, Scatter, Bubble, Range Area | `references/cartesian-charts.md` |
554
- | Bar, Column, Range Bar, Timeline/Gantt | `references/bar-charts.md` |
555
- | Candlestick, Box Plot | `references/financial-charts.md` |
556
- | Pie, Donut, Polar Area, Radial Bar | `references/circular-charts.md` |
633
+ | Bar, Column, Range Bar, Timeline/Gantt, Funnel, Pyramid | `references/bar-charts.md` |
634
+ | Candlestick, Box Plot, Violin | `references/financial-charts.md` |
635
+ | Pie, Donut, Polar Area, Radial Bar, Gauge | `references/circular-charts.md` |
557
636
  | Heatmap, Treemap | `references/grid-charts.md` |
558
637
  | Radar | `references/radar-charts.md` |
638
+ | v6 feature platform (plugins, canvas, undo/redo, themes, crossfilter, storyboard, ...) | `references/v6-features.md` |
559
639
  | Tree-shaking, Bundle optimization | `references/tree-shaking.md` |
560
640
  | Server-side rendering, Hydration | `references/ssr.md` |
561
641
  | React, Vue, Angular integration | `references/framework-wrappers.md` |
package/index.js CHANGED
@@ -26,6 +26,7 @@ export const referenceFiles = [
26
26
  'radar-charts.md',
27
27
  'ssr.md',
28
28
  'tree-shaking.md',
29
+ 'v6-features.md',
29
30
  ];
30
31
 
31
32
  /** Resolve a reference file by its filename. Throws if not in the known list. */
@@ -0,0 +1,25 @@
1
+ # Installing ApexCharts Skill for Claude Code
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ # Navigate to your project's Claude config
7
+ mkdir -p .claude/skills
8
+ cd .claude/skills
9
+
10
+ # Clone the skill
11
+ git clone https://github.com/apexcharts/apexcharts-skill.git
12
+ ```
13
+
14
+ Claude Code will automatically detect and use the skill files when working on ApexCharts code.
15
+
16
+ ## Verification
17
+
18
+ Ask Claude to create a simple chart:
19
+
20
+ > Create a line chart with ApexCharts showing monthly sales data
21
+
22
+ Claude should generate code that:
23
+ - Calls `new ApexCharts(el, options)` followed by `chart.render()`
24
+ - Uses the correct series data format
25
+ - Includes proper cleanup patterns for your framework
@@ -0,0 +1,23 @@
1
+ # Installing ApexCharts Skill for GitHub Copilot
2
+
3
+ ## VS Code + Copilot Chat
4
+
5
+ ### Option 1: Add as Workspace Context
6
+
7
+ 1. Clone this repository or download `SKILL.md` into your project
8
+ 2. In Copilot Chat, reference the file: `@workspace #file:SKILL.md`
9
+ 3. Ask your charting question
10
+
11
+ ### Option 2: Custom Instructions
12
+
13
+ 1. Open VS Code Settings (Cmd/Ctrl + ,)
14
+ 2. Search for "Copilot Custom Instructions"
15
+ 3. Paste the contents of `.cursorrules` into the custom instructions field
16
+
17
+ ## Copilot in GitHub.com
18
+
19
+ When working in GitHub's web editor with Copilot, paste the relevant sections from `SKILL.md` into your prompt for accurate ApexCharts code generation.
20
+
21
+ ## Verification
22
+
23
+ Ask Copilot to generate a chart. It should use the correct series data format and call `render()` after construction.
@@ -0,0 +1,27 @@
1
+ # Installing ApexCharts Skill for Cursor
2
+
3
+ ## Setup
4
+
5
+ 1. Copy the `.cursorrules` file from this repository into the root of your project:
6
+
7
+ ```bash
8
+ cp /path/to/apexcharts-skill/.cursorrules /path/to/your-project/.cursorrules
9
+ ```
10
+
11
+ Or download it directly:
12
+
13
+ ```bash
14
+ curl -o .cursorrules https://raw.githubusercontent.com/apexcharts/apexcharts-skill/main/.cursorrules
15
+ ```
16
+
17
+ 2. Restart Cursor or open a new Cursor window.
18
+
19
+ Cursor automatically reads `.cursorrules` files in the project root and uses them as context for AI-assisted coding.
20
+
21
+ ## For Windsurf
22
+
23
+ Same approach — Windsurf also supports `.cursorrules` files in the project root.
24
+
25
+ ## Verification
26
+
27
+ Ask Cursor to generate a chart. It should follow the correct data format patterns and lifecycle (render/destroy).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apexcharts-skill",
3
- "version": "1.2.1",
3
+ "version": "2.0.0",
4
4
  "description": "AI coding skill for ApexCharts.js — structured reference docs that help AI assistants (Claude, Cursor, Copilot, etc.) generate correct ApexCharts code.",
5
5
  "keywords": [
6
6
  "apexcharts",
@@ -35,7 +35,9 @@
35
35
  "files": [
36
36
  "index.js",
37
37
  "SKILL.md",
38
- "references"
38
+ "references",
39
+ "install",
40
+ ".cursorrules"
39
41
  ],
40
42
  "engines": {
41
43
  "node": ">=18"