apexcharts 8.2.0 → 8.3.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 (222) hide show
  1. package/README.md +7 -7
  2. package/dist/apexcharts.common.js +2 -2
  3. package/dist/apexcharts.core.js +271 -173
  4. package/dist/apexcharts.core.min.js +2 -2
  5. package/dist/apexcharts.css +35 -0
  6. package/dist/apexcharts.esm.js +1722 -1527
  7. package/dist/apexcharts.full.js +1459 -1075
  8. package/dist/apexcharts.full.min.js +2 -2
  9. package/dist/apexcharts.js +994 -715
  10. package/dist/apexcharts.min.js +2 -2
  11. package/dist/apexcharts.ssr.common.js +2 -2
  12. package/dist/apexcharts.ssr.esm.js +994 -715
  13. package/dist/area.common.js +2 -2
  14. package/dist/area.esm.js +91 -40
  15. package/dist/bar.common.js +2 -2
  16. package/dist/bar.esm.js +433 -394
  17. package/dist/bar.js +2 -2
  18. package/dist/boxPlot.common.js +2 -2
  19. package/dist/boxPlot.esm.js +364 -322
  20. package/dist/bubble.common.js +2 -2
  21. package/dist/bubble.esm.js +91 -40
  22. package/dist/candlestick.common.js +2 -2
  23. package/dist/candlestick.esm.js +364 -322
  24. package/dist/candlestick.js +2 -2
  25. package/dist/column.common.js +2 -2
  26. package/dist/column.esm.js +433 -394
  27. package/dist/core.common.js +2 -2
  28. package/dist/core.esm.js +271 -173
  29. package/dist/donut.common.js +1 -1
  30. package/dist/donut.esm.js +1 -1
  31. package/dist/dumbbell.common.js +2 -2
  32. package/dist/dumbbell.esm.js +433 -394
  33. package/dist/features/all.common.js +2 -2
  34. package/dist/features/all.esm.js +250 -187
  35. package/dist/features/annotations.common.js +1 -1
  36. package/dist/features/annotations.esm.js +1 -1
  37. package/dist/features/annotations.js +1 -1
  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 +4 -2
  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 +1 -1
  48. package/dist/features/exports.esm.js +1 -1
  49. package/dist/features/exports.js +1 -1
  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 +14 -9
  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 +2 -2
  63. package/dist/features/keyboard.esm.js +97 -145
  64. package/dist/features/keyboard.js +2 -2
  65. package/dist/features/legend.common.js +2 -2
  66. package/dist/features/legend.esm.js +63 -43
  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 +1 -1
  78. package/dist/features/morph.esm.js +1 -1
  79. package/dist/features/morph.js +1 -1
  80. package/dist/features/perspectives.common.js +1 -1
  81. package/dist/features/perspectives.esm.js +1 -1
  82. package/dist/features/perspectives.js +1 -1
  83. package/dist/features/raincloud.common.js +1 -1
  84. package/dist/features/raincloud.esm.js +1 -1
  85. package/dist/features/raincloud.js +1 -1
  86. package/dist/features/renderer-canvas.common.js +2 -2
  87. package/dist/features/renderer-canvas.esm.js +2 -1
  88. package/dist/features/renderer-canvas.js +2 -2
  89. package/dist/features/stats.common.js +1 -1
  90. package/dist/features/stats.esm.js +1 -1
  91. package/dist/features/stats.js +1 -1
  92. package/dist/features/storyboard.common.js +1 -1
  93. package/dist/features/storyboard.esm.js +1 -1
  94. package/dist/features/storyboard.js +1 -1
  95. package/dist/features/streamgraph.common.js +2 -2
  96. package/dist/features/streamgraph.esm.js +3 -2
  97. package/dist/features/streamgraph.js +2 -2
  98. package/dist/features/toolbar.common.js +2 -2
  99. package/dist/features/toolbar.esm.js +92 -2
  100. package/dist/features/toolbar.js +2 -2
  101. package/dist/features/trellis.common.js +2 -2
  102. package/dist/features/trellis.esm.js +83 -47
  103. package/dist/features/trellis.js +2 -2
  104. package/dist/features/waterfall.common.js +1 -1
  105. package/dist/features/waterfall.esm.js +1 -1
  106. package/dist/features/waterfall.js +1 -1
  107. package/dist/features/weave.common.js +1 -1
  108. package/dist/features/weave.esm.js +1 -1
  109. package/dist/features/weave.js +1 -1
  110. package/dist/full.common.js +2 -2
  111. package/dist/full.esm.js +950 -795
  112. package/dist/heatmap.common.js +2 -2
  113. package/dist/heatmap.esm.js +3 -17
  114. package/dist/heatmap.js +2 -2
  115. package/dist/histogram.common.js +2 -2
  116. package/dist/histogram.esm.js +433 -394
  117. package/dist/icicle.common.js +2 -2
  118. package/dist/icicle.esm.js +54 -38
  119. package/dist/icicle.js +2 -2
  120. package/dist/line.common.js +2 -2
  121. package/dist/line.esm.js +91 -40
  122. package/dist/line.js +2 -2
  123. package/dist/locales/en.json +2 -1
  124. package/dist/locales/ro.json +3 -2
  125. package/dist/pictograms.common.js +1 -1
  126. package/dist/pictograms.esm.js +1 -1
  127. package/dist/pictograms.js +1 -1
  128. package/dist/pie.common.js +1 -1
  129. package/dist/pie.esm.js +1 -1
  130. package/dist/pie.js +1 -1
  131. package/dist/polarArea.common.js +1 -1
  132. package/dist/polarArea.esm.js +1 -1
  133. package/dist/radar.common.js +2 -2
  134. package/dist/radar.esm.js +5 -4
  135. package/dist/radar.js +2 -2
  136. package/dist/radialBar.common.js +1 -1
  137. package/dist/radialBar.esm.js +1 -1
  138. package/dist/radialBar.js +1 -1
  139. package/dist/raincloud.common.js +2 -2
  140. package/dist/raincloud.esm.js +72 -26
  141. package/dist/rangeArea.common.js +2 -2
  142. package/dist/rangeArea.esm.js +91 -40
  143. package/dist/rangeBar.common.js +2 -2
  144. package/dist/rangeBar.esm.js +433 -394
  145. package/dist/scatter.common.js +2 -2
  146. package/dist/scatter.esm.js +91 -40
  147. package/dist/streamgraph.common.js +2 -2
  148. package/dist/streamgraph.esm.js +93 -41
  149. package/dist/sunburst.common.js +2 -2
  150. package/dist/sunburst.esm.js +103 -93
  151. package/dist/sunburst.js +2 -2
  152. package/dist/treemap.common.js +2 -2
  153. package/dist/treemap.esm.js +105 -86
  154. package/dist/treemap.js +2 -2
  155. package/dist/unit-shapes.common.js +1 -1
  156. package/dist/unit-shapes.esm.js +1 -1
  157. package/dist/unit-shapes.js +1 -1
  158. package/dist/unit.common.js +2 -2
  159. package/dist/unit.esm.js +280 -202
  160. package/dist/unit.js +2 -2
  161. package/dist/violin.common.js +2 -2
  162. package/dist/violin.esm.js +72 -26
  163. package/dist/violin.js +2 -2
  164. package/dist/waterfall.common.js +2 -2
  165. package/dist/waterfall.esm.js +432 -393
  166. package/package.json +1 -1
  167. package/src/apexcharts.js +13 -6
  168. package/src/assets/apexcharts.css +35 -0
  169. package/src/charts/Bar.js +62 -55
  170. package/src/charts/BarStacked.js +80 -88
  171. package/src/charts/BoxCandleStick.js +28 -31
  172. package/src/charts/Icicle.js +37 -37
  173. package/src/charts/Line.js +118 -42
  174. package/src/charts/Radar.js +5 -7
  175. package/src/charts/RangeBar.js +47 -43
  176. package/src/charts/Sunburst.js +101 -98
  177. package/src/charts/Treemap.js +108 -66
  178. package/src/charts/Unit.js +368 -250
  179. package/src/charts/Violin.js +48 -30
  180. package/src/charts/common/Breadcrumb.js +2 -2
  181. package/src/charts/common/Hierarchy.js +32 -11
  182. package/src/charts/common/Jitter.js +32 -7
  183. package/src/charts/common/bar/DataLabels.js +76 -81
  184. package/src/charts/common/bar/Helpers.js +43 -7
  185. package/src/charts/common/line/Helpers.js +12 -15
  186. package/src/charts/common/partition/NodeTooltip.js +8 -1
  187. package/src/charts/common/partition/Partition.js +33 -1
  188. package/src/charts/common/treemap/Helpers.js +3 -11
  189. package/src/locales/en.json +2 -1
  190. package/src/locales/ro.json +3 -2
  191. package/src/modules/Core.js +4 -0
  192. package/src/modules/CoreUtils.js +18 -42
  193. package/src/modules/Data.js +23 -24
  194. package/src/modules/DataLabels.js +6 -6
  195. package/src/modules/Graphics.js +62 -49
  196. package/src/modules/Markers.js +3 -1
  197. package/src/modules/Range.js +44 -29
  198. package/src/modules/RendererController.js +17 -3
  199. package/src/modules/Scales.js +32 -9
  200. package/src/modules/Series.js +39 -18
  201. package/src/modules/Theme.js +1 -1
  202. package/src/modules/ZoomPanSelection.js +119 -2
  203. package/src/modules/accessibility/KeyboardNavigation.js +114 -186
  204. package/src/modules/animations/LengthTransition.js +22 -2
  205. package/src/modules/drilldown/Breadcrumb.js +5 -2
  206. package/src/modules/helpers/Destroy.js +1 -1
  207. package/src/modules/highlightFilter/HighlightFilter.js +8 -9
  208. package/src/modules/highlightFilter/TreemapPart.js +2 -2
  209. package/src/modules/legend/HeatmapGradientLegend.js +76 -45
  210. package/src/modules/legend/Helpers.js +2 -0
  211. package/src/modules/legend/Legend.js +11 -12
  212. package/src/modules/settings/Options.js +7 -0
  213. package/src/modules/streamgraph/StreamLabels.js +1 -0
  214. package/src/modules/tooltip/Tooltip.js +20 -4
  215. package/src/modules/tooltip/Utils.js +8 -0
  216. package/src/modules/trellis/Trellis.js +6 -0
  217. package/src/modules/trellis/TrellisChrome.js +18 -7
  218. package/src/modules/trellis/TrellisSync.js +2 -0
  219. package/src/renderers/canvas/CanvasGraphics.js +1 -0
  220. package/src/ssr/DOMShim.js +10 -0
  221. package/src/types/internal.d.ts +9 -3
  222. package/types/apexcharts.d.ts +31 -12
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  /*!
33
- * ApexCharts v8.2.0
33
+ * ApexCharts v8.3.0
34
34
  * (c) 2018-2026 ApexCharts
35
35
  */
36
36
  import * as _core from "apexcharts/core";
@@ -223,181 +223,6 @@ const resolveDataLabelOffset = (value, w, seriesIndex, dataPointIndex) => {
223
223
  });
224
224
  return Number.isFinite(resolved) ? resolved : 0;
225
225
  };
226
- const Animations = _core.__apex_Animations;
227
- const computeStagger = _core.__apex_Animations_computeStagger;
228
- const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
229
- const Environment = _core.__apex_Environment_Environment;
230
- function lengthTransitionEnabled(w) {
231
- var _a;
232
- const anim = w.config.chart.animations;
233
- if (!anim || anim.enabled === false) return false;
234
- if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
235
- return false;
236
- }
237
- const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
238
- if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
239
- return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
240
- }
241
- function datumKey(w, realIndex, j) {
242
- var _a, _b, _c, _d;
243
- if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
244
- const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
245
- if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
246
- }
247
- const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
248
- if (lbl != null && String(lbl) !== "") {
249
- return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
250
- }
251
- return "j:" + j;
252
- }
253
- function frameDatumKey(frame, realIndex, j) {
254
- var _a, _b;
255
- if (frame.isXNumeric) {
256
- const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
257
- if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
258
- }
259
- const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
260
- if (lbl != null && String(lbl) !== "") {
261
- return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
262
- }
263
- return "j:" + j;
264
- }
265
- function joinKeys(oldKeys, newKeys) {
266
- const oldIndex = /* @__PURE__ */ new Map();
267
- oldKeys.forEach((k, i) => {
268
- if (!oldIndex.has(k)) oldIndex.set(k, i);
269
- });
270
- const toOld = new Array(newKeys.length);
271
- const usedOld = /* @__PURE__ */ new Set();
272
- let prev = -1;
273
- let ordered = true;
274
- let identity = oldKeys.length === newKeys.length;
275
- newKeys.forEach((k, i) => {
276
- const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
277
- toOld[i] = oi;
278
- if (oi !== -1) {
279
- usedOld.add(oi);
280
- if (oi < prev) ordered = false;
281
- prev = oi;
282
- }
283
- if (oi !== i) identity = false;
284
- });
285
- const exits = [];
286
- for (let i = 0; i < oldKeys.length; i++) {
287
- if (!usedOld.has(i)) exits.push(i);
288
- }
289
- return { toOld, exits, ordered, changed: !identity };
290
- }
291
- function uniquifyKeys(keys) {
292
- const seen = /* @__PURE__ */ new Map();
293
- return keys.map((k) => {
294
- const count = seen.get(k) || 0;
295
- seen.set(k, count + 1);
296
- return count === 0 ? k : `${k}#${count}`;
297
- });
298
- }
299
- function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
300
- var _a, _b;
301
- if (!lengthTransitionEnabled(w)) return null;
302
- const frame = w.globals.prevStreamFrame;
303
- if (!frame) return null;
304
- const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
305
- const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
306
- if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
307
- if (!oldY.length || !newY.length) return null;
308
- const oldKeys = uniquifyKeys(
309
- oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
310
- );
311
- const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)));
312
- const join = joinKeys(oldKeys, newKeys);
313
- if (!join.ordered && !allowReorder) return null;
314
- if (!join.changed && !includeIdentity) return null;
315
- return { join, oldKeys, newKeys };
316
- }
317
- function firstMove(d) {
318
- const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
319
- if (!m) return null;
320
- const x = parseFloat(m[1]);
321
- const y = parseFloat(m[2]);
322
- return isFinite(x) && isFinite(y) ? { x, y } : null;
323
- }
324
- function renderBarExitGhosts({
325
- w,
326
- elSeries,
327
- record,
328
- newKeys,
329
- isHorizontal,
330
- speed
331
- }) {
332
- var _a;
333
- if (!lengthTransitionEnabled(w)) return;
334
- if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
335
- const newKeySet = new Set(newKeys);
336
- const exits = record.paths.filter(
337
- (p) => p && p.d && p.key != null && !newKeySet.has(p.key)
338
- );
339
- if (!exits.length) return;
340
- const graphics = new Graphics(w);
341
- const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
342
- exits.forEach((p) => {
343
- let fill = p.fill || fallbackFill || "#c8c8c8";
344
- if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
345
- const ghost = graphics.drawPath({
346
- d: p.d,
347
- stroke: "none",
348
- strokeWidth: 0,
349
- fill,
350
- fillOpacity: 1,
351
- classes: "apexcharts-bar-ghost"
352
- });
353
- const node = ghost.node;
354
- node.setAttribute("pointer-events", "none");
355
- ghost.attr(
356
- "clip-path",
357
- `url(#gridRectBarMask${w.globals.cuid})`
358
- );
359
- elSeries.node.insertBefore(node, elSeries.node.firstChild);
360
- const start = firstMove(p.d);
361
- let origin = isHorizontal ? "left center" : "center bottom";
362
- try {
363
- const bb = node.getBBox();
364
- if (start && bb) {
365
- if (isHorizontal) {
366
- origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
367
- } else {
368
- origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
369
- }
370
- }
371
- } catch (_) {
372
- }
373
- const style = node.style;
374
- style.transformBox = "fill-box";
375
- style.transformOrigin = origin;
376
- node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
377
- try {
378
- const bb = node.getBBox();
379
- const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
380
- if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
381
- } catch (_) {
382
- }
383
- const duration = Math.max(1, speed || 1);
384
- const startAt = performance.now();
385
- const step = (now) => {
386
- if (w.globals.isDestroyed || !node.parentNode) return;
387
- const t = Math.max(0, Math.min(1, (now - startAt) / duration));
388
- const eased = 1 - Math.pow(1 - t, 3);
389
- const scale = 1 - eased;
390
- style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
391
- style.opacity = String(1 - eased);
392
- if (t < 1) {
393
- BrowserAPIs.requestAnimationFrame(step);
394
- } else {
395
- node.parentNode.removeChild(node);
396
- }
397
- };
398
- BrowserAPIs.requestAnimationFrame(step);
399
- });
400
- }
401
226
  class BarDataLabels {
402
227
  /**
403
228
  * @param {import('../../../charts/Bar').default} barCtx
@@ -433,7 +258,8 @@ class BarDataLabels {
433
258
  barXPosition,
434
259
  barYPosition,
435
260
  visibleSeries,
436
- hl
261
+ hl,
262
+ noLabel
437
263
  } = opts;
438
264
  const w = this.w;
439
265
  const graphics = new Graphics(this.barCtx.w);
@@ -547,7 +373,7 @@ class BarDataLabels {
547
373
  dataLabelsPos.dataLabelsX = (box.levelStart + box.levelEnd) / 2 + offX;
548
374
  }
549
375
  }
550
- dataLabels = this.drawCalculatedDataLabels({
376
+ dataLabels = noLabel ? null : this.drawCalculatedDataLabels({
551
377
  x: dataLabelsPos.dataLabelsX,
552
378
  y: dataLabelsPos.dataLabelsY,
553
379
  neg: params.neg,
@@ -633,8 +459,8 @@ class BarDataLabels {
633
459
  return ctx && byGroups && byGroups[ctx.groupIndex] ? byGroups[ctx.groupIndex][j] : this.barCtx.stackedSeriesTotals[j];
634
460
  }
635
461
  /**
636
- * The running stack at this column's x (BarStacked `tops`, columns only) on
637
- * a numeric axis, where columns stack by x rather than by index.
462
+ * The running stack at this bar's x (BarStacked `tops`) on a numeric axis,
463
+ * where bars stack by x rather than by index.
638
464
  * @param {number} realIndex @param {number} j
639
465
  */
640
466
  xStackTop(realIndex, j) {
@@ -643,6 +469,21 @@ class BarDataLabels {
643
469
  return w.axisFlags.isXNumeric && /** @type {any} */
644
470
  ((_b = (_a = this.barCtx.stacks) == null ? void 0 : _a[w.labelData.seriesGroupIndex[realIndex]]) == null ? void 0 : _b.tops.get(w.seriesData.seriesX[realIndex][j]));
645
471
  }
472
+ /**
473
+ * The stacked total's text box, measured in the total's own font.
474
+ * @param {number} realIndex @param {number} j
475
+ */
476
+ totalRects(realIndex, j) {
477
+ const s = this.barCtx.barOptions.dataLabels.total.style;
478
+ return new Graphics(this.w).getTextRects(
479
+ this.getStackedTotalDataLabel({ realIndex, j }),
480
+ s.fontSize,
481
+ s.fontFamily,
482
+ void 0,
483
+ true,
484
+ s.fontWeight
485
+ );
486
+ }
646
487
  /** @param {{realIndex: any, j: any}} opts */
647
488
  getStackedTotalDataLabel({ realIndex, j }) {
648
489
  const w = this.w;
@@ -663,7 +504,6 @@ class BarDataLabels {
663
504
  var _a;
664
505
  const w = this.w;
665
506
  let {
666
- i,
667
507
  j,
668
508
  realIndex,
669
509
  y,
@@ -673,7 +513,6 @@ class BarDataLabels {
673
513
  textRects,
674
514
  dataLabelsX,
675
515
  dataLabelsY,
676
- dataLabelsConfig,
677
516
  barDataLabelsConfig,
678
517
  barTotalDataLabelsConfig,
679
518
  strokeWidth,
@@ -687,7 +526,7 @@ class BarDataLabels {
687
526
  barHeight = Math.abs(barHeight);
688
527
  const vertical = w.config.plotOptions.bar.dataLabels.orientation === "vertical";
689
528
  const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
690
- i,
529
+ i: realIndex,
691
530
  j
692
531
  });
693
532
  bcx = bcx - strokeWidth / 2;
@@ -708,7 +547,7 @@ class BarDataLabels {
708
547
  const offsetDLX = 2;
709
548
  dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX;
710
549
  }
711
- const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[i][j] < 0;
550
+ const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[realIndex][j] < 0;
712
551
  let newY = y;
713
552
  if (this.barCtx.isReversed) {
714
553
  newY = y + (valIsNegative ? barHeight : -barHeight);
@@ -782,16 +621,11 @@ class BarDataLabels {
782
621
  });
783
622
  if (this.hlt) lowestPrevY = this.hlt.edge;
784
623
  if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
785
- const ADDITIONAL_OFFY = 18;
786
- const graphics = new Graphics(this.barCtx.w);
787
- const totalLabeltextRects = graphics.getTextRects(
788
- this.getStackedTotalDataLabel({ realIndex, j }),
789
- dataLabelsConfig.fontSize
790
- );
624
+ const h = this.totalRects(realIndex, j).height;
791
625
  if (valIsNegative) {
792
- totalDataLabelsY = lowestPrevY - totalLabeltextRects.height / 2 - offY - barTotalDataLabelsConfig.offsetY + ADDITIONAL_OFFY;
626
+ totalDataLabelsY = lowestPrevY + h * 0.77 - offY - barTotalDataLabelsConfig.offsetY;
793
627
  } else {
794
- totalDataLabelsY = lowestPrevY + totalLabeltextRects.height + offY + barTotalDataLabelsConfig.offsetY - ADDITIONAL_OFFY;
628
+ totalDataLabelsY = lowestPrevY - h * 0.3 + offY + barTotalDataLabelsConfig.offsetY;
795
629
  }
796
630
  const xDivision = dataPointsDividedWidth;
797
631
  totalDataLabelsX = totalDataLabelsBcx + (w.axisFlags.isXNumeric ? -barWidth / 2 : barWidth / 2 - xDivision) + barTotalDataLabelsConfig.offsetX;
@@ -821,7 +655,6 @@ class BarDataLabels {
821
655
  const w = this.w;
822
656
  let {
823
657
  x,
824
- i,
825
658
  j,
826
659
  realIndex,
827
660
  bcy,
@@ -838,7 +671,7 @@ class BarDataLabels {
838
671
  } = opts;
839
672
  const dataPointsDividedHeight = w.layout.gridHeight / w.globals.dataPoints;
840
673
  const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
841
- i,
674
+ i: realIndex,
842
675
  j
843
676
  });
844
677
  barWidth = Math.abs(barWidth);
@@ -855,7 +688,7 @@ class BarDataLabels {
855
688
  let totalDataLabelsX;
856
689
  let totalDataLabelsY;
857
690
  let totalDataLabelsAnchor = "start";
858
- const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[i][j] < 0;
691
+ const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[realIndex][j] < 0;
859
692
  let newX = x;
860
693
  if (this.barCtx.isReversed) {
861
694
  newX = x + (valIsNegative ? -barWidth : barWidth);
@@ -890,10 +723,14 @@ class BarDataLabels {
890
723
  }
891
724
  let lowestPrevX = newX;
892
725
  const totalGroupCtx = this.getTotalGroupContext(realIndex);
893
- const stacks = (
726
+ const top = this.xStackTop(realIndex, j);
727
+ const stacks = top ? [] : (
894
728
  /** @type {any} */
895
729
  this.barCtx.stacks || []
896
730
  );
731
+ if (top) {
732
+ lowestPrevX = valIsNegative ? Math.min(newX, top[4]) : Math.max(newX, top[5]);
733
+ }
897
734
  stacks.forEach((g, gi) => {
898
735
  if (totalGroupCtx && gi !== totalGroupCtx.groupIndex) return;
899
736
  g.prevX.forEach((arr) => {
@@ -906,11 +743,7 @@ class BarDataLabels {
906
743
  });
907
744
  if (this.hlt) lowestPrevX = this.hlt.edge;
908
745
  if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
909
- const graphics = new Graphics(this.barCtx.w);
910
- const totalLabeltextRects = graphics.getTextRects(
911
- this.getStackedTotalDataLabel({ realIndex, j }),
912
- dataLabelsConfig.fontSize
913
- );
746
+ const totalLabeltextRects = this.totalRects(realIndex, j);
914
747
  if (valIsNegative) {
915
748
  totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX;
916
749
  totalDataLabelsAnchor = "end";
@@ -979,8 +812,9 @@ class BarDataLabels {
979
812
  let elDataLabelsWrap = null;
980
813
  const isSeriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1;
981
814
  const isSeriesCollapsing = (w.globals.collapsingSeriesIndices || []).indexOf(i) > -1;
815
+ const dlKey = `${i}::${this.barCtx._keys(i)[j]}`;
982
816
  if (isSeriesCollapsing) {
983
- const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(`${i}::${datumKey(w, i, j)}`);
817
+ const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(dlKey);
984
818
  if (prev && isFinite(prev.val)) {
985
819
  val = prev.val;
986
820
  text = void 0;
@@ -993,10 +827,7 @@ class BarDataLabels {
993
827
  });
994
828
  const dlCfg = w.config.dataLabels;
995
829
  if (((_b = dlCfg.animate) == null ? void 0 : _b.enabled) || ((_c = dlCfg.countUp) == null ? void 0 : _c.enabled)) {
996
- elDataLabelsWrap.node.setAttribute(
997
- "data:dlKey",
998
- `${i}::${datumKey(w, i, j)}`
999
- );
830
+ elDataLabelsWrap.node.setAttribute("data:dlKey", dlKey);
1000
831
  elDataLabelsWrap.node.setAttribute("data:dlJ", String(j));
1001
832
  if (typeof val === "number" && isFinite(val)) {
1002
833
  elDataLabelsWrap.node.setAttribute("data:dlVal", String(val));
@@ -1014,29 +845,12 @@ class BarDataLabels {
1014
845
  if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
1015
846
  text = "";
1016
847
  }
1017
- const valIsNegative = neg != null ? neg : w.seriesData.series[i][j] < 0;
1018
- const position = w.config.plotOptions.bar.dataLabels.position;
848
+ let anchor = dataLabelsConfig.textAnchor;
1019
849
  if (w.config.plotOptions.bar.dataLabels.orientation === "vertical") {
1020
- if (position === "top") {
1021
- if (valIsNegative) dataLabelsConfig.textAnchor = "end";
1022
- else dataLabelsConfig.textAnchor = "start";
1023
- }
1024
- if (position === "center") {
1025
- dataLabelsConfig.textAnchor = "middle";
1026
- }
1027
- if (position === "bottom") {
1028
- if (valIsNegative) dataLabelsConfig.textAnchor = "end";
1029
- else dataLabelsConfig.textAnchor = "start";
1030
- }
850
+ anchor = w.config.plotOptions.bar.dataLabels.position === "center" ? "middle" : (neg != null ? neg : w.seriesData.series[i][j] < 0) ? "end" : "start";
1031
851
  }
1032
- if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) {
1033
- const txRect = graphics.getTextRects(
1034
- text,
1035
- parseFloat(dataLabelsConfig.style.fontSize).toString()
1036
- );
1037
- if (barWidth < txRect.width) {
1038
- text = "";
1039
- }
852
+ if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && barWidth < textRects.width) {
853
+ text = "";
1040
854
  }
1041
855
  if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && // A collapsing series is measured against its NEW extent, which is
1042
856
  // already zero, so this would blank a label whose bar is still at full
@@ -1052,14 +866,14 @@ class BarDataLabels {
1052
866
  }
1053
867
  }
1054
868
  }
1055
- const modifiedDataLabelsConfig = __spreadValues({}, dataLabelsConfig);
1056
- if (this.barCtx.isHorizontal) {
1057
- if (val < 0) {
1058
- if (dataLabelsConfig.textAnchor === "start") {
1059
- modifiedDataLabelsConfig.textAnchor = "end";
1060
- } else if (dataLabelsConfig.textAnchor === "end") {
1061
- modifiedDataLabelsConfig.textAnchor = "start";
1062
- }
869
+ const modifiedDataLabelsConfig = __spreadProps(__spreadValues({}, dataLabelsConfig), {
870
+ textAnchor: anchor
871
+ });
872
+ if (this.barCtx.isHorizontal && val < 0) {
873
+ if (anchor === "start") {
874
+ modifiedDataLabelsConfig.textAnchor = "end";
875
+ } else if (anchor === "end") {
876
+ modifiedDataLabelsConfig.textAnchor = "start";
1063
877
  }
1064
878
  }
1065
879
  dataLabels.plotDataLabelsText({
@@ -1111,7 +925,7 @@ class BarDataLabels {
1111
925
  const { groupIndex } = this.barCtx.barHelpers.getGroupIndex(realIndex);
1112
926
  totalDataLabelText.node.setAttribute(
1113
927
  "data:dlTotalKey",
1114
- `${groupIndex}::${datumKey(this.w, realIndex, j)}`
928
+ `${groupIndex}::${this.barCtx._keys(realIndex)[j]}`
1115
929
  );
1116
930
  totalDataLabelText.node.setAttribute(
1117
931
  "data:dlTotalSeries",
@@ -1127,6 +941,7 @@ class BarDataLabels {
1127
941
  }
1128
942
  const Series = _core.__apex_Series;
1129
943
  const Fill = _core.__apex_Fill;
944
+ const CoreUtils = _core.__apex_CoreUtils;
1130
945
  function isHistogramOverlay(w) {
1131
946
  var _a, _b, _c, _d, _e, _f, _g;
1132
947
  if (((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.chart) == null ? void 0 : _b.requestedType) !== "histogram") return false;
@@ -1143,9 +958,11 @@ class Helpers {
1143
958
  }
1144
959
  /**
1145
960
  * @param {any[]} series
961
+ * @param {any} [seriesIndex] a combo's real indices of `series`
1146
962
  */
1147
- initVariables(series) {
963
+ initVariables(series, seriesIndex) {
1148
964
  const w = this.w;
965
+ this.seriesIndex = seriesIndex;
1149
966
  this.barCtx.series = series;
1150
967
  this.barCtx.totalItems = 0;
1151
968
  this.barCtx.seriesLen = 0;
@@ -1166,6 +983,8 @@ class Helpers {
1166
983
  this.barCtx.visibleItems = w.globals.dataPoints;
1167
984
  }
1168
985
  }
986
+ const labels = w.labelData.labels;
987
+ this.rows = w.globals.isBarHorizontal && w.axisFlags.isXNumeric && !this.barCtx.isRangeBar && w.seriesData.seriesX.some((s) => s == null ? void 0 : s.some((x, j) => x !== labels[j])) ? new Map(labels.map((x, r) => [x, r])) : null;
1169
988
  this.arrBorderRadius = this.createBorderRadiusArr(w.seriesData.series);
1170
989
  if (Utils.isSafari()) {
1171
990
  this.arrBorderRadius = this.arrBorderRadius.map(
@@ -1230,15 +1049,19 @@ class Helpers {
1230
1049
  * Collapsed series count too, exactly as they did for `minXDiff`. Skipping
1231
1050
  * them would widen every bar the moment someone hid the tightest-spaced
1232
1051
  * series from the legend, so bar geometry would depend on legend state.
1052
+ * In a combo only this renderer's own series count: a line's x values say
1053
+ * nothing about how wide a column may be.
1233
1054
  *
1234
1055
  * @returns {number}
1235
1056
  */
1236
1057
  _unionMinXGap() {
1237
1058
  const w = this.w;
1238
1059
  const seriesX = w.seriesData.seriesX || [];
1060
+ const own = this.seriesIndex;
1239
1061
  const arrays = [];
1240
1062
  for (let i = 0; i < seriesX.length; i++) {
1241
1063
  const xs = seriesX[i];
1064
+ if (own && own.indexOf(i) < 0) continue;
1242
1065
  if (Array.isArray(xs) && xs.length > 0) {
1243
1066
  arrays.push(
1244
1067
  xs.some((v, n) => v < xs[n - 1]) ? xs.filter((v) => v === +v).sort((a, b) => a - b) : xs
@@ -1279,6 +1102,15 @@ class Helpers {
1279
1102
  }
1280
1103
  return isFinite(min) ? min : 0;
1281
1104
  }
1105
+ /**
1106
+ * The band a horizontal bar is drawn in: its x's band when the series do
1107
+ * not line up by index (see initVariables), else its index.
1108
+ * @param {number} realIndex @param {number} j
1109
+ */
1110
+ barRow(realIndex, j) {
1111
+ var _a, _b, _c;
1112
+ return (_c = (_b = this.rows) == null ? void 0 : _b.get((_a = this.w.seriesData.seriesX[realIndex]) == null ? void 0 : _a[j])) != null ? _c : j;
1113
+ }
1282
1114
  /**
1283
1115
  * @param {number} realIndex
1284
1116
  */
@@ -1401,7 +1233,7 @@ class Helpers {
1401
1233
  });
1402
1234
  }
1403
1235
  const connectorFill = this.getDumbbellConnectorFill(i, j);
1404
- const datumFill = connectorFill || ((_a = w.config.series[i].data[j]) == null ? void 0 : _a.fill);
1236
+ const datumFill = connectorFill || ((_a = w.config.series[realIndex].data[j]) == null ? void 0 : _a.fill);
1405
1237
  const connector = this.barCtx.barOptions.isDumbbell ? w.config.plotOptions.bar.dumbbell.connector : null;
1406
1238
  let connectorOpacity;
1407
1239
  if (connector && connector.color) {
@@ -1554,11 +1386,10 @@ class Helpers {
1554
1386
  * @returns {string[][]}
1555
1387
  */
1556
1388
  createBorderRadiusArr(series) {
1557
- var _a;
1558
1389
  const w = this.w;
1559
1390
  const alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0;
1560
1391
  const numSeries = series.length;
1561
- const numColumns = ((_a = series[0]) == null ? void 0 : _a.length) | 0;
1392
+ const numColumns = Math.max(0, ...series.map((s) => (s == null ? void 0 : s.length) | 0));
1562
1393
  const output = Array.from(
1563
1394
  { length: numSeries },
1564
1395
  () => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
@@ -1714,7 +1545,7 @@ class Helpers {
1714
1545
  j,
1715
1546
  w
1716
1547
  }) {
1717
- var _a, _b;
1548
+ var _a, _b, _c;
1718
1549
  const r = this.barRect({
1719
1550
  a: barXPosition,
1720
1551
  len: barWidth,
@@ -1745,7 +1576,7 @@ class Helpers {
1745
1576
  const _ctx = this.barCtx.groupCtx;
1746
1577
  _ctx.yArrj.push(y2 - strokeCenter * direction);
1747
1578
  _ctx.yArrjF.push(Math.abs(y1 - y2 + r.strokeWidth * direction));
1748
- _ctx.yArrjVal.push(this.barCtx.series[i][j]);
1579
+ _ctx.yArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
1749
1580
  }
1750
1581
  return {
1751
1582
  pathTo,
@@ -1935,7 +1766,7 @@ class Helpers {
1935
1766
  j,
1936
1767
  w
1937
1768
  }) {
1938
- var _a, _b;
1769
+ var _a, _b, _c;
1939
1770
  const graphics = new Graphics(this.barCtx.w);
1940
1771
  const r = this.barRect({
1941
1772
  a: barYPosition,
@@ -1971,7 +1802,7 @@ class Helpers {
1971
1802
  const _ctx = this.barCtx.groupCtx;
1972
1803
  _ctx.xArrj.push(x2 + strokeCenter * direction);
1973
1804
  _ctx.xArrjF.push(Math.abs(x1 - x2 - r.strokeWidth * direction));
1974
- _ctx.xArrjVal.push(this.barCtx.series[i][j]);
1805
+ _ctx.xArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
1975
1806
  }
1976
1807
  return {
1977
1808
  pathTo,
@@ -2016,6 +1847,9 @@ class Helpers {
2016
1847
  const w = this.w;
2017
1848
  const goals = [];
2018
1849
  const pushGoal = (value, attrs) => {
1850
+ if (!w.globals.invalidLogScale) {
1851
+ value = new CoreUtils(w).getLogValAtSeriesIndex(value, i);
1852
+ }
2019
1853
  goals.push({
2020
1854
  [type]: type === "x" ? this.getXForValue(value, zeroW, false) : this.getYForValue(value, zeroH, translationsIndex, false),
2021
1855
  attrs
@@ -2270,11 +2104,11 @@ class Helpers {
2270
2104
  let zeroEncounters = 0;
2271
2105
  const seriesIndices = w.config.plotOptions.bar.horizontal ? w.seriesData.series.map((_, _i) => _i) : ((_a = w.globals.columnSeries) == null ? void 0 : _a.i.map((_i) => _i)) || [];
2272
2106
  seriesIndices.forEach((_si) => {
2273
- const val = w.globals.seriesPercent[_si][j];
2107
+ const val = w.seriesData.series[_si][j];
2274
2108
  if (val) {
2275
2109
  nonZeroColumns++;
2276
2110
  }
2277
- if (_si < i && val === 0) {
2111
+ if (_si < i && !val) {
2278
2112
  zeroEncounters++;
2279
2113
  }
2280
2114
  });
@@ -2311,8 +2145,187 @@ class Helpers {
2311
2145
  return { groupIndex, columnGroupIndex };
2312
2146
  }
2313
2147
  }
2314
- const CoreUtils = _core.__apex_CoreUtils;
2315
2148
  const Filters = _core.__apex_Filters;
2149
+ const Animations = _core.__apex_Animations;
2150
+ const computeStagger = _core.__apex_Animations_computeStagger;
2151
+ const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
2152
+ const Environment = _core.__apex_Environment_Environment;
2153
+ function lengthTransitionEnabled(w) {
2154
+ var _a;
2155
+ const anim = w.config.chart.animations;
2156
+ if (!anim || anim.enabled === false) return false;
2157
+ if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
2158
+ return false;
2159
+ }
2160
+ const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
2161
+ if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
2162
+ return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
2163
+ }
2164
+ function datumKey(w, realIndex, j) {
2165
+ var _a, _b, _c, _d;
2166
+ if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
2167
+ const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
2168
+ if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
2169
+ }
2170
+ const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
2171
+ if (lbl != null && String(lbl) !== "") {
2172
+ return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
2173
+ }
2174
+ return "j:" + j;
2175
+ }
2176
+ function frameDatumKey(frame, realIndex, j) {
2177
+ var _a, _b;
2178
+ if (frame.isXNumeric) {
2179
+ const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
2180
+ if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
2181
+ }
2182
+ const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
2183
+ if (lbl != null && String(lbl) !== "") {
2184
+ return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
2185
+ }
2186
+ return "j:" + j;
2187
+ }
2188
+ function joinKeys(oldKeys, newKeys) {
2189
+ const oldIndex = /* @__PURE__ */ new Map();
2190
+ oldKeys.forEach((k, i) => {
2191
+ if (!oldIndex.has(k)) oldIndex.set(k, i);
2192
+ });
2193
+ const toOld = new Array(newKeys.length);
2194
+ const usedOld = /* @__PURE__ */ new Set();
2195
+ let prev = -1;
2196
+ let ordered = true;
2197
+ let identity = oldKeys.length === newKeys.length;
2198
+ newKeys.forEach((k, i) => {
2199
+ const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
2200
+ toOld[i] = oi;
2201
+ if (oi !== -1) {
2202
+ usedOld.add(oi);
2203
+ if (oi < prev) ordered = false;
2204
+ prev = oi;
2205
+ }
2206
+ if (oi !== i) identity = false;
2207
+ });
2208
+ const exits = [];
2209
+ for (let i = 0; i < oldKeys.length; i++) {
2210
+ if (!usedOld.has(i)) exits.push(i);
2211
+ }
2212
+ return { toOld, exits, ordered, changed: !identity };
2213
+ }
2214
+ function uniquifyKeys(keys) {
2215
+ const seen = /* @__PURE__ */ new Map();
2216
+ return keys.map((k) => {
2217
+ const count = seen.get(k) || 0;
2218
+ seen.set(k, count + 1);
2219
+ return count === 0 ? k : `${k}#${count}`;
2220
+ });
2221
+ }
2222
+ function seriesKeys(w, realIndex, n = ((_a) => (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length)() | 0) {
2223
+ return uniquifyKeys(
2224
+ Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j))
2225
+ );
2226
+ }
2227
+ function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
2228
+ var _a, _b;
2229
+ if (!lengthTransitionEnabled(w)) return null;
2230
+ const frame = w.globals.prevStreamFrame;
2231
+ if (!frame) return null;
2232
+ const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
2233
+ const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
2234
+ if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
2235
+ if (!oldY.length || !newY.length) return null;
2236
+ const oldKeys = uniquifyKeys(
2237
+ oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
2238
+ );
2239
+ const newKeys = seriesKeys(w, realIndex);
2240
+ const join = joinKeys(oldKeys, newKeys);
2241
+ if (!join.ordered && !allowReorder) return null;
2242
+ if (!join.changed && !includeIdentity) return null;
2243
+ return { join, oldKeys, newKeys };
2244
+ }
2245
+ function firstMove(d) {
2246
+ const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
2247
+ if (!m) return null;
2248
+ const x = parseFloat(m[1]);
2249
+ const y = parseFloat(m[2]);
2250
+ return isFinite(x) && isFinite(y) ? { x, y } : null;
2251
+ }
2252
+ function renderBarExitGhosts({
2253
+ w,
2254
+ elSeries,
2255
+ record,
2256
+ newKeys,
2257
+ isHorizontal,
2258
+ speed
2259
+ }) {
2260
+ var _a;
2261
+ if (!lengthTransitionEnabled(w)) return;
2262
+ if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
2263
+ const newKeySet = new Set(newKeys);
2264
+ const exits = record.paths.filter(
2265
+ (p) => p && p.d && p.key != null && !newKeySet.has(p.key)
2266
+ );
2267
+ if (!exits.length) return;
2268
+ const graphics = new Graphics(w);
2269
+ const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
2270
+ exits.forEach((p) => {
2271
+ let fill = p.fill || fallbackFill || "#c8c8c8";
2272
+ if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
2273
+ const ghost = graphics.drawPath({
2274
+ d: p.d,
2275
+ stroke: "none",
2276
+ strokeWidth: 0,
2277
+ fill,
2278
+ fillOpacity: 1,
2279
+ classes: "apexcharts-bar-ghost"
2280
+ });
2281
+ const node = ghost.node;
2282
+ node.setAttribute("pointer-events", "none");
2283
+ ghost.attr(
2284
+ "clip-path",
2285
+ `url(#gridRectBarMask${w.globals.cuid})`
2286
+ );
2287
+ elSeries.node.insertBefore(node, elSeries.node.firstChild);
2288
+ const start = firstMove(p.d);
2289
+ let origin = isHorizontal ? "left center" : "center bottom";
2290
+ try {
2291
+ const bb = node.getBBox();
2292
+ if (start && bb) {
2293
+ if (isHorizontal) {
2294
+ origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
2295
+ } else {
2296
+ origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
2297
+ }
2298
+ }
2299
+ } catch (_) {
2300
+ }
2301
+ const style = node.style;
2302
+ style.transformBox = "fill-box";
2303
+ style.transformOrigin = origin;
2304
+ node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
2305
+ try {
2306
+ const bb = node.getBBox();
2307
+ const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
2308
+ if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
2309
+ } catch (_) {
2310
+ }
2311
+ const duration = Math.max(1, speed || 1);
2312
+ const startAt = performance.now();
2313
+ const step = (now) => {
2314
+ if (w.globals.isDestroyed || !node.parentNode) return;
2315
+ const t = Math.max(0, Math.min(1, (now - startAt) / duration));
2316
+ const eased = 1 - Math.pow(1 - t, 3);
2317
+ const scale = 1 - eased;
2318
+ style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
2319
+ style.opacity = String(1 - eased);
2320
+ if (t < 1) {
2321
+ BrowserAPIs.requestAnimationFrame(step);
2322
+ } else {
2323
+ node.parentNode.removeChild(node);
2324
+ }
2325
+ };
2326
+ BrowserAPIs.requestAnimationFrame(step);
2327
+ });
2328
+ }
2316
2329
  class AxisMapping {
2317
2330
  /**
2318
2331
  * Pixels per data-unit on the x-axis. Derived from `minX..maxX` so it is the
@@ -2431,15 +2444,17 @@ class Bar {
2431
2444
  /**
2432
2445
  * Point the per-series axis state at this series' y axis. Every bar-family
2433
2446
  * renderer calls it before initialPositions, which reads the baseline by
2434
- * this.translationsIndex.
2447
+ * this.translationsIndex and flips it for a reversed axis.
2435
2448
  * @param {number} realIndex
2436
2449
  * @return {number} translationsIndex
2437
2450
  */
2438
2451
  setSeriesAxis(realIndex) {
2452
+ var _a;
2439
2453
  if (this.yRatio.length > 1) {
2440
2454
  this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
2441
2455
  this.translationsIndex = realIndex;
2442
2456
  }
2457
+ this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
2443
2458
  return this.translationsIndex;
2444
2459
  }
2445
2460
  /** primary draw method which is called on bar object
@@ -2456,7 +2471,7 @@ class Bar {
2456
2471
  series = coreUtils.getLogSeries(series);
2457
2472
  this.series = series;
2458
2473
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
2459
- this.barHelpers.initVariables(series);
2474
+ this.barHelpers.initVariables(series, seriesIndex);
2460
2475
  const ret = graphics.group({
2461
2476
  class: "apexcharts-bar-series apexcharts-plot-series"
2462
2477
  });
@@ -2488,7 +2503,6 @@ class Bar {
2488
2503
  this.visibleI = this.visibleI + 1;
2489
2504
  }
2490
2505
  const translationsIndex = this.setSeriesAxis(realIndex);
2491
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
2492
2506
  if (this.isPyramid) {
2493
2507
  this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
2494
2508
  }
@@ -2566,7 +2580,9 @@ class Bar {
2566
2580
  elSeries
2567
2581
  };
2568
2582
  if (this.isHorizontal) {
2569
- paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
2583
+ paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
2584
+ y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
2585
+ }), {
2570
2586
  barHeight,
2571
2587
  zeroW,
2572
2588
  yDivision
@@ -2648,6 +2664,7 @@ class Bar {
2648
2664
  series,
2649
2665
  barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
2650
2666
  barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
2667
+ barXPosition: paths.barXPosition,
2651
2668
  elDataLabelsWrap,
2652
2669
  elGoalsMarkers,
2653
2670
  elBarShadows,
@@ -2658,15 +2675,11 @@ class Bar {
2658
2675
  w.globals.seriesXvalues[realIndex] = xArrj;
2659
2676
  w.globals.seriesYvalues[realIndex] = yArrj;
2660
2677
  if (w.globals.previousPaths.length > 0) {
2661
- const newKeys = [];
2662
- for (let j = 0; j < series[i].length; j++) {
2663
- newKeys.push(datumKey(w, realIndex, j));
2664
- }
2665
2678
  renderBarExitGhosts({
2666
2679
  w,
2667
2680
  elSeries,
2668
2681
  record: this._prevRecord(realIndex),
2669
- newKeys,
2682
+ newKeys: this._keys(realIndex),
2670
2683
  isHorizontal: this.isHorizontal,
2671
2684
  speed: w.config.chart.animations.dynamicAnimation.speed
2672
2685
  });
@@ -2675,7 +2688,7 @@ class Bar {
2675
2688
  }
2676
2689
  return ret;
2677
2690
  }
2678
- /** @param {{ hl?: any, realIndex?: any, pathFill?: any, lineFill?: any, j?: any, i?: any, columnGroupIndex?: any, pathFrom?: any, pathTo?: any, strokeWidth?: any, elSeries?: any, x?: any, y?: any, y1?: any, y2?: any, series?: any, barHeight?: any, barWidth?: any, barXPosition?: any, barYPosition?: any, elDataLabelsWrap?: any, elGoalsMarkers?: any, elBarShadows?: any, visibleSeries?: any, type?: any, classes?: any, fadeReveal?: boolean }} opts */
2691
+ /** @param {{ hl?: any, realIndex?: any, pathFill?: any, lineFill?: any, j?: any, i?: any, columnGroupIndex?: any, pathFrom?: any, pathTo?: any, strokeWidth?: any, elSeries?: any, x?: any, y?: any, y1?: any, y2?: any, series?: any, barHeight?: any, barWidth?: any, barXPosition?: any, barYPosition?: any, elDataLabelsWrap?: any, elGoalsMarkers?: any, elBarShadows?: any, visibleSeries?: any, type?: any, classes?: any, fadeReveal?: boolean, noLabel?: boolean }} opts */
2679
2692
  renderSeries({
2680
2693
  hl,
2681
2694
  realIndex,
@@ -2707,7 +2720,9 @@ class Bar {
2707
2720
  visibleSeries,
2708
2721
  type,
2709
2722
  classes,
2710
- fadeReveal = false
2723
+ fadeReveal = false,
2724
+ noLabel
2725
+ // a datum's extra paths (box halves, box lane) label nothing
2711
2726
  }) {
2712
2727
  var _a, _b, _c, _d, _e, _f, _g;
2713
2728
  const w = this.w;
@@ -2781,7 +2796,8 @@ class Bar {
2781
2796
  barXPosition,
2782
2797
  barYPosition,
2783
2798
  visibleSeries,
2784
- hl: hl == null ? void 0 : hl.label
2799
+ hl: hl == null ? void 0 : hl.label,
2800
+ noLabel
2785
2801
  })
2786
2802
  );
2787
2803
  if (delayMs > 0) {
@@ -2797,19 +2813,18 @@ class Bar {
2797
2813
  }
2798
2814
  let leaving = false;
2799
2815
  if (!w.globals.isBarHorizontal) {
2800
- if (dataLabelsObj.dataLabelsPos.dataLabelsX + Math.max(barWidth, w.globals.barPadForNumericAxis) < 0 || dataLabelsObj.dataLabelsPos.dataLabelsX - Math.max(barWidth, w.globals.barPadForNumericAxis) > w.layout.gridWidth) {
2816
+ const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
2817
+ const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
2818
+ if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
2801
2819
  if (this._wasOnScreen(realIndex, j)) leaving = true;
2802
2820
  else skipDrawing = true;
2803
2821
  }
2804
2822
  }
2805
- if (
2806
- /** @type {Record<string,any>} */
2807
- w.config.series[i].data[j] && /** @type {Record<string,any>} */
2808
- w.config.series[i].data[j].strokeColor
2809
- ) {
2810
- lineFill = /** @type {Record<string,any>} */
2811
- w.config.series[i].data[j].strokeColor;
2812
- }
2823
+ const datum = (
2824
+ /** @type {any} */
2825
+ w.config.series[realIndex].data[j]
2826
+ );
2827
+ if (datum && datum.strokeColor) lineFill = datum.strokeColor;
2813
2828
  const fill = pathFill;
2814
2829
  if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
2815
2830
  pathFill = "none";
@@ -2832,7 +2847,7 @@ class Bar {
2832
2847
  pathTo,
2833
2848
  stroke: lineFill,
2834
2849
  strokeWidth,
2835
- strokeLineCap: w.config.stroke.lineCap,
2850
+ strokeLinecap: w.config.stroke.lineCap,
2836
2851
  fill: pathFill,
2837
2852
  pathToInterp,
2838
2853
  animationDelay: delay,
@@ -2884,12 +2899,12 @@ class Bar {
2884
2899
  cy: dataLabelsObj.dataLabelsPos.bcy,
2885
2900
  cx: dataLabelsObj.dataLabelsPos.bcx,
2886
2901
  j,
2887
- val: w.seriesData.series[i][j],
2902
+ val: w.seriesData.series[realIndex][j],
2888
2903
  barHeight,
2889
2904
  barWidth,
2890
2905
  // Datum identity for the next update's keyed join (see
2891
2906
  // LengthTransition): survivors match by key, not array position.
2892
- "data:pathKey": datumKey(w, realIndex, j)
2907
+ "data:pathKey": this._keys(realIndex)[j]
2893
2908
  });
2894
2909
  hl == null ? void 0 : hl.paint(renderedPath, {
2895
2910
  delay,
@@ -2965,7 +2980,10 @@ class Bar {
2965
2980
  const j = indexes.j;
2966
2981
  let barYPosition;
2967
2982
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
2968
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
2983
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
2984
+ i: indexes.realIndex,
2985
+ j
2986
+ });
2969
2987
  if (nonZeroColumns > 0) {
2970
2988
  barHeight = this.seriesLen * barHeight / nonZeroColumns;
2971
2989
  }
@@ -3104,7 +3122,7 @@ class Bar {
3104
3122
  barXPosition = xForNumericX.barXPosition;
3105
3123
  } else {
3106
3124
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
3107
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
3125
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
3108
3126
  if (nonZeroColumns > 0) {
3109
3127
  barWidth = this.seriesLen * barWidth / nonZeroColumns;
3110
3128
  }
@@ -3168,15 +3186,16 @@ class Bar {
3168
3186
  /** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
3169
3187
  getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
3170
3188
  const w = this.w;
3189
+ const overlay = isHistogramOverlay(w);
3171
3190
  let sxI = realIndex;
3172
3191
  if (!w.seriesData.seriesX[realIndex].length) {
3173
3192
  sxI = w.globals.maxValsInArrayIndex;
3174
3193
  }
3175
3194
  if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
3176
- x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
3195
+ x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
3177
3196
  }
3178
3197
  return {
3179
- barXPosition: x + (isHistogramOverlay(w) ? 0 : barWidth * this.visibleI),
3198
+ barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
3180
3199
  x
3181
3200
  };
3182
3201
  }
@@ -3197,7 +3216,20 @@ class Bar {
3197
3216
  _wasOnScreen(realIndex, j) {
3198
3217
  if (!lengthTransitionEnabled(this.w)) return false;
3199
3218
  const keyed = this._prevKeyedPaths(realIndex);
3200
- return !!keyed && keyed.has(datumKey(this.w, realIndex, j));
3219
+ return !!keyed && keyed.has(this._keys(realIndex)[j]);
3220
+ }
3221
+ /**
3222
+ * This render's datum keys for a series (see seriesKeys), as stamped on
3223
+ * each bar and looked up in the previous render's.
3224
+ * @param {number} realIndex
3225
+ * @returns {string[]}
3226
+ */
3227
+ _keys(realIndex) {
3228
+ const c = (
3229
+ /** @type {any} */
3230
+ this._keyCache || (this._keyCache = {})
3231
+ );
3232
+ return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
3201
3233
  }
3202
3234
  /**
3203
3235
  * The captured previous-render record for a series (last match wins, same
@@ -3253,7 +3285,7 @@ class Bar {
3253
3285
  * @returns {boolean}
3254
3286
  */
3255
3287
  isLengthTransition(realIndex) {
3256
- var _a, _b;
3288
+ var _a, _b, _c, _d, _e, _f;
3257
3289
  if (!this._ltCache) this._ltCache = {};
3258
3290
  if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
3259
3291
  const w = this.w;
@@ -3261,20 +3293,14 @@ class Bar {
3261
3293
  if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
3262
3294
  const record = this._prevRecord(realIndex);
3263
3295
  const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
3296
+ const keyed = record && this._prevKeyedPaths(realIndex);
3264
3297
  if (!record) {
3265
3298
  result = dataLen > 0;
3266
- } else if (record.paths.length !== dataLen) {
3267
- result = true;
3299
+ } else if (keyed) {
3300
+ const now = new Set(this._keys(realIndex));
3301
+ result = ((_f = (_e = (_d = (_c = w.globals.prevStreamFrame) == null ? void 0 : _c.seriesY) == null ? void 0 : _d[realIndex]) == null ? void 0 : _e.length) != null ? _f : dataLen) !== dataLen || [...keyed.keys()].some((k) => !now.has(k));
3268
3302
  } else {
3269
- const keyed = this._prevKeyedPaths(realIndex);
3270
- if (keyed) {
3271
- for (let j = 0; j < dataLen; j++) {
3272
- if (!keyed.has(datumKey(w, realIndex, j))) {
3273
- result = true;
3274
- break;
3275
- }
3276
- }
3277
- }
3303
+ result = record.paths.length !== dataLen;
3278
3304
  }
3279
3305
  }
3280
3306
  this._ltCache[realIndex] = result;
@@ -3334,7 +3360,7 @@ class Bar {
3334
3360
  let isNewDatum = false;
3335
3361
  const keyed = this._prevKeyedPaths(realIndex);
3336
3362
  if (keyed) {
3337
- const prev = keyed.get(datumKey(w, realIndex, j));
3363
+ const prev = keyed.get(this._keys(realIndex)[j]);
3338
3364
  if (prev) {
3339
3365
  oldD = prev.d;
3340
3366
  } else {
@@ -3477,11 +3503,10 @@ class Bar {
3477
3503
  * @returns {boolean | null} null when there is no previous record to consult
3478
3504
  */
3479
3505
  getPreviousFlip(realIndex, j) {
3480
- const w = this.w;
3481
3506
  const record = this._prevRecord(realIndex);
3482
3507
  if (!record) return null;
3483
3508
  const keyed = this._prevKeyedPaths(realIndex);
3484
- const prev = keyed ? keyed.get(datumKey(w, realIndex, j)) : record.paths[j];
3509
+ const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
3485
3510
  return prev ? !!prev.flip : null;
3486
3511
  }
3487
3512
  /**
@@ -3508,7 +3533,7 @@ class BarStacked extends Bar {
3508
3533
  const coreUtils = new CoreUtils(this.w);
3509
3534
  series = coreUtils.getLogSeries(series);
3510
3535
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
3511
- this.barHelpers.initVariables(series);
3536
+ this.barHelpers.initVariables(series, seriesIndex);
3512
3537
  if (w.config.chart.stackType === "100%") {
3513
3538
  series = w.globals.comboCharts ? (
3514
3539
  /** @type {any} */
@@ -3539,7 +3564,6 @@ class BarStacked extends Bar {
3539
3564
  const xArrValues = [];
3540
3565
  const yArrValues = [];
3541
3566
  const translationsIndex = this.setSeriesAxis(realIndex);
3542
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
3543
3567
  let elSeries = this.graphics.group({
3544
3568
  class: `apexcharts-series`,
3545
3569
  seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
@@ -3609,7 +3633,9 @@ class BarStacked extends Bar {
3609
3633
  null
3610
3634
  );
3611
3635
  if (this.isHorizontal) {
3612
- paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
3636
+ paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
3637
+ y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
3638
+ }), {
3613
3639
  zeroW,
3614
3640
  barHeight,
3615
3641
  yDivision
@@ -3683,6 +3709,7 @@ class BarStacked extends Bar {
3683
3709
  series,
3684
3710
  barHeight,
3685
3711
  barWidth,
3712
+ barXPosition: paths.barXPosition,
3686
3713
  elDataLabelsWrap,
3687
3714
  elGoalsMarkers,
3688
3715
  type: "bar",
@@ -3700,7 +3727,7 @@ class BarStacked extends Bar {
3700
3727
  this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
3701
3728
  ret.add(elSeries);
3702
3729
  }
3703
- if (heldMirrors) this.settleHeldMirrors();
3730
+ if (heldMirrors) this.settleHeldMirrors(ret);
3704
3731
  return ret;
3705
3732
  }
3706
3733
  /**
@@ -3721,15 +3748,21 @@ class BarStacked extends Bar {
3721
3748
  * 'bottom' → 'top', where the endpoint really is rounded at the other end;
3722
3749
  * everywhere else the mirror is an exact identity on the settled shape, so
3723
3750
  * removing it changes nothing on screen.
3751
+ *
3752
+ * The marks are collected now, not when the timer fires: a query then also
3753
+ * stripped the mirrors a LATER update was still holding mid-tween.
3754
+ * @param {any} [ret] this draw's series group (default: the whole chart)
3724
3755
  */
3725
- settleHeldMirrors() {
3756
+ settleHeldMirrors(ret) {
3726
3757
  const w = this.w;
3727
3758
  if (!Environment.isBrowser()) return;
3728
3759
  const anim = w.config.chart.animations;
3729
3760
  const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
3761
+ const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
3762
+ ".apexcharts-flip-held"
3763
+ );
3730
3764
  setTimeout(() => {
3731
- if (w.globals.isDestroyed || !Utils.elementExists(w.dom.baseEl)) return;
3732
- w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
3765
+ held.forEach((el) => {
3733
3766
  el.classList.remove(
3734
3767
  "apexcharts-flip-held",
3735
3768
  "apexcharts-flip-y",
@@ -3805,7 +3838,7 @@ class BarStacked extends Bar {
3805
3838
  yDivision,
3806
3839
  elSeries
3807
3840
  }) {
3808
- var _a, _b, _c, _d, _e;
3841
+ var _a, _b;
3809
3842
  const w = this.w;
3810
3843
  const barYPosition = y + columnGroupIndex * barHeight;
3811
3844
  let barXPosition;
@@ -3813,36 +3846,21 @@ class BarStacked extends Bar {
3813
3846
  const j = indexes.j;
3814
3847
  const realIndex = indexes.realIndex;
3815
3848
  const translationsIndex = indexes.translationsIndex;
3816
- let prevBarW = 0;
3817
- for (let k = 0; k < this.groupCtx.prevXF.length; k++) {
3818
- prevBarW = prevBarW + this.groupCtx.prevXF[k][j];
3819
- }
3820
- const gsi = this.groupCtx.prevX.length;
3821
- if (gsi > 0) {
3822
- let bXP = zeroW;
3823
- if (this.groupCtx.prevXVal[gsi - 1][j] < 0) {
3824
- bXP = /** @type {any} */
3825
- ((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? this.groupCtx.prevX[gsi - 1][j] + prevBarW - (this.isReversed ? prevBarW : 0) * 2 : this.groupCtx.prevX[gsi - 1][j];
3826
- } else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) {
3827
- bXP = /** @type {any} */
3828
- ((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? this.groupCtx.prevX[gsi - 1][j] : this.groupCtx.prevX[gsi - 1][j] - prevBarW + (this.isReversed ? prevBarW : 0) * 2;
3829
- }
3830
- barXPosition = bXP;
3831
- } else {
3832
- barXPosition = zeroW;
3833
- }
3834
- if (
3849
+ const v = (
3835
3850
  /** @type {any} */
3836
- ((_c = this.series[i]) == null ? void 0 : _c[j]) === null
3837
- ) {
3838
- x = barXPosition;
3851
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
3852
+ );
3853
+ const g = this.groupCtx;
3854
+ const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
3855
+ const top = g.tops.get(key);
3856
+ if (top) {
3857
+ const [prevX, prevVal, prevBarW] = top;
3858
+ const flip = (this.isReversed ? prevBarW : 0) * 2;
3859
+ barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
3839
3860
  } else {
3840
- x = barXPosition + /** @type {any} */
3841
- ((_d = this.series[i]) == null ? void 0 : _d[j]) / this.invertedYRatio - (this.isReversed ? (
3842
- /** @type {any} */
3843
- ((_e = this.series[i]) == null ? void 0 : _e[j]) / this.invertedYRatio
3844
- ) : 0) * 2;
3861
+ barXPosition = zeroW;
3845
3862
  }
3863
+ x = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
3846
3864
  const paths = this.barHelpers.getBarpaths({
3847
3865
  barYPosition,
3848
3866
  barHeight,
@@ -3856,6 +3874,7 @@ class BarStacked extends Bar {
3856
3874
  j,
3857
3875
  w
3858
3876
  });
3877
+ this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
3859
3878
  this.barHelpers.barBackground({
3860
3879
  j,
3861
3880
  i,
@@ -3893,13 +3912,17 @@ class BarStacked extends Bar {
3893
3912
  columnGroupIndex,
3894
3913
  elSeries
3895
3914
  }) {
3896
- var _a, _b, _c, _d, _e, _f;
3915
+ var _a, _b, _c;
3897
3916
  const w = this.w;
3898
3917
  const i = indexes.i;
3899
3918
  const j = indexes.j;
3900
3919
  const bc = indexes.bc;
3901
3920
  const realIndex = indexes.realIndex;
3902
3921
  const translationsIndex = indexes.translationsIndex;
3922
+ const v = (
3923
+ /** @type {any} */
3924
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
3925
+ );
3903
3926
  if (w.axisFlags.isXNumeric) {
3904
3927
  let seriesVal = w.seriesData.seriesX[realIndex][j];
3905
3928
  if (!seriesVal) seriesVal = 0;
@@ -3914,11 +3937,9 @@ class BarStacked extends Bar {
3914
3937
  const [prevYValue, prevVal, prevBarH] = top;
3915
3938
  let bYP;
3916
3939
  if (prevVal < 0) {
3917
- bYP = /** @type {any} */
3918
- ((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
3940
+ bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
3919
3941
  } else if (prevVal >= 0) {
3920
- bYP = /** @type {any} */
3921
- ((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
3942
+ bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
3922
3943
  }
3923
3944
  if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
3924
3945
  if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
@@ -3931,25 +3952,16 @@ class BarStacked extends Bar {
3931
3952
  } else {
3932
3953
  barYPosition = zeroH;
3933
3954
  }
3934
- if (
3935
- /** @type {any} */
3936
- (_d = this.series[i]) == null ? void 0 : _d[j]
3937
- ) {
3938
- y = barYPosition - /** @type {any} */
3939
- ((_e = this.series[i]) == null ? void 0 : _e[j]) / this.yRatio[translationsIndex] + (this.isReversed ? (
3940
- /** @type {any} */
3941
- ((_f = this.series[i]) == null ? void 0 : _f[j]) / this.yRatio[translationsIndex]
3942
- ) : 0) * 2;
3943
- } else {
3944
- y = barYPosition;
3945
- }
3955
+ y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
3946
3956
  const paths = this.barHelpers.getColumnPaths({
3947
3957
  barXPosition,
3948
3958
  barWidth,
3949
3959
  y1: barYPosition,
3950
3960
  y2: y,
3951
3961
  yRatio: this.yRatio[translationsIndex],
3952
- strokeWidth: this.strokeWidth,
3962
+ // the series' width even for an empty segment, so a hidden layer keeps
3963
+ // its place, but no inset at all when no stroke is drawn
3964
+ strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
3953
3965
  isReversed: this.isReversed,
3954
3966
  series: this.series,
3955
3967
  realIndex: indexes.realIndex,
@@ -3957,17 +3969,7 @@ class BarStacked extends Bar {
3957
3969
  j,
3958
3970
  w
3959
3971
  });
3960
- const t = g.yArrj[j];
3961
- if (!isNaN(t)) {
3962
- g.tops.set(key, [
3963
- t,
3964
- g.yArrjVal[j],
3965
- (top ? top[2] : 0) + g.yArrjF[j],
3966
- (top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
3967
- top ? Math.min(top[0], top[4]) : 1 / 0,
3968
- top ? Math.max(top[0], top[5]) : -1 / 0
3969
- ]);
3970
- }
3972
+ this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
3971
3973
  this.barHelpers.barBackground({
3972
3974
  bc,
3973
3975
  j,
@@ -3986,13 +3988,32 @@ class BarStacked extends Bar {
3986
3988
  zeroH,
3987
3989
  realIndex,
3988
3990
  j,
3989
- 0
3991
+ translationsIndex
3990
3992
  ),
3991
3993
  barXPosition,
3992
3994
  x: w.axisFlags.isXNumeric ? x : x + xDivision,
3993
3995
  y
3994
3996
  };
3995
3997
  }
3998
+ /**
3999
+ * Record the segment just drawn as the top of its stack. Per key it holds
4000
+ * the top and value of the last segment drawn there, the summed lengths and
4001
+ * raw values of every segment so far (the total label's value), and the
4002
+ * extreme tops below that segment (the total label's position).
4003
+ * @param {any} key @param {any} top @param {number} t @param {any} val
4004
+ * @param {number} len @param {number} realIndex @param {number} j
4005
+ */
4006
+ _setTop(key, top, t, val, len, realIndex, j) {
4007
+ if (isNaN(t)) return;
4008
+ this.groupCtx.tops.set(key, [
4009
+ t,
4010
+ val,
4011
+ (top ? top[2] : 0) + len,
4012
+ (top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
4013
+ top ? Math.min(top[0], top[4]) : 1 / 0,
4014
+ top ? Math.max(top[0], top[5]) : -1 / 0
4015
+ ]);
4016
+ }
3996
4017
  }
3997
4018
  class RangeBar extends Bar {
3998
4019
  /**
@@ -4000,14 +4021,14 @@ class RangeBar extends Bar {
4000
4021
  * @param {number} seriesIndex
4001
4022
  */
4002
4023
  draw(series, seriesIndex) {
4003
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4024
+ var _a, _b, _c, _d, _e, _f;
4004
4025
  const w = this.w;
4005
4026
  const graphics = new Graphics(this.w);
4006
4027
  this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
4007
4028
  this.series = series;
4008
4029
  this.seriesRangeStart = w.rangeData.seriesRangeStart;
4009
4030
  this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
4010
- this.barHelpers.initVariables(series);
4031
+ this.barHelpers.initVariables(series, seriesIndex);
4011
4032
  const ret = graphics.group({
4012
4033
  class: "apexcharts-rangebar-series apexcharts-plot-series"
4013
4034
  });
@@ -4029,6 +4050,9 @@ class RangeBar extends Bar {
4029
4050
  this.visibleI = this.visibleI + 1;
4030
4051
  }
4031
4052
  const translationsIndex = this.setSeriesAxis(realIndex);
4053
+ if (this.isHorizontal && w.labelData.timescaleLabels.length) {
4054
+ this.isReversed = false;
4055
+ }
4032
4056
  const initPositions = this.barHelpers.initialPositions(realIndex);
4033
4057
  const {
4034
4058
  y: initY,
@@ -4038,10 +4062,8 @@ class RangeBar extends Bar {
4038
4062
  zeroH
4039
4063
  // zeroH is the baseline where 0 meets y axis
4040
4064
  } = initPositions;
4041
- let barWidth = (_a = initPositions.barWidth) != null ? _a : 0;
4042
- let barHeight = (_b = initPositions.barHeight) != null ? _b : 0;
4043
- const yDivision = (_c = initPositions.yDivision) != null ? _c : 0;
4044
- const xDivision = (_d = initPositions.xDivision) != null ? _d : 0;
4065
+ const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
4066
+ const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
4045
4067
  y = initY;
4046
4068
  x = initX;
4047
4069
  const elDataLabelsWrap = graphics.group({
@@ -4051,10 +4073,16 @@ class RangeBar extends Bar {
4051
4073
  const elGoalsMarkers = graphics.group({
4052
4074
  class: "apexcharts-rangebar-goals-markers"
4053
4075
  });
4076
+ const data = (
4077
+ /** @type {any} */
4078
+ w.config.series[realIndex].data
4079
+ );
4054
4080
  for (let j = 0; j < w.globals.dataPoints; j++) {
4055
4081
  const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
4056
- const y1 = this.seriesRangeStart[i][j];
4057
- const y2 = this.seriesRangeEnd[i][j];
4082
+ let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
4083
+ let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
4084
+ const y1 = this.seriesRangeStart[realIndex][j];
4085
+ const y2 = this.seriesRangeEnd[realIndex][j];
4058
4086
  let paths = (
4059
4087
  /** @type {any} */
4060
4088
  null
@@ -4066,20 +4094,16 @@ class RangeBar extends Bar {
4066
4094
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
4067
4095
  seriesLen = 1;
4068
4096
  }
4069
- if (typeof /** @type {Record<string,any>} */
4070
- ((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
4097
+ if (typeof (data == null ? void 0 : data[j]) === "undefined") {
4071
4098
  break;
4072
4099
  }
4073
4100
  if (this.isHorizontal) {
4074
4101
  barYPosition = y + barHeight * /** @type {any} */
4075
4102
  this.visibleI;
4076
4103
  const srty = (yDivision - barHeight * seriesLen) / 2;
4077
- if (
4078
- /** @type {Record<string,any>} */
4079
- (_g = (_f = w.config.series[i].data) == null ? void 0 : _f[j]) == null ? void 0 : _g.x
4080
- ) {
4104
+ if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
4081
4105
  const positions = this.detectOverlappingBars({
4082
- i,
4106
+ i: realIndex,
4083
4107
  j,
4084
4108
  barYPosition,
4085
4109
  srty,
@@ -4102,17 +4126,14 @@ class RangeBar extends Bar {
4102
4126
  barWidth = paths.barWidth;
4103
4127
  } else {
4104
4128
  if (w.axisFlags.isXNumeric) {
4105
- x = (w.seriesData.seriesX[i][j] - w.globals.minX) / this.xRatio - barWidth / 2;
4129
+ x = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
4106
4130
  }
4107
4131
  barXPosition = x + barWidth * /** @type {any} */
4108
4132
  this.visibleI;
4109
4133
  const srtx = (xDivision - barWidth * seriesLen) / 2;
4110
- if (
4111
- /** @type {Record<string,any>} */
4112
- (_i = (_h = w.config.series[i].data) == null ? void 0 : _h[j]) == null ? void 0 : _i.x
4113
- ) {
4134
+ if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
4114
4135
  const positions = this.detectOverlappingBars({
4115
- i,
4136
+ i: realIndex,
4116
4137
  j,
4117
4138
  barXPosition,
4118
4139
  srtx,
@@ -4131,9 +4152,10 @@ class RangeBar extends Bar {
4131
4152
  xDivision
4132
4153
  }, params));
4133
4154
  barHeight = paths.barHeight;
4155
+ barXPosition = paths.barXPosition;
4134
4156
  }
4135
4157
  const barGoalLine = this.barHelpers.drawGoalLine({
4136
- barXPosition: paths.barXPosition,
4158
+ barXPosition,
4137
4159
  barYPosition,
4138
4160
  goalX: paths.goalX,
4139
4161
  goalY: paths.goalY,
@@ -4178,19 +4200,11 @@ class RangeBar extends Bar {
4178
4200
  });
4179
4201
  }
4180
4202
  if (w.globals.previousPaths.length > 0) {
4181
- const data = (
4182
- /** @type {Record<string,any>} */
4183
- w.config.series[i].data || []
4184
- );
4185
- const newKeys = [];
4186
- for (let j = 0; j < data.length; j++) {
4187
- newKeys.push(datumKey(w, realIndex, j));
4188
- }
4189
4203
  renderBarExitGhosts({
4190
4204
  w,
4191
4205
  elSeries,
4192
4206
  record: this._prevRecord(realIndex),
4193
- newKeys,
4207
+ newKeys: this._keys(realIndex),
4194
4208
  isHorizontal: this.isHorizontal,
4195
4209
  speed: w.config.chart.animations.dynamicAnimation.speed
4196
4210
  });
@@ -4242,11 +4256,11 @@ class RangeBar extends Bar {
4242
4256
  );
4243
4257
  if (overlaps.indexOf(rangeName) > -1) {
4244
4258
  barHeight = initPositions.barHeight / overlaps.length;
4245
- barYPosition = barHeight * this.visibleI + yDivision * (100 - parseInt(this.barOptions.barHeight, 10)) / 100 / 2 + barHeight * (this.visibleI + overlaps.indexOf(rangeName)) + yDivision * rowIndex;
4259
+ barYPosition += barHeight * overlaps.indexOf(rangeName);
4246
4260
  }
4247
4261
  }
4248
4262
  } else {
4249
- if (rowIndex > -1 && !w.labelData.timescaleLabels.length) {
4263
+ if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
4250
4264
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
4251
4265
  barXPosition = srtx + xDivision * rowIndex;
4252
4266
  } else {
@@ -4260,7 +4274,7 @@ class RangeBar extends Bar {
4260
4274
  );
4261
4275
  if (overlaps.indexOf(rangeName) > -1) {
4262
4276
  barWidth = initPositions.barWidth / overlaps.length;
4263
- barXPosition = barWidth * this.visibleI + xDivision * (100 - parseInt(this.barOptions.barWidth, 10)) / 100 / 2 + barWidth * (this.visibleI + overlaps.indexOf(rangeName)) + xDivision * rowIndex;
4277
+ barXPosition += barWidth * overlaps.indexOf(rangeName);
4264
4278
  }
4265
4279
  }
4266
4280
  }
@@ -4283,7 +4297,7 @@ class RangeBar extends Bar {
4283
4297
  var _a, _b;
4284
4298
  const w = this.w;
4285
4299
  const { i, j, realIndex, translationsIndex } = indexes;
4286
- const yRatio = this.yRatio[translationsIndex];
4300
+ const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
4287
4301
  const range = this.getRangeValue(realIndex, j);
4288
4302
  let y1 = Math.min(range.start, range.end);
4289
4303
  let y2 = Math.max(range.start, range.end);
@@ -4291,7 +4305,7 @@ class RangeBar extends Bar {
4291
4305
  ((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
4292
4306
  ((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
4293
4307
  if (!hasValue) {
4294
- y1 = zeroH;
4308
+ y1 = y2 = zeroH;
4295
4309
  } else {
4296
4310
  y1 = zeroH - y1 / yRatio;
4297
4311
  y2 = zeroH - y2 / yRatio;
@@ -4352,6 +4366,30 @@ class RangeBar extends Bar {
4352
4366
  barXPosition
4353
4367
  };
4354
4368
  }
4369
+ /**
4370
+ * Timeline datums key by their own row, not by the j-th label: a row can
4371
+ * hold several bars, so labels[j] names some other datum's row.
4372
+ * @param {number} realIndex
4373
+ * @returns {string[]}
4374
+ */
4375
+ _keys(realIndex) {
4376
+ const c = (
4377
+ /** @type {any} */
4378
+ this._keyCache || (this._keyCache = {})
4379
+ );
4380
+ const data = (
4381
+ /** @type {any} */
4382
+ this.w.config.series[realIndex].data
4383
+ );
4384
+ return c[realIndex] || (c[realIndex] = uniquifyKeys(
4385
+ (data || []).map(
4386
+ (d, j) => {
4387
+ var _a;
4388
+ return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
4389
+ }
4390
+ )
4391
+ ));
4392
+ }
4355
4393
  /**
4356
4394
  * @param {number} val
4357
4395
  */
@@ -4378,8 +4416,9 @@ class RangeBar extends Bar {
4378
4416
  }) {
4379
4417
  const w = this.w;
4380
4418
  const { realIndex, j } = indexes;
4381
- const x1 = this.preventBarOverflow(zeroW + y1 / this.invertedYRatio);
4382
- const x2 = this.preventBarOverflow(zeroW + y2 / this.invertedYRatio);
4419
+ const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
4420
+ const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
4421
+ const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
4383
4422
  const range = this.getRangeValue(realIndex, j);
4384
4423
  const barWidth = Math.abs(x2 - x1);
4385
4424
  const paths = this.barHelpers.getBarpaths({