apexcharts 8.3.0 → 8.4.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.
Files changed (277) hide show
  1. package/README.md +7 -7
  2. package/dist/apexcharts.common.js +2 -2
  3. package/dist/apexcharts.core.js +20039 -19931
  4. package/dist/apexcharts.core.min.js +2 -2
  5. package/dist/apexcharts.css +3 -8
  6. package/dist/apexcharts.esm.js +950 -574
  7. package/dist/apexcharts.full.js +23401 -22504
  8. package/dist/apexcharts.full.min.js +2 -2
  9. package/dist/apexcharts.js +21723 -21287
  10. package/dist/apexcharts.min.js +2 -2
  11. package/dist/apexcharts.ssr.common.js +2 -2
  12. package/dist/apexcharts.ssr.esm.js +21758 -21242
  13. package/dist/area.common.js +2 -2
  14. package/dist/area.esm.js +118 -65
  15. package/dist/bar.common.js +2 -2
  16. package/dist/bar.esm.js +404 -218
  17. package/dist/bar.js +2 -2
  18. package/dist/boxPlot.common.js +2 -2
  19. package/dist/boxPlot.esm.js +379 -205
  20. package/dist/bubble.common.js +2 -2
  21. package/dist/bubble.esm.js +118 -65
  22. package/dist/candlestick.common.js +2 -2
  23. package/dist/candlestick.esm.js +379 -205
  24. package/dist/candlestick.js +2 -2
  25. package/dist/column.common.js +2 -2
  26. package/dist/column.esm.js +404 -218
  27. package/dist/core.common.js +2 -2
  28. package/dist/core.esm.js +20034 -19926
  29. package/dist/donut.common.js +2 -2
  30. package/dist/donut.esm.js +106 -11
  31. package/dist/dumbbell.common.js +2 -2
  32. package/dist/dumbbell.esm.js +404 -218
  33. package/dist/features/all.common.js +2 -2
  34. package/dist/features/all.esm.js +282 -184
  35. package/dist/features/annotations.common.js +2 -2
  36. package/dist/features/annotations.esm.js +65 -48
  37. package/dist/features/annotations.js +2 -2
  38. package/dist/features/context-menu.common.js +1 -1
  39. package/dist/features/context-menu.esm.js +1 -1
  40. package/dist/features/context-menu.js +1 -1
  41. package/dist/features/drilldown.common.js +2 -2
  42. package/dist/features/drilldown.esm.js +137 -124
  43. package/dist/features/drilldown.js +2 -2
  44. package/dist/features/dumbbell.common.js +1 -1
  45. package/dist/features/dumbbell.esm.js +1 -1
  46. package/dist/features/dumbbell.js +1 -1
  47. package/dist/features/exports.common.js +2 -2
  48. package/dist/features/exports.esm.js +31 -15
  49. package/dist/features/exports.js +2 -2
  50. package/dist/features/facet.common.js +1 -1
  51. package/dist/features/facet.esm.js +1 -1
  52. package/dist/features/facet.js +1 -1
  53. package/dist/features/highlight-filter.common.js +2 -2
  54. package/dist/features/highlight-filter.esm.js +206 -119
  55. package/dist/features/highlight-filter.js +2 -2
  56. package/dist/features/history.common.js +1 -1
  57. package/dist/features/history.esm.js +1 -1
  58. package/dist/features/history.js +1 -1
  59. package/dist/features/ink.common.js +1 -1
  60. package/dist/features/ink.esm.js +1 -1
  61. package/dist/features/ink.js +1 -1
  62. package/dist/features/keyboard.common.js +1 -1
  63. package/dist/features/keyboard.esm.js +1 -1
  64. package/dist/features/keyboard.js +1 -1
  65. package/dist/features/legend.common.js +2 -2
  66. package/dist/features/legend.esm.js +52 -28
  67. package/dist/features/legend.js +2 -2
  68. package/dist/features/link.common.js +1 -1
  69. package/dist/features/link.esm.js +1 -1
  70. package/dist/features/link.js +1 -1
  71. package/dist/features/marks.common.js +1 -1
  72. package/dist/features/marks.esm.js +1 -1
  73. package/dist/features/marks.js +1 -1
  74. package/dist/features/measure.common.js +1 -1
  75. package/dist/features/measure.esm.js +1 -1
  76. package/dist/features/measure.js +1 -1
  77. package/dist/features/morph.common.js +2 -2
  78. package/dist/features/morph.esm.js +27 -14
  79. package/dist/features/morph.js +2 -2
  80. package/dist/features/perspectives.common.js +2 -2
  81. package/dist/features/perspectives.esm.js +4 -1
  82. package/dist/features/perspectives.js +2 -2
  83. package/dist/features/raincloud.common.js +2 -2
  84. package/dist/features/raincloud.esm.js +26 -27
  85. package/dist/features/raincloud.js +2 -2
  86. package/dist/features/renderer-canvas.common.js +2 -2
  87. package/dist/features/renderer-canvas.esm.js +35 -21
  88. package/dist/features/renderer-canvas.js +2 -2
  89. package/dist/features/stats.common.js +2 -2
  90. package/dist/features/stats.esm.js +52 -59
  91. package/dist/features/stats.js +2 -2
  92. package/dist/features/storyboard.common.js +2 -2
  93. package/dist/features/storyboard.esm.js +4 -1
  94. package/dist/features/storyboard.js +2 -2
  95. package/dist/features/streamgraph.common.js +2 -2
  96. package/dist/features/streamgraph.esm.js +160 -55
  97. package/dist/features/streamgraph.js +2 -2
  98. package/dist/features/toolbar.common.js +2 -2
  99. package/dist/features/toolbar.esm.js +78 -28
  100. package/dist/features/toolbar.js +2 -2
  101. package/dist/features/trellis.common.js +2 -2
  102. package/dist/features/trellis.esm.js +876 -543
  103. package/dist/features/trellis.js +2 -2
  104. package/dist/features/waterfall.common.js +2 -2
  105. package/dist/features/waterfall.esm.js +14 -25
  106. package/dist/features/waterfall.js +2 -2
  107. package/dist/features/weave.common.js +2 -2
  108. package/dist/features/weave.esm.js +13 -12
  109. package/dist/features/weave.js +2 -2
  110. package/dist/full.common.js +2 -2
  111. package/dist/full.esm.js +1893 -1342
  112. package/dist/heatmap.common.js +2 -2
  113. package/dist/heatmap.esm.js +38 -54
  114. package/dist/heatmap.js +2 -2
  115. package/dist/histogram.common.js +2 -2
  116. package/dist/histogram.esm.js +455 -276
  117. package/dist/icicle.common.js +2 -2
  118. package/dist/icicle.esm.js +156 -91
  119. package/dist/icicle.js +2 -2
  120. package/dist/line.common.js +2 -2
  121. package/dist/line.esm.js +118 -65
  122. package/dist/line.js +2 -2
  123. package/dist/pictograms.common.js +2 -2
  124. package/dist/pictograms.esm.js +2 -2
  125. package/dist/pictograms.js +2 -2
  126. package/dist/pie.common.js +2 -2
  127. package/dist/pie.esm.js +106 -11
  128. package/dist/pie.js +2 -2
  129. package/dist/polarArea.common.js +2 -2
  130. package/dist/polarArea.esm.js +106 -11
  131. package/dist/radar.common.js +2 -2
  132. package/dist/radar.esm.js +23 -9
  133. package/dist/radar.js +2 -2
  134. package/dist/radialBar.common.js +2 -2
  135. package/dist/radialBar.esm.js +108 -14
  136. package/dist/radialBar.js +2 -2
  137. package/dist/raincloud.common.js +2 -2
  138. package/dist/raincloud.esm.js +39 -31
  139. package/dist/rangeArea.common.js +2 -2
  140. package/dist/rangeArea.esm.js +118 -65
  141. package/dist/rangeBar.common.js +2 -2
  142. package/dist/rangeBar.esm.js +404 -218
  143. package/dist/scatter.common.js +2 -2
  144. package/dist/scatter.esm.js +118 -65
  145. package/dist/streamgraph.common.js +2 -2
  146. package/dist/streamgraph.esm.js +276 -118
  147. package/dist/sunburst.common.js +2 -2
  148. package/dist/sunburst.esm.js +333 -116
  149. package/dist/sunburst.js +2 -2
  150. package/dist/treemap.common.js +2 -2
  151. package/dist/treemap.esm.js +155 -124
  152. package/dist/treemap.js +2 -2
  153. package/dist/unit-shapes.common.js +2 -2
  154. package/dist/unit-shapes.esm.js +2 -2
  155. package/dist/unit-shapes.js +2 -2
  156. package/dist/unit.common.js +2 -2
  157. package/dist/unit.esm.js +29 -27
  158. package/dist/unit.js +2 -2
  159. package/dist/violin.common.js +2 -2
  160. package/dist/violin.esm.js +14 -5
  161. package/dist/violin.js +2 -2
  162. package/dist/waterfall.common.js +2 -2
  163. package/dist/waterfall.esm.js +417 -242
  164. package/package.json +1 -1
  165. package/src/apexcharts.js +37 -60
  166. package/src/assets/apexcharts.css +3 -8
  167. package/src/charts/Bar.js +30 -12
  168. package/src/charts/BarStacked.js +10 -4
  169. package/src/charts/BoxCandleStick.js +8 -2
  170. package/src/charts/Icicle.js +60 -76
  171. package/src/charts/Line.js +58 -22
  172. package/src/charts/Pie.js +136 -14
  173. package/src/charts/Radar.js +6 -9
  174. package/src/charts/Radial.js +2 -6
  175. package/src/charts/RangeBar.js +13 -13
  176. package/src/charts/Scatter.js +5 -7
  177. package/src/charts/Sunburst.js +157 -135
  178. package/src/charts/Treemap.js +100 -56
  179. package/src/charts/common/Breadcrumb.js +37 -16
  180. package/src/charts/common/PreviousPaths.js +45 -0
  181. package/src/charts/common/Stats.js +30 -23
  182. package/src/charts/common/bar/DataLabels.js +85 -77
  183. package/src/charts/common/bar/Helpers.js +144 -56
  184. package/src/charts/common/line/Helpers.js +8 -11
  185. package/src/charts/common/partition/NodeTooltip.js +62 -22
  186. package/src/charts/common/partition/Partition.js +64 -19
  187. package/src/charts/common/partition/Tint.js +6 -3
  188. package/src/charts/common/partition/Transitions.js +108 -0
  189. package/src/charts/common/treemap/ColorScale.js +30 -14
  190. package/src/charts/common/treemap/Helpers.js +47 -68
  191. package/src/charts/common/treemap/Nested.js +2 -3
  192. package/src/features/raincloud.js +16 -10
  193. package/src/features/stats.js +67 -62
  194. package/src/modules/Animations.js +102 -95
  195. package/src/modules/AxisMapping.js +47 -12
  196. package/src/modules/Base.js +12 -14
  197. package/src/modules/CoreUtils.js +26 -46
  198. package/src/modules/Data.js +82 -55
  199. package/src/modules/DataLabels.js +14 -13
  200. package/src/modules/Exports.js +44 -19
  201. package/src/modules/Fill.js +17 -8
  202. package/src/modules/Filters.js +50 -50
  203. package/src/modules/Graphics.js +65 -84
  204. package/src/modules/Markers.js +57 -58
  205. package/src/modules/MorphPieces.js +16 -10
  206. package/src/modules/MorphTypeChange.js +21 -9
  207. package/src/modules/Range.js +32 -55
  208. package/src/modules/RendererController.js +4 -4
  209. package/src/modules/Responsive.js +5 -1
  210. package/src/modules/Scales.js +24 -15
  211. package/src/modules/Series.js +85 -73
  212. package/src/modules/Toolbar.js +3 -2
  213. package/src/modules/UnitLayoutRegistry.js +8 -5
  214. package/src/modules/UnitMarkRegistry.js +7 -10
  215. package/src/modules/ZoomPanSelection.js +4 -0
  216. package/src/modules/animations/AxisTransition.js +11 -4
  217. package/src/modules/animations/DataLabelTransition.js +30 -15
  218. package/src/modules/animations/Easing.js +2 -1
  219. package/src/modules/animations/LayoutTransition.js +43 -32
  220. package/src/modules/animations/LengthTransition.js +176 -84
  221. package/src/modules/annotations/Helpers.js +68 -52
  222. package/src/modules/axes/AxesUtils.js +14 -12
  223. package/src/modules/axes/Grid.js +21 -7
  224. package/src/modules/axes/XAxis.js +4 -4
  225. package/src/modules/axes/YAxis.js +12 -13
  226. package/src/modules/dimensions/Dimensions.js +9 -3
  227. package/src/modules/dimensions/Grid.js +2 -2
  228. package/src/modules/dimensions/XAxis.js +2 -5
  229. package/src/modules/drilldown/Breadcrumb.js +11 -53
  230. package/src/modules/drilldown/Drilldown.js +151 -95
  231. package/src/modules/helpers/InitCtxVariables.js +2 -1
  232. package/src/modules/helpers/UpdateHelpers.js +165 -15
  233. package/src/modules/helpers/XKey.js +56 -0
  234. package/src/modules/highlightFilter/HighlightFilter.js +98 -49
  235. package/src/modules/highlightFilter/PiePart.js +6 -3
  236. package/src/modules/highlightFilter/RadialPart.js +41 -7
  237. package/src/modules/highlightFilter/TreemapPart.js +71 -44
  238. package/src/modules/highlightFilter/util.js +23 -7
  239. package/src/modules/legend/Helpers.js +6 -1
  240. package/src/modules/legend/Legend.js +39 -13
  241. package/src/modules/license/LicenseEnforcer.js +5 -0
  242. package/src/modules/settings/Defaults.js +62 -106
  243. package/src/modules/settings/Globals.js +5 -0
  244. package/src/modules/settings/Options.js +0 -7
  245. package/src/modules/settings/TypeAliases.js +33 -16
  246. package/src/modules/streamgraph/StreamData.js +81 -35
  247. package/src/modules/streamgraph/StreamLabels.js +44 -17
  248. package/src/modules/tooltip/Labels.js +80 -80
  249. package/src/modules/tooltip/Marker.js +25 -21
  250. package/src/modules/tooltip/Position.js +88 -51
  251. package/src/modules/tooltip/Tooltip.js +229 -253
  252. package/src/modules/tooltip/Utils.js +64 -131
  253. package/src/modules/tooltip/constants.js +5 -5
  254. package/src/modules/trellis/Trellis.js +402 -248
  255. package/src/modules/trellis/TrellisChrome.js +110 -44
  256. package/src/modules/trellis/TrellisExports.js +48 -13
  257. package/src/modules/trellis/TrellisFrames.js +11 -15
  258. package/src/modules/trellis/TrellisScales.js +201 -115
  259. package/src/modules/trellis/TrellisSplit.js +72 -36
  260. package/src/modules/trellis/TrellisSync.js +41 -13
  261. package/src/modules/trellis/TrellisTooltip.js +101 -78
  262. package/src/modules/trellis/pivotRows.js +20 -6
  263. package/src/modules/waterfall/WaterfallData.js +14 -30
  264. package/src/modules/weave/WeaveHost.js +18 -12
  265. package/src/pictograms/registry.js +2 -1
  266. package/src/renderers/Renderer.js +41 -37
  267. package/src/renderers/canvas/CanvasCompositor.js +4 -1
  268. package/src/renderers/canvas/CanvasGraphics.js +56 -24
  269. package/src/ssr/RenderShim.js +129 -20
  270. package/src/svg/SVGContainer.js +3 -2
  271. package/src/svg/SVGFilter.js +26 -17
  272. package/src/types/internal.d.ts +8 -6
  273. package/src/unit-shapes/registry.js +3 -1
  274. package/src/utils/DateTime.js +5 -20
  275. package/src/utils/Utils.js +0 -14
  276. package/src/utils/nameAsHtml.js +16 -0
  277. package/types/apexcharts.d.ts +72 -13
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * ApexCharts v8.3.0
21
+ * ApexCharts v8.4.0
22
22
  * (c) 2018-2026 ApexCharts
23
23
  */
24
24
  import * as _core from "apexcharts/core";
@@ -198,18 +198,14 @@ class TreemapHelpers {
198
198
  this.ctx = ctx;
199
199
  this.w = w;
200
200
  }
201
+ /** Whether a colour range reaches zero or below. Runs once per draw. */
201
202
  checkColorRange() {
202
203
  const w = this.w;
203
- let negRange = false;
204
- const chartOpts = w.config.plotOptions[w.config.chart.type];
205
- if (chartOpts.colorScale.ranges.length > 0) {
206
- chartOpts.colorScale.ranges.map((range) => {
207
- if (range.from <= 0) {
208
- negRange = true;
209
- }
210
- });
211
- }
212
- return negRange;
204
+ this.rowExt = /** @type {number[][]} */
205
+ [];
206
+ return w.config.plotOptions[w.config.chart.type].colorScale.ranges.some(
207
+ (range) => range.from <= 0
208
+ );
213
209
  }
214
210
  /**
215
211
  * @param {string} chartType
@@ -219,51 +215,30 @@ class TreemapHelpers {
219
215
  */
220
216
  getShadeColor(chartType, i, j, negRange) {
221
217
  const w = this.w;
222
- let colorShadePercent = 1;
223
- const shadeIntensity = w.config.plotOptions[chartType].shadeIntensity;
218
+ const opts = w.config.plotOptions[chartType];
219
+ const shadeIntensity = opts.shadeIntensity;
220
+ const k = shadeIntensity * 1.25;
224
221
  const colorProps = this.determineColor(chartType, i, j);
222
+ const p = colorProps.percent / 100;
223
+ let colorShadePercent;
225
224
  if (
226
225
  /** @type {any} */
227
226
  w.globals.hasNegs || negRange
228
227
  ) {
229
- if (w.config.plotOptions[chartType].reverseNegativeShade) {
230
- if (colorProps.percent < 0) {
231
- colorShadePercent = colorProps.percent / 100 * (shadeIntensity * 1.25);
232
- } else {
233
- colorShadePercent = (1 - colorProps.percent / 100) * (shadeIntensity * 1.25);
234
- }
235
- } else {
236
- if (colorProps.percent <= 0) {
237
- colorShadePercent = 1 - (1 + colorProps.percent / 100) * shadeIntensity;
238
- } else {
239
- colorShadePercent = (1 - colorProps.percent / 100) * shadeIntensity;
240
- }
241
- }
228
+ colorShadePercent = opts.reverseNegativeShade ? (p < 0 ? p : 1 - p) * k : p <= 0 ? 1 - (1 + p) * shadeIntensity : (1 - p) * shadeIntensity;
242
229
  } else {
243
- colorShadePercent = 1 - colorProps.percent / 100;
244
- if (chartType === "treemap") {
245
- colorShadePercent = (1 - colorProps.percent / 100) * (shadeIntensity * 1.25);
246
- }
230
+ colorShadePercent = chartType === "treemap" ? (1 - p) * k : 1 - p;
247
231
  }
248
232
  let color = colorProps.color;
249
- const utils = new Utils();
250
- if (w.config.plotOptions[chartType].enableShades) {
251
- if (this.w.config.theme.mode === "dark") {
252
- const shadeColor = utils.shadeColor(
253
- colorShadePercent * -1,
254
- colorProps.color
255
- );
256
- color = Utils.hexToRgba(
257
- Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
258
- w.config.fill.opacity
259
- );
260
- } else {
261
- const shadeColor = utils.shadeColor(colorShadePercent, colorProps.color);
262
- color = Utils.hexToRgba(
263
- Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
264
- w.config.fill.opacity
265
- );
266
- }
233
+ if (opts.enableShades) {
234
+ const shadeColor = new Utils().shadeColor(
235
+ w.config.theme.mode === "dark" ? -colorShadePercent : colorShadePercent,
236
+ color
237
+ );
238
+ color = Utils.hexToRgba(
239
+ Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
240
+ w.config.fill.opacity
241
+ );
267
242
  }
268
243
  return { color, colorProps };
269
244
  }
@@ -288,13 +263,22 @@ class TreemapHelpers {
288
263
  min = w.globals.minY;
289
264
  max = w.globals.maxY;
290
265
  } else {
291
- const row = w.seriesData.series[i];
292
- min = row.length ? row[0] : 0;
293
- max = min;
294
- for (let k = 1; k < row.length; k++) {
295
- if (row[k] < min) min = row[k];
296
- if (row[k] > max) max = row[k];
266
+ let ext = (
267
+ /** @type {number[][]} */
268
+ this.rowExt[i]
269
+ );
270
+ if (!ext) {
271
+ const row = w.seriesData.series[i];
272
+ min = row.length ? row[0] : 0;
273
+ max = min;
274
+ for (let k = 1; k < row.length; k++) {
275
+ if (row[k] < min) min = row[k];
276
+ if (row[k] > max) max = row[k];
277
+ }
278
+ ext = /** @type {number[][]} */
279
+ this.rowExt[i] = [min, max];
297
280
  }
281
+ [min, max] = ext;
298
282
  }
299
283
  const csMin = chartOpts.colorScale.min;
300
284
  const csMax = chartOpts.colorScale.max;
@@ -355,6 +339,11 @@ class TreemapHelpers {
355
339
  }
356
340
  const Filters = _core.__apex_Filters;
357
341
  const Series = _core.__apex_Series;
342
+ function nameAsHtml(name, out = name) {
343
+ const s = String(name != null ? name : "");
344
+ const tail = out === s ? "" : out === s + ": " ? ": " : null;
345
+ return tail === null ? out : s.replace(/&/g, "&amp;").replace(/</g, "&lt;") + tail;
346
+ }
358
347
  const Environment = _core.__apex_Environment_Environment;
359
348
  function drilldownById(w, id) {
360
349
  const dd = w.config.drilldown;
@@ -478,8 +467,7 @@ function getTreemapRoots(w) {
478
467
  if (stashed && stashed.length) {
479
468
  return {
480
469
  roots: stashed,
481
- maxDepth: w.globals.treemapMaxDepth || 1,
482
- nested: true
470
+ maxDepth: w.globals.treemapMaxDepth || 1
483
471
  };
484
472
  }
485
473
  const roots = buildSeriesRoots(w, w.config.series, {
@@ -488,14 +476,13 @@ function getTreemapRoots(w) {
488
476
  });
489
477
  roots.forEach(fillValues);
490
478
  const { maxDepth } = annotate(roots);
491
- return { roots, maxDepth, nested: false };
479
+ return { roots, maxDepth };
492
480
  }
493
481
  const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
494
482
  const resolveEasing = _core.__apex_Easing_resolveEasing;
495
- function rafTween(w, duration, ease, onFrame, onDone) {
496
- const startAt = performance.now();
483
+ function rafTween(w, duration, ease, onFrame, onDone, alive, startAt = performance.now()) {
497
484
  const step = (now) => {
498
- if (w.globals.isDestroyed) return;
485
+ if (w.globals.isDestroyed || alive && !alive()) return;
499
486
  const raw = Math.max(0, Math.min(1, (now - startAt) / duration));
500
487
  onFrame(ease(raw), raw);
501
488
  if (raw < 1) {
@@ -505,6 +492,9 @@ function rafTween(w, duration, ease, onFrame, onDone) {
505
492
  }
506
493
  };
507
494
  BrowserAPIs.requestAnimationFrame(step);
495
+ return () => {
496
+ alive = () => false;
497
+ };
508
498
  }
509
499
  const DEFAULT_DIVERGING = ["#cf4d3f", "#8f9499", "#26a75b"];
510
500
  const lerp = (a, b, t) => a + (b - a) * t;
@@ -548,14 +538,12 @@ function colorValueOfDatum(w, datum, i, j) {
548
538
  const n = Number(raw);
549
539
  return Number.isFinite(n) ? n : null;
550
540
  }
551
- function resolveStops(cfg, min, max, midpoint) {
552
- if (Array.isArray(cfg.stops) && cfg.stops.length >= 2) {
541
+ function resolveStops(cfg, min, max, midpoint, explicit) {
542
+ if (explicit) {
553
543
  return cfg.stops.filter((s) => s && Number.isFinite(Number(s.value))).map((s) => ({
554
544
  value: Number(s.value),
555
545
  color: normalizeHex(s.color)
556
- })).sort(
557
- (a, b) => a.value - b.value
558
- );
546
+ })).sort((a, b) => a.value - b.value);
559
547
  }
560
548
  const colors = (Array.isArray(cfg.colors) && cfg.colors.length >= 2 ? cfg.colors : DEFAULT_DIVERGING).map(normalizeHex);
561
549
  const n = colors.length;
@@ -607,8 +595,11 @@ function buildContinuousScale(w) {
607
595
  dataMin = 0;
608
596
  dataMax = 0;
609
597
  }
610
- let min = Number.isFinite(Number(cfg.min)) ? Number(cfg.min) : dataMin;
611
- let max = Number.isFinite(Number(cfg.max)) ? Number(cfg.max) : dataMax;
598
+ const pin = (v) => Number.isFinite(Number(v)) ? Number(v) : null;
599
+ const pinMin = pin(cfg.min);
600
+ const pinMax = pin(cfg.max);
601
+ let min = pinMin != null ? pinMin : dataMin;
602
+ let max = pinMax != null ? pinMax : dataMax;
612
603
  let midpoint = null;
613
604
  if (cfg.midpoint === null) {
614
605
  midpoint = null;
@@ -617,7 +608,7 @@ function buildContinuousScale(w) {
617
608
  } else if (min < 0 && max > 0) {
618
609
  midpoint = 0;
619
610
  }
620
- if (midpoint != null && cfg.symmetric !== false && !Number.isFinite(Number(cfg.min)) && !Number.isFinite(Number(cfg.max))) {
611
+ if (midpoint != null && cfg.symmetric !== false && pinMin == null && pinMax == null) {
621
612
  const reach = Math.max(Math.abs(min - midpoint), Math.abs(max - midpoint));
622
613
  min = midpoint - reach;
623
614
  max = midpoint + reach;
@@ -626,8 +617,13 @@ function buildContinuousScale(w) {
626
617
  min -= 0.5;
627
618
  max += 0.5;
628
619
  }
629
- const stops = resolveStops(cfg, min, max, midpoint);
620
+ const explicit = Array.isArray(cfg.stops) && cfg.stops.length >= 2;
621
+ const stops = resolveStops(cfg, min, max, midpoint, explicit);
630
622
  if (stops.length < 2) return null;
623
+ if (explicit) {
624
+ if (pinMin == null) min = Math.min(min, stops[0].value);
625
+ if (pinMax == null) max = Math.max(max, stops[stops.length - 1].value);
626
+ }
631
627
  const at = (v) => {
632
628
  if (!Number.isFinite(v)) return stops[Math.floor(stops.length / 2)].color;
633
629
  if (v <= stops[0].value) return stops[0].color;
@@ -645,10 +641,13 @@ function buildContinuousScale(w) {
645
641
  return last.color;
646
642
  };
647
643
  const span = max - min;
648
- const legendStops = stops.map((s) => ({
649
- percent: span === 0 ? 0 : (s.value - min) / span,
650
- color: s.color
651
- }));
644
+ const legendStops = stops.map((s) => {
645
+ const v = Math.min(max, Math.max(min, s.value));
646
+ return {
647
+ percent: span && (v - min) / span,
648
+ color: v === s.value ? s.color : at(v)
649
+ };
650
+ });
652
651
  return { min, max, midpoint, stops, at, legendStops };
653
652
  }
654
653
  function readableOn(bg) {
@@ -659,15 +658,19 @@ const XHTML = "http://www.w3.org/1999/xhtml";
659
658
  const BREADCRUMB_HEIGHT = 18;
660
659
  function breadcrumbConfig(w, localCfg) {
661
660
  const shared = w.config.drilldown && w.config.drilldown.breadcrumb || {};
662
- return __spreadValues(__spreadValues({
663
- show: true,
664
- position: "top-left",
665
- separator: " / ",
666
- rootLabel: "All",
667
- offsetX: 0,
668
- offsetY: 0,
669
- formatter: void 0
670
- }, shared), localCfg || {});
661
+ return Object.assign(
662
+ {
663
+ show: true,
664
+ position: "top-left",
665
+ separator: " / ",
666
+ rootLabel: "All",
667
+ offsetX: 0,
668
+ offsetY: 0,
669
+ formatter: void 0
670
+ },
671
+ shared,
672
+ localCfg
673
+ );
671
674
  }
672
675
  function avoidChromeOverlap(w, nav) {
673
676
  const chrome = (
@@ -783,6 +786,11 @@ function withFills(from, to, fillWas, fillNow) {
783
786
  }
784
787
  return [from, to];
785
788
  }
789
+ const showsParents = (w) => {
790
+ var _a;
791
+ const show = w.config.plotOptions.treemap.parents.show;
792
+ return show === true || show !== false && !!((_a = w.globals.treemapRoots) == null ? void 0 : _a.length);
793
+ };
786
794
  const headerLook = (el) => Series.treemapHeaderLook(el);
787
795
  class TreemapChart {
788
796
  /**
@@ -798,7 +806,6 @@ class TreemapChart {
798
806
  this.labels = [];
799
807
  this.roots = [];
800
808
  this.drawn = [];
801
- this.nested = false;
802
809
  this.showParents = false;
803
810
  this.scale = null;
804
811
  this._levelCache = null;
@@ -825,13 +832,11 @@ class TreemapChart {
825
832
  });
826
833
  });
827
834
  const tree = getTreemapRoots(w);
828
- this.nested = tree.nested;
829
835
  this.roots = tree.roots;
830
836
  this.scale = buildContinuousScale(w);
831
837
  const drawn = tree.roots.length === 1 ? tree.roots[0].children || [] : tree.roots;
832
838
  this.drawn = drawn;
833
- const parentsCfg = w.config.plotOptions.treemap.parents;
834
- this.showParents = parentsCfg.show === true || parentsCfg.show !== false && this.nested;
839
+ this.showParents = showsParents(w);
835
840
  const focus = this._resolveFocus(drawn);
836
841
  const layoutRoots = focus ? [focus] : drawn;
837
842
  TreemapSquared.generateNested(
@@ -1674,25 +1679,35 @@ class TreemapChart {
1674
1679
  * Active means the feature is loaded as well as configured: without it the
1675
1680
  * click navigates nowhere (the chart warns about the missing feature), so
1676
1681
  * standing zoom down too would leave the click doing nothing at all.
1677
- * @returns {boolean}
1682
+ *
1683
+ * Reads only `w`, so the layout, which runs before this renderer, asks it
1684
+ * through the type registry (`prototype.zoomLive`) and reserves the
1685
+ * breadcrumb band on the same answer: a flat treemap, with no parents to
1686
+ * click, used to keep an empty band. Not a static: one on this class cost
1687
+ * the default bundle about 290 B gzip.
1688
+ * @param {any} w
1689
+ * @param {any} drilldown the chart's drilldown feature, when loaded
1690
+ * @returns {any} the zoom config when live, null when drilldown is what
1691
+ * stands it down, else false
1678
1692
  */
1679
- _zoomEnabled() {
1693
+ zoomLive(w, drilldown) {
1680
1694
  var _a;
1681
- const w = this.w;
1682
1695
  const z = w.config.plotOptions.treemap.zoom;
1683
- if (!z || !z.enabled || !this.showParents) return false;
1696
+ if (!(z == null ? void 0 : z.enabled) || !showsParents(w)) return false;
1684
1697
  const dd = w.config.drilldown;
1698
+ return drilldown && (dd == null ? void 0 : dd.enabled) && (((_a = dd.series) == null ? void 0 : _a.length) || dd.onDrillDown) ? null : z;
1699
+ }
1700
+ /** @returns {boolean} */
1701
+ _zoomEnabled() {
1685
1702
  const d = this.ctx.drilldown;
1686
- if (d && dd && dd.enabled && (((_a = dd.series) == null ? void 0 : _a.length) || dd.onDrillDown)) {
1687
- if (!d.zoomWarned) {
1688
- d.zoomWarned = true;
1689
- console.warn(
1690
- "ApexCharts treemap: zoom is ignored while drilldown is active (plotOptions.treemap.zoom vs drilldown series or onDrillDown)."
1691
- );
1692
- }
1693
- return false;
1703
+ const live = this.zoomLive(this.w, d);
1704
+ if (live === null && !d.zoomWarned) {
1705
+ d.zoomWarned = true;
1706
+ console.warn(
1707
+ "ApexCharts treemap: zoom is ignored while drilldown is active (plotOptions.treemap.zoom vs drilldown series or onDrillDown)."
1708
+ );
1694
1709
  }
1695
- return true;
1710
+ return !!live;
1696
1711
  }
1697
1712
  /**
1698
1713
  * The focused branch for this render, looked up by the key stashed on the
@@ -2101,6 +2116,9 @@ class TreemapChart {
2101
2116
  * that grows the font - where a readable chip over the tiles beats a
2102
2117
  * breadcrumb clipped by the plot.
2103
2118
  *
2119
+ * Breadcrumb.placeInReservedBand does the same plus a y-axis label ceiling
2120
+ * a treemap has no use for, which would cost the default bundle its bytes.
2121
+ *
2104
2122
  * @param {any} nav
2105
2123
  */
2106
2124
  _placeBreadcrumb(nav) {
@@ -2110,11 +2128,12 @@ class TreemapChart {
2110
2128
  const dimHelpers = (_b = (_a = this.ctx) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.dimHelpers;
2111
2129
  const titleArea = dimHelpers ? dimHelpers.getTitleSubtitleCoords("title").height + dimHelpers.getTitleSubtitleCoords("subtitle").height : 0;
2112
2130
  const navH = nav.getBoundingClientRect().height || BREADCRUMB_HEIGHT;
2131
+ const oy = this._breadcrumbCfg().offsetY || 0;
2113
2132
  if (gridTop - titleArea >= navH + 1) {
2114
- nav.style.top = `${gridTop - navH - 1}px`;
2133
+ nav.style.top = `${gridTop - navH - 1 + oy}px`;
2115
2134
  return;
2116
2135
  }
2117
- nav.style.top = `${titleArea}px`;
2136
+ nav.style.top = `${titleArea + oy}px`;
2118
2137
  const dark = w.config.theme.mode === "dark";
2119
2138
  nav.style.background = dark ? "rgba(20,24,30,0.82)" : "rgba(255,255,255,0.86)";
2120
2139
  nav.style.borderRadius = "4px";
@@ -2129,6 +2148,7 @@ class TreemapChart {
2129
2148
  * @param {any} node
2130
2149
  */
2131
2150
  _showParentTooltip(e, node) {
2151
+ var _a;
2132
2152
  const w = this.w;
2133
2153
  const t = this._tip();
2134
2154
  if (!t) return;
@@ -2137,29 +2157,33 @@ class TreemapChart {
2137
2157
  const pctTotal = total > 0 ? (node._area / total * 100).toFixed(1) : "0.0";
2138
2158
  const pctParent = parentVal > 0 ? (node._area / parentVal * 100).toFixed(1) : pctTotal;
2139
2159
  const cfg = this.w.config.plotOptions.treemap.parents;
2140
- const custom = cfg && cfg.tooltip && cfg.tooltip.formatter;
2141
2160
  const leafCount = this._countLeaves(node);
2142
- let html;
2143
- if (typeof custom === "function") {
2144
- html = custom({
2145
- name: node.name,
2146
- value: node._area,
2147
- depth: node.depth || 0,
2148
- leafCount,
2149
- percentOfParent: Number(pctParent),
2150
- percentOfTotal: Number(pctTotal),
2151
- node,
2152
- w
2153
- });
2154
- } else {
2161
+ let fn = cfg && cfg.tooltip && cfg.tooltip.formatter;
2162
+ if (typeof fn !== "function") fn = w.config.tooltip.custom;
2163
+ let html = (_a = Array.isArray(fn) ? fn[node._si] : fn) == null ? void 0 : _a({
2164
+ name: node.name,
2165
+ value: node._area,
2166
+ depth: node.depth || 0,
2167
+ leafCount,
2168
+ percentOfParent: +pctParent,
2169
+ percentOfTotal: +pctTotal,
2170
+ node,
2171
+ w,
2172
+ series: w.seriesData.series,
2173
+ seriesIndex: node._si,
2174
+ dataPointIndex: -1,
2175
+ ctx: this.ctx
2176
+ });
2177
+ if (html == null || html === false) {
2155
2178
  const marker = this._parentChrome(node.depth || 0).headerBg;
2156
2179
  const groupBg = w.config.tooltip.fillSeriesColor ? `background-color:${marker};` : "";
2157
- html = `<div class="apexcharts-tooltip-series-group apexcharts-active" style="display:flex;${groupBg}"><div class="apexcharts-tooltip-text"><div class="apexcharts-tooltip-y-group"><span class="apexcharts-tooltip-text-y-label">${String(node.name).replace(/&/g, "&amp;").replace(/</g, "&lt;")}: </span><span class="apexcharts-tooltip-text-y-value">${this._formatValue(
2180
+ html = `<div class="apexcharts-tooltip-series-group apexcharts-active" style="display:flex;${groupBg}"><div class="apexcharts-tooltip-text"><div class="apexcharts-tooltip-y-group"><span class="apexcharts-tooltip-text-y-label">${nameAsHtml(node.name)}: </span><span class="apexcharts-tooltip-text-y-value">${this._formatValue(
2158
2181
  node._area,
2159
2182
  node._si
2160
2183
  )}</span></div><div class="apexcharts-tooltip-y-group"><span class="apexcharts-tooltip-text-y-label">${leafCount} items, </span><span class="apexcharts-tooltip-text-y-value">${pctParent}% of parent, ${pctTotal}% of total</span></div></div></div>`;
2161
2184
  }
2162
- t.innerHTML = html;
2185
+ if (html == null ? void 0 : html.nodeName) t.replaceChildren(html.cloneNode(true));
2186
+ else t.innerHTML = html;
2163
2187
  t.classList.add("apexcharts-active");
2164
2188
  t.removeAttribute("aria-hidden");
2165
2189
  this._positionTooltip(e);
@@ -2346,13 +2370,20 @@ class TreemapChart {
2346
2370
  * @param {number} y2
2347
2371
  */
2348
2372
  rotateToFitLabel(elText, fontSize, text, x1, y1, x2, y2) {
2349
- const graphics = new Graphics(this.w);
2350
- const textRect = this._labelRect(graphics, text, fontSize);
2351
- if (textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && textRect.width <= y2 - y1) {
2352
- const labelRotatingCenter = graphics.rotateAroundCenter(elText.node);
2373
+ const textRect = (
2374
+ /** @type {any} */
2375
+ this._labelRect(new Graphics(this.w), text, fontSize)
2376
+ );
2377
+ const t = elText.node.querySelector("text");
2378
+ if (t && textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && textRect.width <= y2 - y1) {
2379
+ const a = t.getAttribute("text-anchor");
2380
+ const cx = +t.getAttribute("x") + /** @type {any} */
2381
+ ((a === "start") - /** @type {any} */
2382
+ (a === "end")) * textRect.width / 2;
2383
+ const cy = +t.getAttribute("y") + textRect.centerOffset;
2353
2384
  elText.node.setAttribute(
2354
2385
  "transform",
2355
- `rotate(-90 ${labelRotatingCenter.x} ${labelRotatingCenter.y}) translate(${textRect.height / 3})`
2386
+ `rotate(-90 ${cx} ${cy}) translate(${textRect.height / 3})`
2356
2387
  );
2357
2388
  }
2358
2389
  }
@@ -2405,9 +2436,9 @@ class TreemapChart {
2405
2436
  * @returns {boolean}
2406
2437
  */
2407
2438
  _morphKeyed() {
2408
- var _a;
2439
+ var _a, _b;
2409
2440
  const m = (_a = this.ctx) == null ? void 0 : _a.morphTypeChange;
2410
- return !!(m && typeof m.hasKeyedMarks === "function" && m.hasKeyedMarks() && typeof m.getInitialPathForKey === "function");
2441
+ return (_b = this._keyed) != null ? _b : this._keyed = !!(m && typeof m.hasKeyedMarks === "function" && m.hasKeyedMarks() && typeof m.getInitialPathForKey === "function");
2411
2442
  }
2412
2443
  /**
2413
2444
  * The captured shape a LEAF tile unrolls from, or null when the outgoing