apexcharts-skill 1.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/index.js ADDED
@@ -0,0 +1,47 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { dirname, join } from 'node:path';
3
+
4
+ const packageRoot = dirname(fileURLToPath(import.meta.url));
5
+
6
+ /** Absolute path to the package root (where SKILL.md lives). */
7
+ export const packageDir = packageRoot;
8
+
9
+ /** Absolute path to SKILL.md (the top-level skill index). */
10
+ export const skillFile = join(packageRoot, 'SKILL.md');
11
+
12
+ /** Absolute path to the references/ directory containing per-topic markdown docs. */
13
+ export const referencesDir = join(packageRoot, 'references');
14
+
15
+ /**
16
+ * Filenames of every reference doc shipped with this package, relative to
17
+ * `referencesDir`. Useful for iterating without scanning the filesystem.
18
+ */
19
+ export const referenceFiles = [
20
+ 'bar-charts.md',
21
+ 'cartesian-charts.md',
22
+ 'circular-charts.md',
23
+ 'financial-charts.md',
24
+ 'framework-wrappers.md',
25
+ 'grid-charts.md',
26
+ 'radar-charts.md',
27
+ 'ssr.md',
28
+ 'tree-shaking.md',
29
+ ];
30
+
31
+ /** Resolve a reference file by its filename. Throws if not in the known list. */
32
+ export function referencePath(filename) {
33
+ if (!referenceFiles.includes(filename)) {
34
+ throw new Error(
35
+ `Unknown reference file "${filename}". Known files: ${referenceFiles.join(', ')}`,
36
+ );
37
+ }
38
+ return join(referencesDir, filename);
39
+ }
40
+
41
+ export default {
42
+ packageDir,
43
+ skillFile,
44
+ referencesDir,
45
+ referenceFiles,
46
+ referencePath,
47
+ };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "apexcharts-skill",
3
+ "version": "1.0.0",
4
+ "description": "AI coding skill for ApexCharts.js — structured reference docs that help AI assistants (Claude, Cursor, Copilot, etc.) generate correct ApexCharts code.",
5
+ "keywords": [
6
+ "apexcharts",
7
+ "ai",
8
+ "skill",
9
+ "claude",
10
+ "cursor",
11
+ "copilot",
12
+ "charts",
13
+ "data-visualization",
14
+ "documentation",
15
+ "reference"
16
+ ],
17
+ "author": "ApexCharts <info@apexcharts.com>",
18
+ "license": "MIT",
19
+ "homepage": "https://github.com/apexcharts/apexcharts-skill#readme",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/apexcharts/apexcharts-skill.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/apexcharts/apexcharts-skill/issues"
26
+ },
27
+ "type": "module",
28
+ "main": "index.js",
29
+ "exports": {
30
+ ".": "./index.js",
31
+ "./SKILL.md": "./SKILL.md",
32
+ "./references/*": "./references/*",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "files": [
36
+ "index.js",
37
+ "SKILL.md",
38
+ "references"
39
+ ],
40
+ "engines": {
41
+ "node": ">=18"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ }
46
+ }
@@ -0,0 +1,244 @@
1
+ # Bar Charts Reference — ApexCharts
2
+
3
+ ## Chart Types Covered
4
+
5
+ - **Bar** (`'bar'`) — Horizontal bar chart (default orientation)
6
+ - **Column** (`'bar'` + `plotOptions.bar.horizontal: false`) — Vertical bar/column chart
7
+ - **Range Bar** (`'rangeBar'`) — Bars with start/end values (used for timelines, Gantt charts)
8
+
9
+ ## Tree-Shakeable Import
10
+
11
+ ```js
12
+ import ApexCharts from 'apexcharts/bar'
13
+ // Registers: bar, column, rangeBar
14
+ // Aliases: apexcharts/column, apexcharts/rangeBar
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Data Formats
20
+
21
+ ### Basic Bar / Column
22
+
23
+ ```js
24
+ {
25
+ chart: { type: 'bar', height: 350 },
26
+ series: [{
27
+ name: 'Sales',
28
+ data: [44, 55, 41, 67, 22, 43]
29
+ }],
30
+ xaxis: {
31
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
32
+ },
33
+ plotOptions: {
34
+ bar: {
35
+ horizontal: true // true = horizontal bars (default)
36
+ // false = vertical columns
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ### Grouped Bars (multiple series)
43
+
44
+ ```js
45
+ {
46
+ chart: { type: 'bar', height: 350 },
47
+ series: [
48
+ { name: '2023', data: [44, 55, 41] },
49
+ { name: '2024', data: [53, 32, 33] }
50
+ ],
51
+ xaxis: { categories: ['Q1', 'Q2', 'Q3'] },
52
+ plotOptions: { bar: { horizontal: false } }
53
+ }
54
+ ```
55
+
56
+ ### Stacked Bars
57
+
58
+ ```js
59
+ {
60
+ chart: { type: 'bar', height: 350, stacked: true },
61
+ // stackType: '100%' // uncomment for percentage stacking
62
+ series: [
63
+ { name: 'Product A', data: [44, 55, 41] },
64
+ { name: 'Product B', data: [13, 23, 20] },
65
+ { name: 'Product C', data: [11, 17, 15] }
66
+ ],
67
+ xaxis: { categories: ['2022', '2023', '2024'] },
68
+ plotOptions: { bar: { horizontal: false } }
69
+ }
70
+ ```
71
+
72
+ ### Range Bar (start/end values)
73
+
74
+ ```js
75
+ {
76
+ chart: { type: 'rangeBar', height: 350 },
77
+ series: [{
78
+ name: 'Salary Range',
79
+ data: [
80
+ { x: 'Engineering', y: [80000, 150000] }, // [start, end]
81
+ { x: 'Design', y: [60000, 120000] },
82
+ { x: 'Marketing', y: [50000, 110000] }
83
+ ]
84
+ }],
85
+ plotOptions: { bar: { horizontal: true } }
86
+ }
87
+ ```
88
+
89
+ ### Timeline / Gantt Chart (Range Bar with dates)
90
+
91
+ ```js
92
+ {
93
+ chart: { type: 'rangeBar', height: 350 },
94
+ series: [{
95
+ data: [
96
+ {
97
+ x: 'Design',
98
+ y: [new Date('2024-01-01').getTime(), new Date('2024-03-15').getTime()]
99
+ },
100
+ {
101
+ x: 'Development',
102
+ y: [new Date('2024-02-15').getTime(), new Date('2024-07-01').getTime()]
103
+ },
104
+ {
105
+ x: 'Testing',
106
+ y: [new Date('2024-06-01').getTime(), new Date('2024-08-01').getTime()]
107
+ }
108
+ ]
109
+ }],
110
+ plotOptions: {
111
+ bar: { horizontal: true }
112
+ },
113
+ xaxis: { type: 'datetime' }
114
+ }
115
+ ```
116
+
117
+ ### Multi-Series Timeline (color-coded tasks)
118
+
119
+ ```js
120
+ {
121
+ chart: { type: 'rangeBar', height: 350 },
122
+ series: [
123
+ {
124
+ name: 'Team A',
125
+ data: [
126
+ { x: 'Design', y: [new Date('2024-01-01').getTime(), new Date('2024-03-01').getTime()] },
127
+ { x: 'Code', y: [new Date('2024-03-01').getTime(), new Date('2024-06-01').getTime()] }
128
+ ]
129
+ },
130
+ {
131
+ name: 'Team B',
132
+ data: [
133
+ { x: 'Design', y: [new Date('2024-02-01').getTime(), new Date('2024-04-01').getTime()] },
134
+ { x: 'Test', y: [new Date('2024-04-01').getTime(), new Date('2024-07-01').getTime()] }
135
+ ]
136
+ }
137
+ ],
138
+ plotOptions: { bar: { horizontal: true } },
139
+ xaxis: { type: 'datetime' }
140
+ }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Key plotOptions.bar Options
146
+
147
+ ```js
148
+ plotOptions: {
149
+ bar: {
150
+ horizontal: true, // true = horizontal bars, false = vertical columns
151
+ columnWidth: '70%', // width of each column (string percentage)
152
+ barHeight: '70%', // height of each bar when horizontal
153
+ distributed: false, // true = different color per data point
154
+ borderRadius: 4, // rounded corners (number or object)
155
+ borderRadiusApplication: 'end', // 'end' | 'around'
156
+ borderRadiusWhenStacked: 'last', // 'all' | 'last'
157
+
158
+ dataLabels: {
159
+ position: 'top', // 'top' | 'center' | 'bottom'
160
+ orientation: 'horizontal' // 'horizontal' | 'vertical'
161
+ },
162
+
163
+ colors: {
164
+ ranges: [{
165
+ from: 0,
166
+ to: 50,
167
+ color: '#F15B46' // conditional coloring by value range
168
+ }]
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ ### Goals / Target Markers
175
+
176
+ ```js
177
+ series: [{
178
+ name: 'Actual',
179
+ data: [
180
+ {
181
+ x: 'Q1',
182
+ y: 400,
183
+ goals: [{
184
+ name: 'Target',
185
+ value: 500,
186
+ strokeWidth: 5,
187
+ strokeColor: '#775DD0'
188
+ }]
189
+ }
190
+ ]
191
+ }]
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Complete Working Example — Grouped Column Chart
197
+
198
+ ```html
199
+ <div id="chart"></div>
200
+ <script type="module">
201
+ import ApexCharts from 'apexcharts'
202
+
203
+ const options = {
204
+ chart: {
205
+ type: 'bar',
206
+ height: 350
207
+ },
208
+ series: [
209
+ { name: '2023', data: [44, 55, 57, 56, 61] },
210
+ { name: '2024', data: [76, 85, 101, 98, 87] }
211
+ ],
212
+ xaxis: {
213
+ categories: ['Feb', 'Mar', 'Apr', 'May', 'Jun']
214
+ },
215
+ plotOptions: {
216
+ bar: {
217
+ horizontal: false,
218
+ columnWidth: '55%',
219
+ borderRadius: 4
220
+ }
221
+ },
222
+ dataLabels: { enabled: false },
223
+ stroke: { show: true, width: 2, colors: ['transparent'] },
224
+ yaxis: { title: { text: 'Revenue ($K)' } },
225
+ fill: { opacity: 1 },
226
+ tooltip: {
227
+ y: { formatter: (val) => `$${val}K` }
228
+ }
229
+ }
230
+
231
+ const chart = new ApexCharts(document.querySelector('#chart'), options)
232
+ await chart.render()
233
+ </script>
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Family-Specific Pitfalls
239
+
240
+ 1. **Forgetting `plotOptions.bar.horizontal: false` for column charts** — ApexCharts defaults to horizontal bars. Set `horizontal: false` explicitly for vertical columns.
241
+ 2. **Stacking with `chart.stacked: true` but missing on bar type** — stacking only works on `type: 'bar'` (and `'area'`). It does NOT work on line, scatter, etc.
242
+ 3. **Range Bar with single value instead of array** — `y` must be `[start, end]`, not a single number.
243
+ 4. **Timeline without `xaxis.type: 'datetime'`** — date-based range bars need `xaxis: { type: 'datetime' }` to render correctly.
244
+ 5. **`distributed: true` with multiple series** — distributed coloring applies to each data point independently. With multiple series, each point gets a unique color which is usually not desired. Use `distributed: true` only with single-series charts.
@@ -0,0 +1,247 @@
1
+ # Cartesian Charts Reference — ApexCharts
2
+
3
+ ## Chart Types Covered
4
+
5
+ - **Line** (`'line'`) — Standard line chart connecting data points
6
+ - **Area** (`'area'`) — Line chart with filled area below
7
+ - **Scatter** (`'scatter'`) — Individual data points plotted by X/Y coordinates
8
+ - **Bubble** (`'bubble'`) — Scatter with variable-size bubbles (requires z value)
9
+ - **Range Area** (`'rangeArea'`) — Area chart showing a range between two values
10
+
11
+ ## Tree-Shakeable Import
12
+
13
+ ```js
14
+ import ApexCharts from 'apexcharts/line'
15
+ // Registers: line, area, scatter, bubble, rangeArea
16
+ // Aliases: apexcharts/area, apexcharts/scatter, apexcharts/bubble, apexcharts/rangeArea
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Data Formats (Detailed)
22
+
23
+ ### Simple Array (categories on x-axis)
24
+
25
+ ```js
26
+ {
27
+ chart: { type: 'line', height: 350 },
28
+ series: [{
29
+ name: 'Sales',
30
+ data: [30, 40, 35, 50, 49, 60, 70]
31
+ }],
32
+ xaxis: {
33
+ categories: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### XY Object Format (numeric or datetime x-axis)
39
+
40
+ ```js
41
+ {
42
+ chart: { type: 'line', height: 350 },
43
+ series: [{
44
+ name: 'Sales',
45
+ data: [
46
+ { x: new Date('2024-01-01').getTime(), y: 30 },
47
+ { x: new Date('2024-02-01').getTime(), y: 40 },
48
+ { x: new Date('2024-03-01').getTime(), y: 35 }
49
+ ]
50
+ }],
51
+ xaxis: { type: 'datetime' }
52
+ // Do NOT use xaxis.categories with {x, y} data — categories are ignored
53
+ }
54
+ ```
55
+
56
+ ### 2D Array Format (alternative to object format)
57
+
58
+ ```js
59
+ series: [{
60
+ name: 'Sales',
61
+ data: [
62
+ [1704067200000, 30], // [timestamp, value]
63
+ [1706745600000, 40],
64
+ [1709251200000, 35]
65
+ ]
66
+ }]
67
+ ```
68
+
69
+ ### Missing Data Points
70
+
71
+ Use `null` to create gaps in the line:
72
+ ```js
73
+ series: [{ data: [10, 25, null, null, 50, 60] }]
74
+ ```
75
+
76
+ ### Scatter Chart
77
+
78
+ Always use XY format:
79
+ ```js
80
+ {
81
+ chart: { type: 'scatter', height: 350 },
82
+ series: [{
83
+ name: 'Sample A',
84
+ data: [
85
+ { x: 16.4, y: 5.4 },
86
+ { x: 21.7, y: 2 },
87
+ { x: 25.4, y: 3 }
88
+ ]
89
+ }],
90
+ xaxis: { type: 'numeric' }
91
+ }
92
+ ```
93
+
94
+ ### Bubble Chart (z is required)
95
+
96
+ ```js
97
+ {
98
+ chart: { type: 'bubble', height: 350 },
99
+ series: [{
100
+ name: 'Product A',
101
+ data: [
102
+ { x: 2020, y: 30, z: 10 }, // z = bubble size
103
+ { x: 2021, y: 40, z: 25 },
104
+ { x: 2022, y: 35, z: 15 }
105
+ ]
106
+ }],
107
+ xaxis: { type: 'numeric' }
108
+ }
109
+ ```
110
+
111
+ ### Range Area
112
+
113
+ ```js
114
+ {
115
+ chart: { type: 'rangeArea', height: 350 },
116
+ series: [{
117
+ name: 'Temperature Range',
118
+ data: [
119
+ { x: 'Jan', y: [-2, 10] }, // [low, high]
120
+ { x: 'Feb', y: [0, 12] },
121
+ { x: 'Mar', y: [3, 16] }
122
+ ]
123
+ }]
124
+ }
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Key Options
130
+
131
+ ### Stroke / Curve Types
132
+
133
+ ```js
134
+ stroke: {
135
+ curve: 'smooth', // 'smooth' | 'straight' | 'stepline' | 'linestep' | 'monotoneCubic'
136
+ width: 2, // line thickness (number or array per series)
137
+ dashArray: 0 // 0 = solid, number = dashed (or array per series)
138
+ }
139
+ ```
140
+
141
+ ### Markers
142
+
143
+ ```js
144
+ markers: {
145
+ size: 5, // 0 = hidden (default for line/area)
146
+ shape: 'circle', // 'circle' | 'square' | 'diamond' | etc.
147
+ hover: { sizeOffset: 3 }
148
+ }
149
+ ```
150
+
151
+ ### Area Fill
152
+
153
+ ```js
154
+ fill: {
155
+ type: 'gradient',
156
+ gradient: {
157
+ shadeIntensity: 1,
158
+ opacityFrom: 0.7,
159
+ opacityTo: 0.2,
160
+ stops: [0, 90, 100]
161
+ }
162
+ }
163
+ ```
164
+
165
+ ### Datetime X-Axis
166
+
167
+ ```js
168
+ xaxis: {
169
+ type: 'datetime',
170
+ labels: {
171
+ datetimeUTC: false, // false = local time, true = UTC
172
+ datetimeFormatter: {
173
+ year: 'yyyy',
174
+ month: "MMM 'yy",
175
+ day: 'dd MMM',
176
+ hour: 'HH:mm'
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ ### Forecast Data Points
183
+
184
+ ```js
185
+ {
186
+ forecastDataPoints: {
187
+ count: 3, // last N data points shown as forecast
188
+ fillOpacity: 0.5,
189
+ strokeWidth: 1,
190
+ dashArray: 4
191
+ }
192
+ }
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Complete Working Example — Line Chart with Datetime
198
+
199
+ ```html
200
+ <div id="chart"></div>
201
+ <script type="module">
202
+ import ApexCharts from 'apexcharts'
203
+
204
+ const options = {
205
+ chart: {
206
+ type: 'line',
207
+ height: 350,
208
+ zoom: { enabled: true }
209
+ },
210
+ series: [{
211
+ name: 'Page Views',
212
+ data: [
213
+ { x: new Date('2024-01-01').getTime(), y: 4500 },
214
+ { x: new Date('2024-02-01').getTime(), y: 5200 },
215
+ { x: new Date('2024-03-01').getTime(), y: 4800 },
216
+ { x: new Date('2024-04-01').getTime(), y: 6100 },
217
+ { x: new Date('2024-05-01').getTime(), y: 5900 },
218
+ { x: new Date('2024-06-01').getTime(), y: 7200 }
219
+ ]
220
+ }],
221
+ xaxis: { type: 'datetime' },
222
+ yaxis: {
223
+ title: { text: 'Views' },
224
+ labels: { formatter: (val) => val.toFixed(0) }
225
+ },
226
+ stroke: { curve: 'smooth', width: 3 },
227
+ title: { text: 'Monthly Page Views', align: 'left' },
228
+ tooltip: {
229
+ x: { format: 'MMM yyyy' },
230
+ y: { formatter: (val) => `${val.toLocaleString()} views` }
231
+ }
232
+ }
233
+
234
+ const chart = new ApexCharts(document.querySelector('#chart'), options)
235
+ await chart.render()
236
+ </script>
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Family-Specific Pitfalls
242
+
243
+ 1. **Bubble chart without z value** — renders with zero-size bubbles. Always provide `z` in data.
244
+ 2. **Using `xaxis.categories` with `{ x, y }` data** — categories are silently ignored when data contains x values. Choose one approach.
245
+ 3. **Datetime axis with string dates** — pass timestamps (`new Date(...).getTime()`) or `Date` objects, not raw strings like `'January 2024'`.
246
+ 4. **`stroke.curve: 'smooth'` on sparse data** — can produce visual artifacts. Use `'monotoneCubic'` for mathematically smoother interpolation.
247
+ 5. **Range Area with single value instead of array** — `y` must be `[low, high]`, not a single number.