apexcharts-skill 2.2.0 → 3.1.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.
@@ -4,14 +4,18 @@
4
4
 
5
5
  - **Heatmap** (`'heatmap'`) — Color-coded grid cells representing data intensity
6
6
  - **Treemap** (`'treemap'`) — Nested rectangles with area proportional to value
7
+ - **Icicle** (`'icicle'`) *(v7.6)* — A hierarchy as stacked bands, one per depth level
7
8
 
8
9
  ## Tree-Shakeable Import
9
10
 
10
11
  ```js
11
12
  import ApexCharts from 'apexcharts/heatmap' # heatmap only
12
13
  import ApexCharts from 'apexcharts/treemap' # treemap only
14
+ import ApexCharts from 'apexcharts/icicle' # icicle (v7.6): opt-in, see below
13
15
  ```
14
16
 
17
+ `icicle` is **not in the default bundle**. Unlike every other type here, `import ApexCharts from 'apexcharts'` does not carry its class, so `chart.type: 'icicle'` throws until the sub-entry (or `dist/icicle.js` after the ApexCharts script) has registered it. Loading the full bundle is not a workaround, which is what the v7.6.1 error message was corrected to stop suggesting.
18
+
15
19
  ---
16
20
 
17
21
  ## Data Formats
@@ -182,6 +186,33 @@ plotOptions: {
182
186
 
183
187
  The hierarchy resolver is shared with sunburst, including the `drilldown: '<id>'` adapter (opted into via `nested.drilldownAsLevels`).
184
188
 
189
+ ### Icicle (v7.6)
190
+
191
+ Same hierarchy as the sunburst, drawn in cartesian coordinates: one band per depth level, each child sized inside its parent's extent along the value axis. Axis-style `[{ data: [...] }]` wrapper, `{ x, y, children }` nodes to any depth.
192
+
193
+ ```js
194
+ import ApexCharts from 'apexcharts/icicle' // required: not in the default bundle
195
+
196
+ const options = {
197
+ chart: { type: 'icicle' },
198
+ series: [{
199
+ data: [
200
+ { x: 'Mobile', y: 55, children: [
201
+ { x: 'iOS', y: 30, children: [{ x: 'iOS 17', y: 18 }, { x: 'iOS 16', y: 9 }] },
202
+ { x: 'Android', y: 23 }
203
+ ] },
204
+ { x: 'Desktop', y: 33, children: [{ x: 'Windows', y: 20 }, { x: 'macOS', y: 10 }] }
205
+ ]
206
+ }]
207
+ }
208
+ ```
209
+
210
+ - A branch may **omit its own `y`** and be the sum of its children. This is the documented shape for both partition types, and it only started working in v7.6: before that the non-axis parser dropped any node carrying `children` without `x` and `y`, and the chart drew nothing at all while warning about pie data.
211
+ - A node may carry `drilldown: '<id>'` instead of `children`, and the matching `drilldown.series` entry is read as the next level. It is read as plain data, so no drilldown feature import is needed.
212
+ - Sibling order follows the array by default (`sort: 'none'`). Set `plotOptions.icicle.sort` to `'value'` or `'name'` to override it.
213
+
214
+ **Choosing between icicle and sunburst.** Both resolve the same tree. An icicle keeps labels horizontal at every depth and puts depth on a straight axis, so same-depth siblings line up across branches and deep trees stay readable; a sunburst spends its area radially and reads better for shallow, wide trees. `direction: 'up'` is the flame-graph orientation, for call stacks and path funnels.
215
+
185
216
  ---
186
217
 
187
218
  ## Key plotOptions
@@ -191,7 +222,8 @@ The hierarchy resolver is shared with sunburst, including the `drilldown: '<id>'
191
222
  ```js
192
223
  plotOptions: {
193
224
  heatmap: {
194
- radius: 0, // border radius of cells
225
+ shape: 'rect', // 'rect' (default) | 'hexagon' | 'circle' | 'diamond' (v7.2)
226
+ radius: 0, // border radius of cells ('rect' only)
195
227
  enableShades: true, // shade intensity based on value
196
228
  shadeIntensity: 0.5, // shade range (0-1)
197
229
  distributed: false, // different color per series
@@ -212,6 +244,21 @@ plotOptions: {
212
244
  }
213
245
  ```
214
246
 
247
+ #### Cell shapes (v7.2)
248
+
249
+ `shape` changes what a cell is drawn as, without changing the data format or anything else about the chart:
250
+
251
+ - `'circle'` and `'diamond'` are inscribed in the cell box the heatmap already lays out.
252
+ - `'hexagon'` is a real honeycomb tilemap: pointy-top hexagons, alternate rows offset half a cell so neighbours share a full edge, with the lattice's overhang reserved as extra grid padding so offset rows never cover the axis labels.
253
+
254
+ Three constraints worth knowing before choosing one:
255
+
256
+ - **`radius` applies to `'rect'` only.** Corner rounding is ignored by the other three.
257
+ - **`'hexagon'` is categorical-layout only.** On a numeric or datetime x axis it falls back to `'rect'` silently.
258
+ - **Non-rect shapes always render as SVG.** The canvas renderer declines them the same way it declines image fills, so a large heatmap that needs `renderer: 'canvas'` for its cell count has to stay on `'rect'`.
259
+
260
+ Shaped cells keep the `apexcharts-heatmap-rect` class and the same attribute contract, so tooltips, keyboard navigation, legend range highlighting and the color tween on a data update all behave unchanged.
261
+
215
262
  ### Treemap
216
263
 
217
264
  ```js
@@ -233,6 +280,46 @@ plotOptions: {
233
280
  }
234
281
  ```
235
282
 
283
+ ### Icicle (v7.6)
284
+
285
+ ```js
286
+ plotOptions: {
287
+ icicle: {
288
+ direction: 'down', // 'down' (root on top, default) | 'up' (flame graph) | 'right' | 'left'
289
+ levelSize: 'equal', // 'equal' | px number | '%' string: thickness of one depth band
290
+ maxDepth: 'auto', // 'auto' (whole tree) | number of levels from the focused one
291
+ spacing: 1, // gap between adjacent cells (px)
292
+ borderRadius: 0, // corner rounding (px)
293
+ leaf: 'stop', // 'stop' (default): a shallow branch ends at its own band
294
+ // 'extend': it stretches to the far edge
295
+ partition: 'normalize', // 'normalize' | 'strict'
296
+ sort: 'none', // 'none' | 'value' | 'name'
297
+ tint: 0, // per-depth lightening of the parent colour (0 = same, 1 = white)
298
+ zoomOnClick: true, // click a cell to zoom into its branch (breadcrumb to go back)
299
+ zoomType: 'value', // 'value' (default) | 'both'
300
+ dataLabels: {
301
+ show: true,
302
+ minSizeToShow: 30, // hide the label on cells shorter than this (px)
303
+ align: 'center', // 'left' | 'center' | 'right'; a flame graph wants 'left'
304
+ rotate: 'auto', // 'auto' | 'always' | 'never'
305
+ showValue: false,
306
+ style: { fontSize: '12px', fontFamily: undefined, fontWeight: 400, colors: undefined }
307
+ }
308
+ }
309
+ }
310
+ ```
311
+
312
+ Four defaults differ from the sunburst's, each for a reason worth knowing before overriding it:
313
+
314
+ - **`leaf: 'stop'`** leaves the white space that shows how deep each branch goes. `'extend'` fills the plot, which is what a treemap does and makes an icicle stop reading as a hierarchy.
315
+ - **`tint: 0`** keeps one hue per branch, so the eye can follow a branch down the levels.
316
+ - **The palette lands on the shallowest level that branches.** A single-root tree is the normal shape here, and colouring by root would paint everything one hue.
317
+ - **The legend is off**, since every cell carries its own label.
318
+
319
+ **`zoomType` is the one to understand.** `'value'` (the default) rescales the value axis only: the clicked branch stretches to fill the width, its subtree stretches with it, and no level moves. The ancestors stay above it, clamped to the plot, which is what makes them read as context. `'both'` also re-bands the depth axis, promoting the branch to the top level, which spends the whole plot on it at the cost of the reader's place in the tree. The values are not called `'x'` and `'y'` because `direction` decides which screen axis the value axis is.
320
+
321
+ A click that would not change the view is refused rather than performed: clicking a lone root, or a leaf inside the focused branch, leaves the chart alone, and the cursor reads `pointer` only on cells where a zoom would actually move something.
322
+
236
323
  ---
237
324
 
238
325
  ## Complete Working Example — Heatmap
@@ -289,3 +376,6 @@ plotOptions: {
289
376
  3. **Treemap with negative values** — treemap `y` values must be positive (they represent area). Negative values cause rendering issues.
290
377
  4. **Confusing heatmap `y` with position** — in heatmap data `{ x, y }`, the `y` is the VALUE (color intensity), NOT the y-axis position. The series `name` determines the row.
291
378
  5. **Nested treemap branch carrying its own `y` (v6.9)**: a branch node normally omits `y`; its area is the sum of its children. Only leaves supply values. Flattening a hierarchy by hand is no longer necessary; pass `children` instead.
379
+ 6. **`chart.type: 'icicle'` on the default bundle (v7.6)** — icicle is opt-in and the default build carries no class for it, so this throws. Add `import ApexCharts from 'apexcharts/icicle'` (or load `dist/icicle.js` after the ApexCharts script). Loading the full `apexcharts.js` does **not** help: it does not carry the class either.
380
+ 7. **Reaching for `zoomType: 'both'` to make a branch fill the plot** — `'value'` already stretches the branch across the full width; what `'both'` additionally does is move every level, which costs the reader their place in the tree. Change it only when the ancestors genuinely do not matter.
381
+ 8. **Expecting `sort: 'value'` on a flame graph** — `'name'` is the flame-graph convention, because it holds a frame in the same place across profiles so two runs of one program can be compared by eye.
package/references/ssr.md CHANGED
@@ -52,7 +52,7 @@ const htmlString = await ApexCharts.renderToHTML(
52
52
  {
53
53
  chart: {
54
54
  type: 'bar',
55
- id: 'my-chart' // id is important for hydration targeting
55
+ id: 'my-chart' // for chart.exec() targeting; NOT what hydration looks for
56
56
  },
57
57
  series: [{ data: [44, 55, 41, 67] }],
58
58
  xaxis: { categories: ['A', 'B', 'C', 'D'] }
@@ -60,7 +60,12 @@ const htmlString = await ApexCharts.renderToHTML(
60
60
  { width: 600, height: 350 }
61
61
  )
62
62
 
63
- // htmlString is <div id="my-chart" data-apexcharts>...<svg>...</svg></div>
63
+ // htmlString is:
64
+ // <div class="apexcharts-ssr-wrapper" data-apexcharts-hydrate data-apexcharts-config="...">
65
+ // <svg>...</svg>
66
+ // </div>
67
+ // The wrapper carries NO id. `chart.id` is not copied onto it, and the config
68
+ // travels in data-apexcharts-config, which is what hydration reads.
64
69
  ```
65
70
 
66
71
  ---
@@ -74,14 +79,17 @@ After the server-rendered HTML is in the DOM, hydrate it to make it interactive:
74
79
  ```js
75
80
  import ApexCharts from 'apexcharts'
76
81
 
77
- // Hydrate a specific chart element (optionally merge client-only options)
78
- const chart = ApexCharts.hydrate(document.querySelector('#my-chart'))
82
+ // Hydrate a specific chart element (optionally merge client-only options).
83
+ // Select the emitted wrapper, not a chart id: `#my-chart` matches nothing.
84
+ const chart = ApexCharts.hydrate(document.querySelector('[data-apexcharts-hydrate]'))
79
85
  ```
80
86
 
81
87
  ### hydrateAll(selector?, clientOptions?)
82
88
 
83
89
  ```js
84
- // Hydrate all server-rendered charts on the page (optionally scope by selector)
90
+ // Hydrate all server-rendered charts on the page (optionally scope by selector).
91
+ // The selector defaults to '[data-apexcharts-hydrate]', which is why this works
92
+ // with no argument and a #id selector does not.
85
93
  ApexCharts.hydrateAll()
86
94
  ```
87
95
 
@@ -210,7 +218,8 @@ onMounted(async () => {
210
218
 
211
219
  ## Common Pitfalls
212
220
 
213
- 1. **Using `apexcharts` in Node.js without SSR methods** — the default export auto-resolves based on environment, but `renderToString` is only available via `apexcharts/ssr`.
214
- 2. **Forgetting to hydrate on the client** — server-rendered charts are static SVGs. Without `hydrate()`, they have no interactivity (no tooltips, zoom, click events).
215
- 3. **Missing width/height**: SSR has no DOM to measure. Pass explicit dimensions in the **second** argument: `renderToString(options, { width, height })` / `renderToHTML(options, { width, height })`.
216
- 4. **Hydrating before DOM is ready** — call `hydrate()` after the server-rendered HTML is in the DOM (use `onMounted`, `useEffect`, or `DOMContentLoaded`).
221
+ 1. **Assuming `apexcharts` has no SSR methods in Node** — it does: the `"."` export's `node` condition resolves to the SSR bundle, so `renderToString` and `renderToHTML` are there. Import `apexcharts/ssr` explicitly anyway, because a bundler told to target Node can still resolve the `browser` condition, and then they really are missing.
222
+ 2. **Hydrating by chart id** — `renderToHTML` emits `<div class="apexcharts-ssr-wrapper" data-apexcharts-hydrate data-apexcharts-config="...">` with no `id`, so `querySelector('#my-chart')` returns null. Use `hydrateAll()`, or select `[data-apexcharts-hydrate]`.
223
+ 3. **Forgetting to hydrate on the client** — server-rendered charts are static SVGs. Without `hydrate()`, they have no interactivity (no tooltips, zoom, click events).
224
+ 4. **Missing width/height**: SSR has no DOM to measure. Pass explicit dimensions in the **second** argument: `renderToString(options, { width, height })` / `renderToHTML(options, { width, height })`.
225
+ 5. **Hydrating before DOM is ready** — call `hydrate()` after the server-rendered HTML is in the DOM (use `onMounted`, `useEffect`, or `DOMContentLoaded`).
@@ -1,14 +1,32 @@
1
- # Tree-Shaking & Bundle Optimization — ApexCharts
1
+ # Bundle Tiers, Tree-Shaking & Optimization: ApexCharts
2
+
3
+ ## ⚠️ What changed in v7.0
4
+
5
+ **In v6, the default bundle contained every feature. In v7 it does not.** Nine features are **Tier 2**: shipped in the package, absent from every bundle, and reachable only through an explicit import. This applies to the default `apexcharts` bundle, not just to tree-shaken builds, and it is the most common v6 → v7 upgrade failure.
6
+
7
+ ```js
8
+ import ApexCharts from 'apexcharts'
9
+ import 'apexcharts/features/trellis' // Tier 2: required even on the default bundle
10
+ ```
11
+
12
+ | | gzip |
13
+ |---|---|
14
+ | 6.10.0 default bundle | 291,654 B |
15
+ | 7.0.0 default bundle | 252,005 B (**-13.6%**) |
16
+ | 7.1.0 default bundle | 264,326 B (three new chart types) |
17
+
18
+ If you use none of the nine, upgrading is `npm install apexcharts@7` and nothing else.
2
19
 
3
20
  ## Overview
4
21
 
5
- ApexCharts supports three import strategies with different bundle sizes:
22
+ ApexCharts supports four import strategies with different bundle sizes:
6
23
 
7
24
  | Strategy | Import | Includes |
8
25
  |---|---|---|
9
- | Full bundle | `import ApexCharts from 'apexcharts'` | All chart types + all features |
10
- | Per-type entry | `import ApexCharts from 'apexcharts/line'` | Specific chart family + core (no optional features) |
26
+ | Default bundle | `import ApexCharts from 'apexcharts'` | Every chart type except `raincloud` and `icicle`, plus the **Tier 1** features. **Not** the nine Tier 2 features. |
27
+ | Per-type entry | `import ApexCharts from 'apexcharts/line'` | Specific chart family + core (no optional features at all) |
11
28
  | Bare core | `import ApexCharts from 'apexcharts/core'` | Core class only — must manually register everything |
29
+ | Lean core, no bundler *(v7.0)* | `<script src=".../dist/apexcharts.core.js">` | Script-tag equivalent of bare core, assembled from separate tags. See below. |
12
30
 
13
31
  ---
14
32
 
@@ -26,9 +44,13 @@ Each entry point registers a family of related chart types:
26
44
  | `apexcharts/bar` | bar, column, rangeBar |
27
45
  | `apexcharts/column` | same as /bar |
28
46
  | `apexcharts/rangeBar` | same as /bar |
47
+ | `apexcharts/waterfall` | waterfall *(new in v7.1)*: the bar engine plus the waterfall feature |
48
+ | `apexcharts/dumbbell` | dumbbell *(new in v7.1)*: the bar engine plus the dumbbell feature |
49
+ | `apexcharts/streamgraph` | streamgraph *(new in v7.1)*: the rangeArea engine plus the streamgraph feature |
29
50
  | `apexcharts/candlestick` | candlestick, boxPlot |
30
51
  | `apexcharts/boxPlot` | same as /candlestick |
31
52
  | `apexcharts/violin` | violin *(new in v6)* |
53
+ | `apexcharts/raincloud` | raincloud *(new in v7.1, premium)*: the violin engine plus the raincloud feature. **Tier 2**: absent from the default bundle (with `icicle`, the two that are). |
32
54
  | `apexcharts/histogram` | histogram *(new in v6.9)*: the bar engine plus the stats feature |
33
55
  | `apexcharts/pie` | pie, donut, polarArea |
34
56
  | `apexcharts/donut` | same as /pie |
@@ -38,10 +60,22 @@ Each entry point registers a family of related chart types:
38
60
  | `apexcharts/heatmap` | heatmap |
39
61
  | `apexcharts/treemap` | treemap |
40
62
  | `apexcharts/sunburst` | sunburst *(new in v6.7, free)* |
63
+ | `apexcharts/icicle` | icicle *(new in v7.6, free)*: the sunburst's partition in cartesian coordinates. **Opt-in**: the default bundle carries no icicle class, only the settings literals and a few string branches, so `chart.type: 'icicle'` throws until this entry, or `dist/icicle.js` after the ApexCharts script, has registered it. Loading the full `apexcharts.js` is **not** a way around that. The entry contains no other chart class. |
41
64
  | `apexcharts/unit` | unit, **waffle** *(new in v6.6, premium: watermarked until licensed)* |
42
65
  | `apexcharts/unit-shapes` | *(new in v6.10)* not a chart entry: named shape exports for the unit chart (`heart`, `house`, ... plus `outlined`, `glyphs`, `preview`), tree-shaken per shape (~4 KB gzipped each). See `references/circular-charts.md`. |
66
+ | `apexcharts/pictograms` | *(new in v7.0)* not a chart entry: a drawn glyph per unit for the unit chart (`person`, `house`, `heart`, `tree`, `droplet`, `star`, `car`, `bag`, `book`, `cup`, `bulb`, `plane`), plus `definePictogram` / `registerMarks` / `catalog`. Import the glyph you use, not `catalog`, which ships all of them. |
67
+
68
+ **First-class aliases:** `funnel` and `pyramid` render through the bar engine, so `apexcharts/bar` covers them. `gauge` renders through radialBar, so `apexcharts/radialBar` covers it. There is no separate `apexcharts/funnel`, `apexcharts/pyramid`, or `apexcharts/gauge` entry.
43
69
 
44
- **v6 first-class aliases:** `funnel` and `pyramid` render through the bar engine, so `apexcharts/bar` covers them. `gauge` renders through radialBar, so `apexcharts/radialBar` covers it. There is no separate `apexcharts/funnel`, `apexcharts/pyramid`, or `apexcharts/gauge` entry. `histogram` also renders through the bar engine but has its own `apexcharts/histogram` entry because it bundles the stats feature; `apexcharts/bar` + `import 'apexcharts/features/stats'` is equivalent.
70
+ **Entries that bundle a feature.** Four types render through an existing engine but have their own entry because that entry also pulls in a feature module. Each is equivalent to the engine entry plus the feature:
71
+
72
+ | Entry | Equivalent to |
73
+ |---|---|
74
+ | `apexcharts/histogram` | `apexcharts/bar` + `import 'apexcharts/features/stats'` |
75
+ | `apexcharts/waterfall` | `apexcharts/bar` + `import 'apexcharts/features/waterfall'` |
76
+ | `apexcharts/dumbbell` | `apexcharts/bar` + `import 'apexcharts/features/dumbbell'` |
77
+ | `apexcharts/streamgraph` | `apexcharts/rangeArea` + `import 'apexcharts/features/streamgraph'` |
78
+ | `apexcharts/raincloud` | `apexcharts/violin` + `import 'apexcharts/features/raincloud'` |
45
79
 
46
80
  ### Using Multiple Chart Types
47
81
 
@@ -53,9 +87,16 @@ import 'apexcharts/bar' // side-effect: registers bar types onto the same clas
53
87
 
54
88
  ---
55
89
 
56
- ## Optional Features
90
+ ## Optional Features: Tier 1 vs Tier 2
91
+
92
+ Two questions decide whether you need a `features/*` import:
93
+
94
+ 1. **Which entry point did you start from?** `apexcharts/core` and the per-type entries carry no optional features at all, so every feature you want needs its import.
95
+ 2. **Which tier is the feature?** Tier 1 is in the default `apexcharts` bundle. **Tier 2 is in no bundle**, so it needs its import even there.
96
+
97
+ ### Tier 1: in the default `apexcharts` bundle
57
98
 
58
- Features are optional modules that add functionality. When using per-type entries or core, features must be explicitly imported.
99
+ Import these only when you started from `/core` or a per-type entry.
59
100
 
60
101
  | Feature | Import | What It Adds |
61
102
  |---|---|---|
@@ -65,33 +106,80 @@ Features are optional modules that add functionality. When using per-type entrie
65
106
  | Exports | `import 'apexcharts/features/exports'` | `dataURI()`, `getSvgString()`, `exportToCSV()` |
66
107
  | Keyboard | `import 'apexcharts/features/keyboard'` | Keyboard navigation (accessibility) |
67
108
  | Stats *(v6.9)* | `import 'apexcharts/features/stats'` | Histogram binning, boxPlot/violin raw-sample summaries, `rowSeries()` |
68
- | Morph *(v6)* | `import 'apexcharts/features/morph'` | Animated chart-type morphs |
69
- | Drilldown *(v6)* | `import 'apexcharts/features/drilldown'` | Hierarchical drill-down |
70
- | History / Rewind *(v6)* | `import 'apexcharts/features/history'` | Undo/redo (`chart.history`) |
71
- | Perspectives *(v6)* | `import 'apexcharts/features/perspectives'` | Shareable view state |
72
- | Storyboard *(v6)* | `import 'apexcharts/features/storyboard'` | Scrollytelling (includes perspectives) |
73
- | Facet *(v6)* | `import 'apexcharts/features/facet'` | Design tokens + OS-aware themes |
74
- | Weave *(v6)* | `import 'apexcharts/features/weave'` | Public plugin platform |
75
- | Renderer / Strata *(v6)* | `import 'apexcharts/features/renderer-canvas'` | Hybrid SVG + canvas renderer |
76
- | Marks *(v6)* | `import 'apexcharts/features/marks'` | Custom series types (`registerSeriesType`) |
77
- | Link *(v6)* | `import 'apexcharts/features/link'` | Crossfilter / linked views |
78
- | Ink *(v6)* | `import 'apexcharts/features/ink'` | On-chart annotation authoring |
79
- | Measure *(v6)* | `import 'apexcharts/features/measure'` | Measure / delta ruler |
80
- | Context menu *(v6)* | `import 'apexcharts/features/context-menu'` | Right-click / long-press context menu |
81
- | All | `import 'apexcharts/features/all'` | All of the above |
82
-
83
- **Important:** Tooltip is always included in core (it cannot be tree-shaken). Easing (Cadence) and real-time streaming are also core, so they need no feature import. See `v6-features.md` for the config and API of each v6 feature.
109
+ | Morph | `import 'apexcharts/features/morph'` | Animated chart-type morphs |
110
+ | Drilldown | `import 'apexcharts/features/drilldown'` | Hierarchical drill-down |
111
+ | Facet | `import 'apexcharts/features/facet'` | Design tokens + OS-aware themes |
112
+ | Weave | `import 'apexcharts/features/weave'` | Public plugin platform |
113
+ | Marks | `import 'apexcharts/features/marks'` | Custom series types (`registerSeriesType`) |
114
+ | Waterfall *(v7.1)* | `import 'apexcharts/features/waterfall'` | The `waterfall` chart type |
115
+ | Dumbbell *(v7.1)* | `import 'apexcharts/features/dumbbell'` | The `dumbbell` chart type |
116
+ | Streamgraph *(v7.1)* | `import 'apexcharts/features/streamgraph'` | The `streamgraph` chart type |
117
+ | All Tier 1 | `import 'apexcharts/features/all'` | Every row above, and **only** those |
118
+
119
+ Tier 1 is a **budget, not an index**: upstream, a module earns a place only if it is under ~5 KB gzipped on top of core, needs no peer dependency or separate asset, and is useful to a majority of charts. The first seven predate the budget and are grandfathered.
120
+
121
+ ### Tier 2: in NO bundle; always an explicit import
122
+
123
+ Required whatever entry point you used, the default `apexcharts` bundle included.
124
+
125
+ | Feature | Import | gzip | Premium | What It Adds |
126
+ |---|---|---|---|---|
127
+ | Trellis *(v7.0)* | `import 'apexcharts/features/trellis'` | 25.7 KB | yes | Small multiples: a grid of real charts sharing scale, legend, toolbar, crosshair |
128
+ | Storyboard | `import 'apexcharts/features/storyboard'` | 8.0 KB | yes | Scrollytelling (registers Perspectives too) |
129
+ | Perspectives | `import 'apexcharts/features/perspectives'` | 6.7 KB | yes | Shareable view state |
130
+ | Ink | `import 'apexcharts/features/ink'` | 6.2 KB | yes | On-chart annotation authoring |
131
+ | Renderer / Strata | `import 'apexcharts/features/renderer-canvas'` | 6.0 KB | no | Hybrid SVG + canvas renderer |
132
+ | Link | `import 'apexcharts/features/link'` | 5.3 KB | yes | Crossfilter / linked views |
133
+ | Measure | `import 'apexcharts/features/measure'` | 4.6 KB | yes | Measure / delta ruler |
134
+ | History / Rewind | `import 'apexcharts/features/history'` | 3.2 KB | yes | Undo/redo (`chart.history`) |
135
+ | Context menu | `import 'apexcharts/features/context-menu'` | 2.3 KB | yes | Right-click / long-press context menu |
136
+ | Raincloud *(v7.1)* | `import 'apexcharts/features/raincloud'` | n/a | yes | The `raincloud` chart type (or use the `apexcharts/raincloud` entry) |
137
+
138
+ Storyboard registers Perspectives, so importing both costs no more than Storyboard alone.
139
+
140
+ **`apexcharts/features/all` does not include Tier 2**, by design: upstream has a tier-budget test that fails the build if a Tier 2 feature reappears in it.
141
+
142
+ **Nothing fails silently on Tier 2.** Each module warns in the console when its configuration is present but the module is not, and the warning names both the ESM and script-tag route. Where the chart can still draw something sensible it does and says what it did instead: a trellis renders as a single chart, `renderer: 'canvas'` falls back to SVG.
143
+
144
+ ---
145
+
146
+ ## Script tags: the lean core channel (v7.0)
147
+
148
+ Tree-shaking only ever helped people with a build step. A page using a `<script>` tag had one artifact and no way to decline any of it. `dist/apexcharts.core.js` is the chart class with no chart types and no optional features, assembled from separate tags:
149
+
150
+ ```html
151
+ <script src=".../dist/apexcharts.core.js"></script>
152
+ <script src=".../dist/line.js"></script>
153
+ <script src=".../dist/features/legend.js"></script>
154
+ ```
155
+
156
+ **About 144 KB gzipped**, against about 270 KB for the full bundle (`dist/apexcharts.core.min.js` and `dist/apexcharts.min.js` at 7.6.1, gzip -9). Treat both as approximate: the upstream build report gzips at a different level and prints figures a few hundred bytes apart from these, and the numbers move every release. Purely additive: `apexcharts.js` is unchanged, and a page that wants everything should keep loading it rather than assembling it from parts.
157
+
158
+ The two opt-in chart types are not in that table, because neither is a `features/*` module: `raincloud` is reached through `apexcharts/raincloud` and `icicle` through `apexcharts/icicle` (see the entry table above).
159
+
160
+ Every Tier 2 feature has a `dist/features/<name>.js` artifact for this channel too, and a full-bundle page still needs it:
161
+
162
+ ```html
163
+ <script src=".../dist/apexcharts.js"></script>
164
+ <script src=".../dist/features/trellis.js"></script>
165
+ ```
166
+
167
+ **Important:** Tooltip is always included in core (it cannot be tree-shaken). Easing (Cadence) and real-time streaming are also core, so they need no feature import. See `feature-platform.md` for the config and API of each feature.
84
168
 
85
169
  **Runtime dependency (v6.9):** ApexCharts is no longer dependency-free: it depends on `apex-commons` at runtime (license manager, crossfilter engine, spring primitives shared across the ApexCharts family). npm resolves it automatically, and the browser (script-tag) bundles inline it, so no configuration is needed; bundlers just see one more resolvable package. The `apexcharts/unit` and `apexcharts/unit-shapes` sub-entry points resolve for bundlers and script tags alike (from a script tag, `dist/unit-shapes.js` exposes the global `ApexUnitShapes`).
86
170
 
87
171
  ### What Happens If You Forget a Feature
88
172
 
89
- Features fail **silently**. If you use a per-type entry without importing legend:
173
+ It depends on the tier.
174
+
175
+ **Tier 1 features fail silently.** If you use a per-type entry without importing legend:
90
176
  - No legend appears, no error thrown
91
177
  - `chart.toolbar` is undefined, toolbar doesn't render
92
178
  - `addXaxisAnnotation()` does nothing
93
179
  - `dataURI()` / `exportToCSV()` throw because the feature isn't registered
94
180
 
181
+ **Tier 2 features announce themselves.** Each warns in the console when its configuration is present but the module is not, naming both the ESM and the script-tag route, and degrades predictably where it can: a `trellis` config renders as one ordinary chart, `renderer: 'canvas'` falls back to SVG. If a v7 chart is quietly missing a feature you configured, **check the console before the config**.
182
+
95
183
  ---
96
184
 
97
185
  ## Bare Core Usage
@@ -171,7 +259,10 @@ export default {
171
259
 
172
260
  ## Common Pitfalls
173
261
 
174
- 1. **Missing feature imports** — features fail silently. If legend/toolbar/annotations don't appear, check imports.
175
- 2. **Importing `apexcharts` AND `apexcharts/line`** — creates duplicate bundles. Use one strategy.
176
- 3. **Vite duplicate bundle issue** — without `optimizeDeps.include`, Vite may bundle ApexCharts twice.
177
- 4. **Calling `dataURI()` without exports feature** — throws an error. Import `apexcharts/features/exports` first.
262
+ 1. **Assuming the default bundle still has everything *(v7)***: the nine Tier 2 features and the `raincloud` and `icicle` types need their own import on top of `import ApexCharts from 'apexcharts'`. This is the most common v6 → v7 upgrade failure.
263
+ 2. **Reaching for `apexcharts/features/all` to fix it**: that is the Tier 1 set by design and pulls in no Tier 2 module.
264
+ 3. **Missing feature imports on a tree-shaken build**: Tier 1 features fail silently. If legend/toolbar/annotations don't appear, check imports.
265
+ 4. **Importing `apexcharts` AND `apexcharts/line`**: creates duplicate bundles. Use one strategy. *(v7.0 fixed the related internal bug where the default bundle inlined its own core copy while add-ons resolved `apexcharts/core`, so an app importing both got two classes, ~130 KB gzipped of duplicate core, and a feature that never registered. They now share one core.)*
266
+ 5. **Vite duplicate bundle issue**: without `optimizeDeps.include`, Vite may bundle ApexCharts twice.
267
+ 6. **Calling `dataURI()` without exports feature**: throws an error. Import `apexcharts/features/exports` first.
268
+ 7. **`require('apexcharts/line')` used to throw** `h.use is not a function` in every published version with sub-path entries, because rollup's default CJS interop assumes `require()` returns the export itself. Fixed in **7.0.0**; below that, use ESM `import` for sub-path entries.