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";
@@ -641,181 +641,6 @@ const resolveDataLabelOffset = (value, w, seriesIndex, dataPointIndex) => {
641
641
  });
642
642
  return Number.isFinite(resolved) ? resolved : 0;
643
643
  };
644
- const Animations = _core.__apex_Animations;
645
- const computeStagger = _core.__apex_Animations_computeStagger;
646
- const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
647
- const Environment = _core.__apex_Environment_Environment;
648
- function lengthTransitionEnabled(w) {
649
- var _a;
650
- const anim = w.config.chart.animations;
651
- if (!anim || anim.enabled === false) return false;
652
- if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
653
- return false;
654
- }
655
- const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
656
- if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
657
- return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
658
- }
659
- function datumKey(w, realIndex, j) {
660
- var _a, _b, _c, _d;
661
- if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
662
- const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
663
- if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
664
- }
665
- const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
666
- if (lbl != null && String(lbl) !== "") {
667
- return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
668
- }
669
- return "j:" + j;
670
- }
671
- function frameDatumKey(frame, realIndex, j) {
672
- var _a, _b;
673
- if (frame.isXNumeric) {
674
- const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
675
- if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
676
- }
677
- const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
678
- if (lbl != null && String(lbl) !== "") {
679
- return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
680
- }
681
- return "j:" + j;
682
- }
683
- function joinKeys(oldKeys, newKeys) {
684
- const oldIndex = /* @__PURE__ */ new Map();
685
- oldKeys.forEach((k2, i) => {
686
- if (!oldIndex.has(k2)) oldIndex.set(k2, i);
687
- });
688
- const toOld = new Array(newKeys.length);
689
- const usedOld = /* @__PURE__ */ new Set();
690
- let prev = -1;
691
- let ordered = true;
692
- let identity = oldKeys.length === newKeys.length;
693
- newKeys.forEach((k2, i) => {
694
- const oi = oldIndex.has(k2) && !usedOld.has(oldIndex.get(k2)) ? oldIndex.get(k2) : -1;
695
- toOld[i] = oi;
696
- if (oi !== -1) {
697
- usedOld.add(oi);
698
- if (oi < prev) ordered = false;
699
- prev = oi;
700
- }
701
- if (oi !== i) identity = false;
702
- });
703
- const exits = [];
704
- for (let i = 0; i < oldKeys.length; i++) {
705
- if (!usedOld.has(i)) exits.push(i);
706
- }
707
- return { toOld, exits, ordered, changed: !identity };
708
- }
709
- function uniquifyKeys(keys) {
710
- const seen = /* @__PURE__ */ new Map();
711
- return keys.map((k2) => {
712
- const count = seen.get(k2) || 0;
713
- seen.set(k2, count + 1);
714
- return count === 0 ? k2 : `${k2}#${count}`;
715
- });
716
- }
717
- function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
718
- var _a, _b;
719
- if (!lengthTransitionEnabled(w)) return null;
720
- const frame = w.globals.prevStreamFrame;
721
- if (!frame) return null;
722
- const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
723
- const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
724
- if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
725
- if (!oldY.length || !newY.length) return null;
726
- const oldKeys = uniquifyKeys(
727
- oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
728
- );
729
- const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)));
730
- const join = joinKeys(oldKeys, newKeys);
731
- if (!join.ordered && !allowReorder) return null;
732
- if (!join.changed && !includeIdentity) return null;
733
- return { join, oldKeys, newKeys };
734
- }
735
- function firstMove(d) {
736
- const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
737
- if (!m) return null;
738
- const x2 = parseFloat(m[1]);
739
- const y = parseFloat(m[2]);
740
- return isFinite(x2) && isFinite(y) ? { x: x2, y } : null;
741
- }
742
- function renderBarExitGhosts({
743
- w,
744
- elSeries,
745
- record,
746
- newKeys,
747
- isHorizontal,
748
- speed
749
- }) {
750
- var _a;
751
- if (!lengthTransitionEnabled(w)) return;
752
- if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
753
- const newKeySet = new Set(newKeys);
754
- const exits = record.paths.filter(
755
- (p) => p && p.d && p.key != null && !newKeySet.has(p.key)
756
- );
757
- if (!exits.length) return;
758
- const graphics = new Graphics(w);
759
- const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
760
- exits.forEach((p) => {
761
- let fill = p.fill || fallbackFill || "#c8c8c8";
762
- if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
763
- const ghost = graphics.drawPath({
764
- d: p.d,
765
- stroke: "none",
766
- strokeWidth: 0,
767
- fill,
768
- fillOpacity: 1,
769
- classes: "apexcharts-bar-ghost"
770
- });
771
- const node = ghost.node;
772
- node.setAttribute("pointer-events", "none");
773
- ghost.attr(
774
- "clip-path",
775
- `url(#gridRectBarMask${w.globals.cuid})`
776
- );
777
- elSeries.node.insertBefore(node, elSeries.node.firstChild);
778
- const start = firstMove(p.d);
779
- let origin = isHorizontal ? "left center" : "center bottom";
780
- try {
781
- const bb = node.getBBox();
782
- if (start && bb) {
783
- if (isHorizontal) {
784
- origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
785
- } else {
786
- origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
787
- }
788
- }
789
- } catch (_) {
790
- }
791
- const style = node.style;
792
- style.transformBox = "fill-box";
793
- style.transformOrigin = origin;
794
- node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
795
- try {
796
- const bb = node.getBBox();
797
- const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
798
- if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
799
- } catch (_) {
800
- }
801
- const duration = Math.max(1, speed || 1);
802
- const startAt = performance.now();
803
- const step = (now) => {
804
- if (w.globals.isDestroyed || !node.parentNode) return;
805
- const t = Math.max(0, Math.min(1, (now - startAt) / duration));
806
- const eased = 1 - Math.pow(1 - t, 3);
807
- const scale = 1 - eased;
808
- style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
809
- style.opacity = String(1 - eased);
810
- if (t < 1) {
811
- BrowserAPIs.requestAnimationFrame(step);
812
- } else {
813
- node.parentNode.removeChild(node);
814
- }
815
- };
816
- BrowserAPIs.requestAnimationFrame(step);
817
- });
818
- }
819
644
  class BarDataLabels {
820
645
  /**
821
646
  * @param {import('../../../charts/Bar').default} barCtx
@@ -851,7 +676,8 @@ class BarDataLabels {
851
676
  barXPosition,
852
677
  barYPosition,
853
678
  visibleSeries,
854
- hl
679
+ hl,
680
+ noLabel
855
681
  } = opts;
856
682
  const w = this.w;
857
683
  const graphics = new Graphics(this.barCtx.w);
@@ -965,7 +791,7 @@ class BarDataLabels {
965
791
  dataLabelsPos.dataLabelsX = (box.levelStart + box.levelEnd) / 2 + offX;
966
792
  }
967
793
  }
968
- dataLabels = this.drawCalculatedDataLabels({
794
+ dataLabels = noLabel ? null : this.drawCalculatedDataLabels({
969
795
  x: dataLabelsPos.dataLabelsX,
970
796
  y: dataLabelsPos.dataLabelsY,
971
797
  neg: params.neg,
@@ -1051,8 +877,8 @@ class BarDataLabels {
1051
877
  return ctx && byGroups && byGroups[ctx.groupIndex] ? byGroups[ctx.groupIndex][j] : this.barCtx.stackedSeriesTotals[j];
1052
878
  }
1053
879
  /**
1054
- * The running stack at this column's x (BarStacked `tops`, columns only) on
1055
- * a numeric axis, where columns stack by x rather than by index.
880
+ * The running stack at this bar's x (BarStacked `tops`) on a numeric axis,
881
+ * where bars stack by x rather than by index.
1056
882
  * @param {number} realIndex @param {number} j
1057
883
  */
1058
884
  xStackTop(realIndex, j) {
@@ -1061,6 +887,21 @@ class BarDataLabels {
1061
887
  return w.axisFlags.isXNumeric && /** @type {any} */
1062
888
  ((_b = (_a = this.barCtx.stacks) == null ? void 0 : _a[w.labelData.seriesGroupIndex[realIndex]]) == null ? void 0 : _b.tops.get(w.seriesData.seriesX[realIndex][j]));
1063
889
  }
890
+ /**
891
+ * The stacked total's text box, measured in the total's own font.
892
+ * @param {number} realIndex @param {number} j
893
+ */
894
+ totalRects(realIndex, j) {
895
+ const s = this.barCtx.barOptions.dataLabels.total.style;
896
+ return new Graphics(this.w).getTextRects(
897
+ this.getStackedTotalDataLabel({ realIndex, j }),
898
+ s.fontSize,
899
+ s.fontFamily,
900
+ void 0,
901
+ true,
902
+ s.fontWeight
903
+ );
904
+ }
1064
905
  /** @param {{realIndex: any, j: any}} opts */
1065
906
  getStackedTotalDataLabel({ realIndex, j }) {
1066
907
  const w = this.w;
@@ -1081,7 +922,6 @@ class BarDataLabels {
1081
922
  var _a;
1082
923
  const w = this.w;
1083
924
  let {
1084
- i,
1085
925
  j,
1086
926
  realIndex,
1087
927
  y,
@@ -1091,7 +931,6 @@ class BarDataLabels {
1091
931
  textRects,
1092
932
  dataLabelsX,
1093
933
  dataLabelsY,
1094
- dataLabelsConfig,
1095
934
  barDataLabelsConfig,
1096
935
  barTotalDataLabelsConfig,
1097
936
  strokeWidth,
@@ -1105,7 +944,7 @@ class BarDataLabels {
1105
944
  barHeight = Math.abs(barHeight);
1106
945
  const vertical = w.config.plotOptions.bar.dataLabels.orientation === "vertical";
1107
946
  const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
1108
- i,
947
+ i: realIndex,
1109
948
  j
1110
949
  });
1111
950
  bcx = bcx - strokeWidth / 2;
@@ -1126,7 +965,7 @@ class BarDataLabels {
1126
965
  const offsetDLX = 2;
1127
966
  dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX;
1128
967
  }
1129
- const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[i][j] < 0;
968
+ const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[realIndex][j] < 0;
1130
969
  let newY = y;
1131
970
  if (this.barCtx.isReversed) {
1132
971
  newY = y + (valIsNegative ? barHeight : -barHeight);
@@ -1200,16 +1039,11 @@ class BarDataLabels {
1200
1039
  });
1201
1040
  if (this.hlt) lowestPrevY = this.hlt.edge;
1202
1041
  if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
1203
- const ADDITIONAL_OFFY = 18;
1204
- const graphics = new Graphics(this.barCtx.w);
1205
- const totalLabeltextRects = graphics.getTextRects(
1206
- this.getStackedTotalDataLabel({ realIndex, j }),
1207
- dataLabelsConfig.fontSize
1208
- );
1042
+ const h = this.totalRects(realIndex, j).height;
1209
1043
  if (valIsNegative) {
1210
- totalDataLabelsY = lowestPrevY - totalLabeltextRects.height / 2 - offY - barTotalDataLabelsConfig.offsetY + ADDITIONAL_OFFY;
1044
+ totalDataLabelsY = lowestPrevY + h * 0.77 - offY - barTotalDataLabelsConfig.offsetY;
1211
1045
  } else {
1212
- totalDataLabelsY = lowestPrevY + totalLabeltextRects.height + offY + barTotalDataLabelsConfig.offsetY - ADDITIONAL_OFFY;
1046
+ totalDataLabelsY = lowestPrevY - h * 0.3 + offY + barTotalDataLabelsConfig.offsetY;
1213
1047
  }
1214
1048
  const xDivision = dataPointsDividedWidth;
1215
1049
  totalDataLabelsX = totalDataLabelsBcx + (w.axisFlags.isXNumeric ? -barWidth / 2 : barWidth / 2 - xDivision) + barTotalDataLabelsConfig.offsetX;
@@ -1239,7 +1073,6 @@ class BarDataLabels {
1239
1073
  const w = this.w;
1240
1074
  let {
1241
1075
  x: x2,
1242
- i,
1243
1076
  j,
1244
1077
  realIndex,
1245
1078
  bcy,
@@ -1256,7 +1089,7 @@ class BarDataLabels {
1256
1089
  } = opts;
1257
1090
  const dataPointsDividedHeight = w.layout.gridHeight / w.globals.dataPoints;
1258
1091
  const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
1259
- i,
1092
+ i: realIndex,
1260
1093
  j
1261
1094
  });
1262
1095
  barWidth = Math.abs(barWidth);
@@ -1273,7 +1106,7 @@ class BarDataLabels {
1273
1106
  let totalDataLabelsX;
1274
1107
  let totalDataLabelsY;
1275
1108
  let totalDataLabelsAnchor = "start";
1276
- const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[i][j] < 0;
1109
+ const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[realIndex][j] < 0;
1277
1110
  let newX = x2;
1278
1111
  if (this.barCtx.isReversed) {
1279
1112
  newX = x2 + (valIsNegative ? -barWidth : barWidth);
@@ -1308,10 +1141,14 @@ class BarDataLabels {
1308
1141
  }
1309
1142
  let lowestPrevX = newX;
1310
1143
  const totalGroupCtx = this.getTotalGroupContext(realIndex);
1311
- const stacks = (
1144
+ const top = this.xStackTop(realIndex, j);
1145
+ const stacks = top ? [] : (
1312
1146
  /** @type {any} */
1313
1147
  this.barCtx.stacks || []
1314
1148
  );
1149
+ if (top) {
1150
+ lowestPrevX = valIsNegative ? Math.min(newX, top[4]) : Math.max(newX, top[5]);
1151
+ }
1315
1152
  stacks.forEach((g, gi) => {
1316
1153
  if (totalGroupCtx && gi !== totalGroupCtx.groupIndex) return;
1317
1154
  g.prevX.forEach((arr) => {
@@ -1324,11 +1161,7 @@ class BarDataLabels {
1324
1161
  });
1325
1162
  if (this.hlt) lowestPrevX = this.hlt.edge;
1326
1163
  if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
1327
- const graphics = new Graphics(this.barCtx.w);
1328
- const totalLabeltextRects = graphics.getTextRects(
1329
- this.getStackedTotalDataLabel({ realIndex, j }),
1330
- dataLabelsConfig.fontSize
1331
- );
1164
+ const totalLabeltextRects = this.totalRects(realIndex, j);
1332
1165
  if (valIsNegative) {
1333
1166
  totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX;
1334
1167
  totalDataLabelsAnchor = "end";
@@ -1397,8 +1230,9 @@ class BarDataLabels {
1397
1230
  let elDataLabelsWrap = null;
1398
1231
  const isSeriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1;
1399
1232
  const isSeriesCollapsing = (w.globals.collapsingSeriesIndices || []).indexOf(i) > -1;
1233
+ const dlKey = `${i}::${this.barCtx._keys(i)[j]}`;
1400
1234
  if (isSeriesCollapsing) {
1401
- const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(`${i}::${datumKey(w, i, j)}`);
1235
+ const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(dlKey);
1402
1236
  if (prev && isFinite(prev.val)) {
1403
1237
  val = prev.val;
1404
1238
  text = void 0;
@@ -1411,10 +1245,7 @@ class BarDataLabels {
1411
1245
  });
1412
1246
  const dlCfg = w.config.dataLabels;
1413
1247
  if (((_b = dlCfg.animate) == null ? void 0 : _b.enabled) || ((_c = dlCfg.countUp) == null ? void 0 : _c.enabled)) {
1414
- elDataLabelsWrap.node.setAttribute(
1415
- "data:dlKey",
1416
- `${i}::${datumKey(w, i, j)}`
1417
- );
1248
+ elDataLabelsWrap.node.setAttribute("data:dlKey", dlKey);
1418
1249
  elDataLabelsWrap.node.setAttribute("data:dlJ", String(j));
1419
1250
  if (typeof val === "number" && isFinite(val)) {
1420
1251
  elDataLabelsWrap.node.setAttribute("data:dlVal", String(val));
@@ -1432,29 +1263,12 @@ class BarDataLabels {
1432
1263
  if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
1433
1264
  text = "";
1434
1265
  }
1435
- const valIsNegative = neg != null ? neg : w.seriesData.series[i][j] < 0;
1436
- const position = w.config.plotOptions.bar.dataLabels.position;
1266
+ let anchor = dataLabelsConfig.textAnchor;
1437
1267
  if (w.config.plotOptions.bar.dataLabels.orientation === "vertical") {
1438
- if (position === "top") {
1439
- if (valIsNegative) dataLabelsConfig.textAnchor = "end";
1440
- else dataLabelsConfig.textAnchor = "start";
1441
- }
1442
- if (position === "center") {
1443
- dataLabelsConfig.textAnchor = "middle";
1444
- }
1445
- if (position === "bottom") {
1446
- if (valIsNegative) dataLabelsConfig.textAnchor = "end";
1447
- else dataLabelsConfig.textAnchor = "start";
1448
- }
1268
+ anchor = w.config.plotOptions.bar.dataLabels.position === "center" ? "middle" : (neg != null ? neg : w.seriesData.series[i][j] < 0) ? "end" : "start";
1449
1269
  }
1450
- if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) {
1451
- const txRect = graphics.getTextRects(
1452
- text,
1453
- parseFloat(dataLabelsConfig.style.fontSize).toString()
1454
- );
1455
- if (barWidth < txRect.width) {
1456
- text = "";
1457
- }
1270
+ if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && barWidth < textRects.width) {
1271
+ text = "";
1458
1272
  }
1459
1273
  if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && // A collapsing series is measured against its NEW extent, which is
1460
1274
  // already zero, so this would blank a label whose bar is still at full
@@ -1470,14 +1284,14 @@ class BarDataLabels {
1470
1284
  }
1471
1285
  }
1472
1286
  }
1473
- const modifiedDataLabelsConfig = __spreadValues({}, dataLabelsConfig);
1474
- if (this.barCtx.isHorizontal) {
1475
- if (val < 0) {
1476
- if (dataLabelsConfig.textAnchor === "start") {
1477
- modifiedDataLabelsConfig.textAnchor = "end";
1478
- } else if (dataLabelsConfig.textAnchor === "end") {
1479
- modifiedDataLabelsConfig.textAnchor = "start";
1480
- }
1287
+ const modifiedDataLabelsConfig = __spreadProps(__spreadValues({}, dataLabelsConfig), {
1288
+ textAnchor: anchor
1289
+ });
1290
+ if (this.barCtx.isHorizontal && val < 0) {
1291
+ if (anchor === "start") {
1292
+ modifiedDataLabelsConfig.textAnchor = "end";
1293
+ } else if (anchor === "end") {
1294
+ modifiedDataLabelsConfig.textAnchor = "start";
1481
1295
  }
1482
1296
  }
1483
1297
  dataLabels.plotDataLabelsText({
@@ -1529,7 +1343,7 @@ class BarDataLabels {
1529
1343
  const { groupIndex } = this.barCtx.barHelpers.getGroupIndex(realIndex);
1530
1344
  totalDataLabelText.node.setAttribute(
1531
1345
  "data:dlTotalKey",
1532
- `${groupIndex}::${datumKey(this.w, realIndex, j)}`
1346
+ `${groupIndex}::${this.barCtx._keys(realIndex)[j]}`
1533
1347
  );
1534
1348
  totalDataLabelText.node.setAttribute(
1535
1349
  "data:dlTotalSeries",
@@ -1545,6 +1359,7 @@ class BarDataLabels {
1545
1359
  }
1546
1360
  const Series = _core.__apex_Series;
1547
1361
  const Fill = _core.__apex_Fill;
1362
+ const CoreUtils = _core.__apex_CoreUtils;
1548
1363
  function isHistogramOverlay(w) {
1549
1364
  var _a, _b, _c, _d, _e, _f, _g;
1550
1365
  if (((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.chart) == null ? void 0 : _b.requestedType) !== "histogram") return false;
@@ -1561,9 +1376,11 @@ class Helpers {
1561
1376
  }
1562
1377
  /**
1563
1378
  * @param {any[]} series
1379
+ * @param {any} [seriesIndex] a combo's real indices of `series`
1564
1380
  */
1565
- initVariables(series) {
1381
+ initVariables(series, seriesIndex) {
1566
1382
  const w = this.w;
1383
+ this.seriesIndex = seriesIndex;
1567
1384
  this.barCtx.series = series;
1568
1385
  this.barCtx.totalItems = 0;
1569
1386
  this.barCtx.seriesLen = 0;
@@ -1584,6 +1401,8 @@ class Helpers {
1584
1401
  this.barCtx.visibleItems = w.globals.dataPoints;
1585
1402
  }
1586
1403
  }
1404
+ const labels = w.labelData.labels;
1405
+ this.rows = w.globals.isBarHorizontal && w.axisFlags.isXNumeric && !this.barCtx.isRangeBar && w.seriesData.seriesX.some((s) => s == null ? void 0 : s.some((x2, j) => x2 !== labels[j])) ? new Map(labels.map((x2, r) => [x2, r])) : null;
1587
1406
  this.arrBorderRadius = this.createBorderRadiusArr(w.seriesData.series);
1588
1407
  if (Utils.isSafari()) {
1589
1408
  this.arrBorderRadius = this.arrBorderRadius.map(
@@ -1648,15 +1467,19 @@ class Helpers {
1648
1467
  * Collapsed series count too, exactly as they did for `minXDiff`. Skipping
1649
1468
  * them would widen every bar the moment someone hid the tightest-spaced
1650
1469
  * series from the legend, so bar geometry would depend on legend state.
1470
+ * In a combo only this renderer's own series count: a line's x values say
1471
+ * nothing about how wide a column may be.
1651
1472
  *
1652
1473
  * @returns {number}
1653
1474
  */
1654
1475
  _unionMinXGap() {
1655
1476
  const w = this.w;
1656
1477
  const seriesX = w.seriesData.seriesX || [];
1478
+ const own = this.seriesIndex;
1657
1479
  const arrays = [];
1658
1480
  for (let i = 0; i < seriesX.length; i++) {
1659
1481
  const xs = seriesX[i];
1482
+ if (own && own.indexOf(i) < 0) continue;
1660
1483
  if (Array.isArray(xs) && xs.length > 0) {
1661
1484
  arrays.push(
1662
1485
  xs.some((v, n) => v < xs[n - 1]) ? xs.filter((v) => v === +v).sort((a, b) => a - b) : xs
@@ -1697,6 +1520,15 @@ class Helpers {
1697
1520
  }
1698
1521
  return isFinite(min) ? min : 0;
1699
1522
  }
1523
+ /**
1524
+ * The band a horizontal bar is drawn in: its x's band when the series do
1525
+ * not line up by index (see initVariables), else its index.
1526
+ * @param {number} realIndex @param {number} j
1527
+ */
1528
+ barRow(realIndex, j) {
1529
+ var _a, _b, _c;
1530
+ return (_c = (_b = this.rows) == null ? void 0 : _b.get((_a = this.w.seriesData.seriesX[realIndex]) == null ? void 0 : _a[j])) != null ? _c : j;
1531
+ }
1700
1532
  /**
1701
1533
  * @param {number} realIndex
1702
1534
  */
@@ -1819,7 +1651,7 @@ class Helpers {
1819
1651
  });
1820
1652
  }
1821
1653
  const connectorFill = this.getDumbbellConnectorFill(i, j);
1822
- const datumFill = connectorFill || ((_a = w.config.series[i].data[j]) == null ? void 0 : _a.fill);
1654
+ const datumFill = connectorFill || ((_a = w.config.series[realIndex].data[j]) == null ? void 0 : _a.fill);
1823
1655
  const connector = this.barCtx.barOptions.isDumbbell ? w.config.plotOptions.bar.dumbbell.connector : null;
1824
1656
  let connectorOpacity;
1825
1657
  if (connector && connector.color) {
@@ -1972,11 +1804,10 @@ class Helpers {
1972
1804
  * @returns {string[][]}
1973
1805
  */
1974
1806
  createBorderRadiusArr(series) {
1975
- var _a;
1976
1807
  const w = this.w;
1977
1808
  const alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0;
1978
1809
  const numSeries = series.length;
1979
- const numColumns = ((_a = series[0]) == null ? void 0 : _a.length) | 0;
1810
+ const numColumns = Math.max(0, ...series.map((s) => (s == null ? void 0 : s.length) | 0));
1980
1811
  const output = Array.from(
1981
1812
  { length: numSeries },
1982
1813
  () => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
@@ -2132,7 +1963,7 @@ class Helpers {
2132
1963
  j,
2133
1964
  w
2134
1965
  }) {
2135
- var _a, _b;
1966
+ var _a, _b, _c;
2136
1967
  const r = this.barRect({
2137
1968
  a: barXPosition,
2138
1969
  len: barWidth,
@@ -2163,7 +1994,7 @@ class Helpers {
2163
1994
  const _ctx = this.barCtx.groupCtx;
2164
1995
  _ctx.yArrj.push(y2 - strokeCenter * direction);
2165
1996
  _ctx.yArrjF.push(Math.abs(y1 - y2 + r.strokeWidth * direction));
2166
- _ctx.yArrjVal.push(this.barCtx.series[i][j]);
1997
+ _ctx.yArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
2167
1998
  }
2168
1999
  return {
2169
2000
  pathTo,
@@ -2353,7 +2184,7 @@ class Helpers {
2353
2184
  j,
2354
2185
  w
2355
2186
  }) {
2356
- var _a, _b;
2187
+ var _a, _b, _c;
2357
2188
  const graphics = new Graphics(this.barCtx.w);
2358
2189
  const r = this.barRect({
2359
2190
  a: barYPosition,
@@ -2389,7 +2220,7 @@ class Helpers {
2389
2220
  const _ctx = this.barCtx.groupCtx;
2390
2221
  _ctx.xArrj.push(x2 + strokeCenter * direction);
2391
2222
  _ctx.xArrjF.push(Math.abs(x1 - x2 - r.strokeWidth * direction));
2392
- _ctx.xArrjVal.push(this.barCtx.series[i][j]);
2223
+ _ctx.xArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
2393
2224
  }
2394
2225
  return {
2395
2226
  pathTo,
@@ -2434,6 +2265,9 @@ class Helpers {
2434
2265
  const w = this.w;
2435
2266
  const goals = [];
2436
2267
  const pushGoal = (value, attrs) => {
2268
+ if (!w.globals.invalidLogScale) {
2269
+ value = new CoreUtils(w).getLogValAtSeriesIndex(value, i);
2270
+ }
2437
2271
  goals.push({
2438
2272
  [type]: type === "x" ? this.getXForValue(value, zeroW, false) : this.getYForValue(value, zeroH, translationsIndex, false),
2439
2273
  attrs
@@ -2688,11 +2522,11 @@ class Helpers {
2688
2522
  let zeroEncounters = 0;
2689
2523
  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)) || [];
2690
2524
  seriesIndices.forEach((_si) => {
2691
- const val = w.globals.seriesPercent[_si][j];
2525
+ const val = w.seriesData.series[_si][j];
2692
2526
  if (val) {
2693
2527
  nonZeroColumns++;
2694
2528
  }
2695
- if (_si < i && val === 0) {
2529
+ if (_si < i && !val) {
2696
2530
  zeroEncounters++;
2697
2531
  }
2698
2532
  });
@@ -2729,8 +2563,187 @@ class Helpers {
2729
2563
  return { groupIndex, columnGroupIndex };
2730
2564
  }
2731
2565
  }
2732
- const CoreUtils = _core.__apex_CoreUtils;
2733
2566
  const Filters = _core.__apex_Filters;
2567
+ const Animations = _core.__apex_Animations;
2568
+ const computeStagger = _core.__apex_Animations_computeStagger;
2569
+ const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
2570
+ const Environment = _core.__apex_Environment_Environment;
2571
+ function lengthTransitionEnabled(w) {
2572
+ var _a;
2573
+ const anim = w.config.chart.animations;
2574
+ if (!anim || anim.enabled === false) return false;
2575
+ if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
2576
+ return false;
2577
+ }
2578
+ const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
2579
+ if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
2580
+ return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
2581
+ }
2582
+ function datumKey(w, realIndex, j) {
2583
+ var _a, _b, _c, _d;
2584
+ if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
2585
+ const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
2586
+ if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
2587
+ }
2588
+ const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
2589
+ if (lbl != null && String(lbl) !== "") {
2590
+ return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
2591
+ }
2592
+ return "j:" + j;
2593
+ }
2594
+ function frameDatumKey(frame, realIndex, j) {
2595
+ var _a, _b;
2596
+ if (frame.isXNumeric) {
2597
+ const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
2598
+ if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
2599
+ }
2600
+ const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
2601
+ if (lbl != null && String(lbl) !== "") {
2602
+ return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
2603
+ }
2604
+ return "j:" + j;
2605
+ }
2606
+ function joinKeys(oldKeys, newKeys) {
2607
+ const oldIndex = /* @__PURE__ */ new Map();
2608
+ oldKeys.forEach((k2, i) => {
2609
+ if (!oldIndex.has(k2)) oldIndex.set(k2, i);
2610
+ });
2611
+ const toOld = new Array(newKeys.length);
2612
+ const usedOld = /* @__PURE__ */ new Set();
2613
+ let prev = -1;
2614
+ let ordered = true;
2615
+ let identity = oldKeys.length === newKeys.length;
2616
+ newKeys.forEach((k2, i) => {
2617
+ const oi = oldIndex.has(k2) && !usedOld.has(oldIndex.get(k2)) ? oldIndex.get(k2) : -1;
2618
+ toOld[i] = oi;
2619
+ if (oi !== -1) {
2620
+ usedOld.add(oi);
2621
+ if (oi < prev) ordered = false;
2622
+ prev = oi;
2623
+ }
2624
+ if (oi !== i) identity = false;
2625
+ });
2626
+ const exits = [];
2627
+ for (let i = 0; i < oldKeys.length; i++) {
2628
+ if (!usedOld.has(i)) exits.push(i);
2629
+ }
2630
+ return { toOld, exits, ordered, changed: !identity };
2631
+ }
2632
+ function uniquifyKeys(keys) {
2633
+ const seen = /* @__PURE__ */ new Map();
2634
+ return keys.map((k2) => {
2635
+ const count = seen.get(k2) || 0;
2636
+ seen.set(k2, count + 1);
2637
+ return count === 0 ? k2 : `${k2}#${count}`;
2638
+ });
2639
+ }
2640
+ function seriesKeys(w, realIndex, n = ((_a) => (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length)() | 0) {
2641
+ return uniquifyKeys(
2642
+ Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j))
2643
+ );
2644
+ }
2645
+ function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
2646
+ var _a, _b;
2647
+ if (!lengthTransitionEnabled(w)) return null;
2648
+ const frame = w.globals.prevStreamFrame;
2649
+ if (!frame) return null;
2650
+ const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
2651
+ const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
2652
+ if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
2653
+ if (!oldY.length || !newY.length) return null;
2654
+ const oldKeys = uniquifyKeys(
2655
+ oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
2656
+ );
2657
+ const newKeys = seriesKeys(w, realIndex);
2658
+ const join = joinKeys(oldKeys, newKeys);
2659
+ if (!join.ordered && !allowReorder) return null;
2660
+ if (!join.changed && !includeIdentity) return null;
2661
+ return { join, oldKeys, newKeys };
2662
+ }
2663
+ function firstMove(d) {
2664
+ const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
2665
+ if (!m) return null;
2666
+ const x2 = parseFloat(m[1]);
2667
+ const y = parseFloat(m[2]);
2668
+ return isFinite(x2) && isFinite(y) ? { x: x2, y } : null;
2669
+ }
2670
+ function renderBarExitGhosts({
2671
+ w,
2672
+ elSeries,
2673
+ record,
2674
+ newKeys,
2675
+ isHorizontal,
2676
+ speed
2677
+ }) {
2678
+ var _a;
2679
+ if (!lengthTransitionEnabled(w)) return;
2680
+ if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
2681
+ const newKeySet = new Set(newKeys);
2682
+ const exits = record.paths.filter(
2683
+ (p) => p && p.d && p.key != null && !newKeySet.has(p.key)
2684
+ );
2685
+ if (!exits.length) return;
2686
+ const graphics = new Graphics(w);
2687
+ const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
2688
+ exits.forEach((p) => {
2689
+ let fill = p.fill || fallbackFill || "#c8c8c8";
2690
+ if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
2691
+ const ghost = graphics.drawPath({
2692
+ d: p.d,
2693
+ stroke: "none",
2694
+ strokeWidth: 0,
2695
+ fill,
2696
+ fillOpacity: 1,
2697
+ classes: "apexcharts-bar-ghost"
2698
+ });
2699
+ const node = ghost.node;
2700
+ node.setAttribute("pointer-events", "none");
2701
+ ghost.attr(
2702
+ "clip-path",
2703
+ `url(#gridRectBarMask${w.globals.cuid})`
2704
+ );
2705
+ elSeries.node.insertBefore(node, elSeries.node.firstChild);
2706
+ const start = firstMove(p.d);
2707
+ let origin = isHorizontal ? "left center" : "center bottom";
2708
+ try {
2709
+ const bb = node.getBBox();
2710
+ if (start && bb) {
2711
+ if (isHorizontal) {
2712
+ origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
2713
+ } else {
2714
+ origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
2715
+ }
2716
+ }
2717
+ } catch (_) {
2718
+ }
2719
+ const style = node.style;
2720
+ style.transformBox = "fill-box";
2721
+ style.transformOrigin = origin;
2722
+ node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
2723
+ try {
2724
+ const bb = node.getBBox();
2725
+ const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
2726
+ if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
2727
+ } catch (_) {
2728
+ }
2729
+ const duration = Math.max(1, speed || 1);
2730
+ const startAt = performance.now();
2731
+ const step = (now) => {
2732
+ if (w.globals.isDestroyed || !node.parentNode) return;
2733
+ const t = Math.max(0, Math.min(1, (now - startAt) / duration));
2734
+ const eased = 1 - Math.pow(1 - t, 3);
2735
+ const scale = 1 - eased;
2736
+ style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
2737
+ style.opacity = String(1 - eased);
2738
+ if (t < 1) {
2739
+ BrowserAPIs.requestAnimationFrame(step);
2740
+ } else {
2741
+ node.parentNode.removeChild(node);
2742
+ }
2743
+ };
2744
+ BrowserAPIs.requestAnimationFrame(step);
2745
+ });
2746
+ }
2734
2747
  class AxisMapping {
2735
2748
  /**
2736
2749
  * Pixels per data-unit on the x-axis. Derived from `minX..maxX` so it is the
@@ -2849,15 +2862,17 @@ class Bar {
2849
2862
  /**
2850
2863
  * Point the per-series axis state at this series' y axis. Every bar-family
2851
2864
  * renderer calls it before initialPositions, which reads the baseline by
2852
- * this.translationsIndex.
2865
+ * this.translationsIndex and flips it for a reversed axis.
2853
2866
  * @param {number} realIndex
2854
2867
  * @return {number} translationsIndex
2855
2868
  */
2856
2869
  setSeriesAxis(realIndex) {
2870
+ var _a;
2857
2871
  if (this.yRatio.length > 1) {
2858
2872
  this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
2859
2873
  this.translationsIndex = realIndex;
2860
2874
  }
2875
+ this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
2861
2876
  return this.translationsIndex;
2862
2877
  }
2863
2878
  /** primary draw method which is called on bar object
@@ -2874,7 +2889,7 @@ class Bar {
2874
2889
  series = coreUtils.getLogSeries(series);
2875
2890
  this.series = series;
2876
2891
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
2877
- this.barHelpers.initVariables(series);
2892
+ this.barHelpers.initVariables(series, seriesIndex);
2878
2893
  const ret = graphics.group({
2879
2894
  class: "apexcharts-bar-series apexcharts-plot-series"
2880
2895
  });
@@ -2906,7 +2921,6 @@ class Bar {
2906
2921
  this.visibleI = this.visibleI + 1;
2907
2922
  }
2908
2923
  const translationsIndex = this.setSeriesAxis(realIndex);
2909
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
2910
2924
  if (this.isPyramid) {
2911
2925
  this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
2912
2926
  }
@@ -2984,7 +2998,9 @@ class Bar {
2984
2998
  elSeries
2985
2999
  };
2986
3000
  if (this.isHorizontal) {
2987
- paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
3001
+ paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
3002
+ y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
3003
+ }), {
2988
3004
  barHeight,
2989
3005
  zeroW,
2990
3006
  yDivision
@@ -3066,6 +3082,7 @@ class Bar {
3066
3082
  series,
3067
3083
  barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
3068
3084
  barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
3085
+ barXPosition: paths.barXPosition,
3069
3086
  elDataLabelsWrap,
3070
3087
  elGoalsMarkers,
3071
3088
  elBarShadows,
@@ -3076,15 +3093,11 @@ class Bar {
3076
3093
  w.globals.seriesXvalues[realIndex] = xArrj;
3077
3094
  w.globals.seriesYvalues[realIndex] = yArrj;
3078
3095
  if (w.globals.previousPaths.length > 0) {
3079
- const newKeys = [];
3080
- for (let j = 0; j < series[i].length; j++) {
3081
- newKeys.push(datumKey(w, realIndex, j));
3082
- }
3083
3096
  renderBarExitGhosts({
3084
3097
  w,
3085
3098
  elSeries,
3086
3099
  record: this._prevRecord(realIndex),
3087
- newKeys,
3100
+ newKeys: this._keys(realIndex),
3088
3101
  isHorizontal: this.isHorizontal,
3089
3102
  speed: w.config.chart.animations.dynamicAnimation.speed
3090
3103
  });
@@ -3093,7 +3106,7 @@ class Bar {
3093
3106
  }
3094
3107
  return ret;
3095
3108
  }
3096
- /** @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 */
3109
+ /** @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 */
3097
3110
  renderSeries({
3098
3111
  hl,
3099
3112
  realIndex,
@@ -3125,7 +3138,9 @@ class Bar {
3125
3138
  visibleSeries,
3126
3139
  type,
3127
3140
  classes,
3128
- fadeReveal = false
3141
+ fadeReveal = false,
3142
+ noLabel
3143
+ // a datum's extra paths (box halves, box lane) label nothing
3129
3144
  }) {
3130
3145
  var _a, _b, _c, _d, _e, _f, _g;
3131
3146
  const w = this.w;
@@ -3199,7 +3214,8 @@ class Bar {
3199
3214
  barXPosition,
3200
3215
  barYPosition,
3201
3216
  visibleSeries,
3202
- hl: hl == null ? void 0 : hl.label
3217
+ hl: hl == null ? void 0 : hl.label,
3218
+ noLabel
3203
3219
  })
3204
3220
  );
3205
3221
  if (delayMs > 0) {
@@ -3215,19 +3231,18 @@ class Bar {
3215
3231
  }
3216
3232
  let leaving = false;
3217
3233
  if (!w.globals.isBarHorizontal) {
3218
- if (dataLabelsObj.dataLabelsPos.dataLabelsX + Math.max(barWidth, w.globals.barPadForNumericAxis) < 0 || dataLabelsObj.dataLabelsPos.dataLabelsX - Math.max(barWidth, w.globals.barPadForNumericAxis) > w.layout.gridWidth) {
3234
+ const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
3235
+ const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
3236
+ if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
3219
3237
  if (this._wasOnScreen(realIndex, j)) leaving = true;
3220
3238
  else skipDrawing = true;
3221
3239
  }
3222
3240
  }
3223
- if (
3224
- /** @type {Record<string,any>} */
3225
- w.config.series[i].data[j] && /** @type {Record<string,any>} */
3226
- w.config.series[i].data[j].strokeColor
3227
- ) {
3228
- lineFill = /** @type {Record<string,any>} */
3229
- w.config.series[i].data[j].strokeColor;
3230
- }
3241
+ const datum = (
3242
+ /** @type {any} */
3243
+ w.config.series[realIndex].data[j]
3244
+ );
3245
+ if (datum && datum.strokeColor) lineFill = datum.strokeColor;
3231
3246
  const fill = pathFill;
3232
3247
  if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
3233
3248
  pathFill = "none";
@@ -3250,7 +3265,7 @@ class Bar {
3250
3265
  pathTo,
3251
3266
  stroke: lineFill,
3252
3267
  strokeWidth,
3253
- strokeLineCap: w.config.stroke.lineCap,
3268
+ strokeLinecap: w.config.stroke.lineCap,
3254
3269
  fill: pathFill,
3255
3270
  pathToInterp,
3256
3271
  animationDelay: delay,
@@ -3302,12 +3317,12 @@ class Bar {
3302
3317
  cy: dataLabelsObj.dataLabelsPos.bcy,
3303
3318
  cx: dataLabelsObj.dataLabelsPos.bcx,
3304
3319
  j,
3305
- val: w.seriesData.series[i][j],
3320
+ val: w.seriesData.series[realIndex][j],
3306
3321
  barHeight,
3307
3322
  barWidth,
3308
3323
  // Datum identity for the next update's keyed join (see
3309
3324
  // LengthTransition): survivors match by key, not array position.
3310
- "data:pathKey": datumKey(w, realIndex, j)
3325
+ "data:pathKey": this._keys(realIndex)[j]
3311
3326
  });
3312
3327
  hl == null ? void 0 : hl.paint(renderedPath, {
3313
3328
  delay,
@@ -3383,7 +3398,10 @@ class Bar {
3383
3398
  const j = indexes.j;
3384
3399
  let barYPosition;
3385
3400
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
3386
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
3401
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
3402
+ i: indexes.realIndex,
3403
+ j
3404
+ });
3387
3405
  if (nonZeroColumns > 0) {
3388
3406
  barHeight = this.seriesLen * barHeight / nonZeroColumns;
3389
3407
  }
@@ -3522,7 +3540,7 @@ class Bar {
3522
3540
  barXPosition = xForNumericX.barXPosition;
3523
3541
  } else {
3524
3542
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
3525
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
3543
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
3526
3544
  if (nonZeroColumns > 0) {
3527
3545
  barWidth = this.seriesLen * barWidth / nonZeroColumns;
3528
3546
  }
@@ -3586,15 +3604,16 @@ class Bar {
3586
3604
  /** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
3587
3605
  getBarXForNumericXAxis({ x: x2, barWidth, realIndex, j }) {
3588
3606
  const w = this.w;
3607
+ const overlay = isHistogramOverlay(w);
3589
3608
  let sxI = realIndex;
3590
3609
  if (!w.seriesData.seriesX[realIndex].length) {
3591
3610
  sxI = w.globals.maxValsInArrayIndex;
3592
3611
  }
3593
3612
  if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
3594
- x2 = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
3613
+ x2 = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
3595
3614
  }
3596
3615
  return {
3597
- barXPosition: x2 + (isHistogramOverlay(w) ? 0 : barWidth * this.visibleI),
3616
+ barXPosition: x2 + (overlay ? 0 : barWidth * this.visibleI),
3598
3617
  x: x2
3599
3618
  };
3600
3619
  }
@@ -3615,7 +3634,20 @@ class Bar {
3615
3634
  _wasOnScreen(realIndex, j) {
3616
3635
  if (!lengthTransitionEnabled(this.w)) return false;
3617
3636
  const keyed = this._prevKeyedPaths(realIndex);
3618
- return !!keyed && keyed.has(datumKey(this.w, realIndex, j));
3637
+ return !!keyed && keyed.has(this._keys(realIndex)[j]);
3638
+ }
3639
+ /**
3640
+ * This render's datum keys for a series (see seriesKeys), as stamped on
3641
+ * each bar and looked up in the previous render's.
3642
+ * @param {number} realIndex
3643
+ * @returns {string[]}
3644
+ */
3645
+ _keys(realIndex) {
3646
+ const c = (
3647
+ /** @type {any} */
3648
+ this._keyCache || (this._keyCache = {})
3649
+ );
3650
+ return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
3619
3651
  }
3620
3652
  /**
3621
3653
  * The captured previous-render record for a series (last match wins, same
@@ -3671,7 +3703,7 @@ class Bar {
3671
3703
  * @returns {boolean}
3672
3704
  */
3673
3705
  isLengthTransition(realIndex) {
3674
- var _a, _b;
3706
+ var _a, _b, _c, _d, _e, _f;
3675
3707
  if (!this._ltCache) this._ltCache = {};
3676
3708
  if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
3677
3709
  const w = this.w;
@@ -3679,20 +3711,14 @@ class Bar {
3679
3711
  if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
3680
3712
  const record = this._prevRecord(realIndex);
3681
3713
  const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
3714
+ const keyed = record && this._prevKeyedPaths(realIndex);
3682
3715
  if (!record) {
3683
3716
  result = dataLen > 0;
3684
- } else if (record.paths.length !== dataLen) {
3685
- result = true;
3717
+ } else if (keyed) {
3718
+ const now = new Set(this._keys(realIndex));
3719
+ 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((k2) => !now.has(k2));
3686
3720
  } else {
3687
- const keyed = this._prevKeyedPaths(realIndex);
3688
- if (keyed) {
3689
- for (let j = 0; j < dataLen; j++) {
3690
- if (!keyed.has(datumKey(w, realIndex, j))) {
3691
- result = true;
3692
- break;
3693
- }
3694
- }
3695
- }
3721
+ result = record.paths.length !== dataLen;
3696
3722
  }
3697
3723
  }
3698
3724
  this._ltCache[realIndex] = result;
@@ -3752,7 +3778,7 @@ class Bar {
3752
3778
  let isNewDatum = false;
3753
3779
  const keyed = this._prevKeyedPaths(realIndex);
3754
3780
  if (keyed) {
3755
- const prev = keyed.get(datumKey(w, realIndex, j));
3781
+ const prev = keyed.get(this._keys(realIndex)[j]);
3756
3782
  if (prev) {
3757
3783
  oldD = prev.d;
3758
3784
  } else {
@@ -3895,11 +3921,10 @@ class Bar {
3895
3921
  * @returns {boolean | null} null when there is no previous record to consult
3896
3922
  */
3897
3923
  getPreviousFlip(realIndex, j) {
3898
- const w = this.w;
3899
3924
  const record = this._prevRecord(realIndex);
3900
3925
  if (!record) return null;
3901
3926
  const keyed = this._prevKeyedPaths(realIndex);
3902
- const prev = keyed ? keyed.get(datumKey(w, realIndex, j)) : record.paths[j];
3927
+ const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
3903
3928
  return prev ? !!prev.flip : null;
3904
3929
  }
3905
3930
  /**
@@ -3926,7 +3951,7 @@ class BarStacked extends Bar {
3926
3951
  const coreUtils = new CoreUtils(this.w);
3927
3952
  series = coreUtils.getLogSeries(series);
3928
3953
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
3929
- this.barHelpers.initVariables(series);
3954
+ this.barHelpers.initVariables(series, seriesIndex);
3930
3955
  if (w.config.chart.stackType === "100%") {
3931
3956
  series = w.globals.comboCharts ? (
3932
3957
  /** @type {any} */
@@ -3957,7 +3982,6 @@ class BarStacked extends Bar {
3957
3982
  const xArrValues = [];
3958
3983
  const yArrValues = [];
3959
3984
  const translationsIndex = this.setSeriesAxis(realIndex);
3960
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
3961
3985
  let elSeries = this.graphics.group({
3962
3986
  class: `apexcharts-series`,
3963
3987
  seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
@@ -4027,7 +4051,9 @@ class BarStacked extends Bar {
4027
4051
  null
4028
4052
  );
4029
4053
  if (this.isHorizontal) {
4030
- paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
4054
+ paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
4055
+ y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
4056
+ }), {
4031
4057
  zeroW,
4032
4058
  barHeight,
4033
4059
  yDivision
@@ -4101,6 +4127,7 @@ class BarStacked extends Bar {
4101
4127
  series,
4102
4128
  barHeight,
4103
4129
  barWidth,
4130
+ barXPosition: paths.barXPosition,
4104
4131
  elDataLabelsWrap,
4105
4132
  elGoalsMarkers,
4106
4133
  type: "bar",
@@ -4118,7 +4145,7 @@ class BarStacked extends Bar {
4118
4145
  this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
4119
4146
  ret.add(elSeries);
4120
4147
  }
4121
- if (heldMirrors) this.settleHeldMirrors();
4148
+ if (heldMirrors) this.settleHeldMirrors(ret);
4122
4149
  return ret;
4123
4150
  }
4124
4151
  /**
@@ -4139,15 +4166,21 @@ class BarStacked extends Bar {
4139
4166
  * 'bottom' → 'top', where the endpoint really is rounded at the other end;
4140
4167
  * everywhere else the mirror is an exact identity on the settled shape, so
4141
4168
  * removing it changes nothing on screen.
4169
+ *
4170
+ * The marks are collected now, not when the timer fires: a query then also
4171
+ * stripped the mirrors a LATER update was still holding mid-tween.
4172
+ * @param {any} [ret] this draw's series group (default: the whole chart)
4142
4173
  */
4143
- settleHeldMirrors() {
4174
+ settleHeldMirrors(ret) {
4144
4175
  const w = this.w;
4145
4176
  if (!Environment.isBrowser()) return;
4146
4177
  const anim = w.config.chart.animations;
4147
4178
  const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
4179
+ const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
4180
+ ".apexcharts-flip-held"
4181
+ );
4148
4182
  setTimeout(() => {
4149
- if (w.globals.isDestroyed || !Utils.elementExists(w.dom.baseEl)) return;
4150
- w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
4183
+ held.forEach((el) => {
4151
4184
  el.classList.remove(
4152
4185
  "apexcharts-flip-held",
4153
4186
  "apexcharts-flip-y",
@@ -4223,7 +4256,7 @@ class BarStacked extends Bar {
4223
4256
  yDivision,
4224
4257
  elSeries
4225
4258
  }) {
4226
- var _a, _b, _c, _d, _e;
4259
+ var _a, _b;
4227
4260
  const w = this.w;
4228
4261
  const barYPosition = y + columnGroupIndex * barHeight;
4229
4262
  let barXPosition;
@@ -4231,36 +4264,21 @@ class BarStacked extends Bar {
4231
4264
  const j = indexes.j;
4232
4265
  const realIndex = indexes.realIndex;
4233
4266
  const translationsIndex = indexes.translationsIndex;
4234
- let prevBarW = 0;
4235
- for (let k2 = 0; k2 < this.groupCtx.prevXF.length; k2++) {
4236
- prevBarW = prevBarW + this.groupCtx.prevXF[k2][j];
4237
- }
4238
- const gsi = this.groupCtx.prevX.length;
4239
- if (gsi > 0) {
4240
- let bXP = zeroW;
4241
- if (this.groupCtx.prevXVal[gsi - 1][j] < 0) {
4242
- bXP = /** @type {any} */
4243
- ((_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];
4244
- } else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) {
4245
- bXP = /** @type {any} */
4246
- ((_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;
4247
- }
4248
- barXPosition = bXP;
4249
- } else {
4250
- barXPosition = zeroW;
4251
- }
4252
- if (
4267
+ const v = (
4253
4268
  /** @type {any} */
4254
- ((_c = this.series[i]) == null ? void 0 : _c[j]) === null
4255
- ) {
4256
- x2 = barXPosition;
4269
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
4270
+ );
4271
+ const g = this.groupCtx;
4272
+ const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
4273
+ const top = g.tops.get(key);
4274
+ if (top) {
4275
+ const [prevX, prevVal, prevBarW] = top;
4276
+ const flip = (this.isReversed ? prevBarW : 0) * 2;
4277
+ barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
4257
4278
  } else {
4258
- x2 = barXPosition + /** @type {any} */
4259
- ((_d = this.series[i]) == null ? void 0 : _d[j]) / this.invertedYRatio - (this.isReversed ? (
4260
- /** @type {any} */
4261
- ((_e = this.series[i]) == null ? void 0 : _e[j]) / this.invertedYRatio
4262
- ) : 0) * 2;
4279
+ barXPosition = zeroW;
4263
4280
  }
4281
+ x2 = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
4264
4282
  const paths = this.barHelpers.getBarpaths({
4265
4283
  barYPosition,
4266
4284
  barHeight,
@@ -4274,6 +4292,7 @@ class BarStacked extends Bar {
4274
4292
  j,
4275
4293
  w
4276
4294
  });
4295
+ this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
4277
4296
  this.barHelpers.barBackground({
4278
4297
  j,
4279
4298
  i,
@@ -4311,13 +4330,17 @@ class BarStacked extends Bar {
4311
4330
  columnGroupIndex,
4312
4331
  elSeries
4313
4332
  }) {
4314
- var _a, _b, _c, _d, _e, _f;
4333
+ var _a, _b, _c;
4315
4334
  const w = this.w;
4316
4335
  const i = indexes.i;
4317
4336
  const j = indexes.j;
4318
4337
  const bc = indexes.bc;
4319
4338
  const realIndex = indexes.realIndex;
4320
4339
  const translationsIndex = indexes.translationsIndex;
4340
+ const v = (
4341
+ /** @type {any} */
4342
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
4343
+ );
4321
4344
  if (w.axisFlags.isXNumeric) {
4322
4345
  let seriesVal = w.seriesData.seriesX[realIndex][j];
4323
4346
  if (!seriesVal) seriesVal = 0;
@@ -4332,11 +4355,9 @@ class BarStacked extends Bar {
4332
4355
  const [prevYValue, prevVal, prevBarH] = top;
4333
4356
  let bYP;
4334
4357
  if (prevVal < 0) {
4335
- bYP = /** @type {any} */
4336
- ((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
4358
+ bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
4337
4359
  } else if (prevVal >= 0) {
4338
- bYP = /** @type {any} */
4339
- ((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
4360
+ bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
4340
4361
  }
4341
4362
  if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
4342
4363
  if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
@@ -4349,25 +4370,16 @@ class BarStacked extends Bar {
4349
4370
  } else {
4350
4371
  barYPosition = zeroH;
4351
4372
  }
4352
- if (
4353
- /** @type {any} */
4354
- (_d = this.series[i]) == null ? void 0 : _d[j]
4355
- ) {
4356
- y = barYPosition - /** @type {any} */
4357
- ((_e = this.series[i]) == null ? void 0 : _e[j]) / this.yRatio[translationsIndex] + (this.isReversed ? (
4358
- /** @type {any} */
4359
- ((_f = this.series[i]) == null ? void 0 : _f[j]) / this.yRatio[translationsIndex]
4360
- ) : 0) * 2;
4361
- } else {
4362
- y = barYPosition;
4363
- }
4373
+ y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
4364
4374
  const paths = this.barHelpers.getColumnPaths({
4365
4375
  barXPosition,
4366
4376
  barWidth,
4367
4377
  y1: barYPosition,
4368
4378
  y2: y,
4369
4379
  yRatio: this.yRatio[translationsIndex],
4370
- strokeWidth: this.strokeWidth,
4380
+ // the series' width even for an empty segment, so a hidden layer keeps
4381
+ // its place, but no inset at all when no stroke is drawn
4382
+ strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
4371
4383
  isReversed: this.isReversed,
4372
4384
  series: this.series,
4373
4385
  realIndex: indexes.realIndex,
@@ -4375,17 +4387,7 @@ class BarStacked extends Bar {
4375
4387
  j,
4376
4388
  w
4377
4389
  });
4378
- const t = g.yArrj[j];
4379
- if (!isNaN(t)) {
4380
- g.tops.set(key, [
4381
- t,
4382
- g.yArrjVal[j],
4383
- (top ? top[2] : 0) + g.yArrjF[j],
4384
- (top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
4385
- top ? Math.min(top[0], top[4]) : 1 / 0,
4386
- top ? Math.max(top[0], top[5]) : -1 / 0
4387
- ]);
4388
- }
4390
+ this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
4389
4391
  this.barHelpers.barBackground({
4390
4392
  bc,
4391
4393
  j,
@@ -4404,13 +4406,32 @@ class BarStacked extends Bar {
4404
4406
  zeroH,
4405
4407
  realIndex,
4406
4408
  j,
4407
- 0
4409
+ translationsIndex
4408
4410
  ),
4409
4411
  barXPosition,
4410
4412
  x: w.axisFlags.isXNumeric ? x2 : x2 + xDivision,
4411
4413
  y
4412
4414
  };
4413
4415
  }
4416
+ /**
4417
+ * Record the segment just drawn as the top of its stack. Per key it holds
4418
+ * the top and value of the last segment drawn there, the summed lengths and
4419
+ * raw values of every segment so far (the total label's value), and the
4420
+ * extreme tops below that segment (the total label's position).
4421
+ * @param {any} key @param {any} top @param {number} t @param {any} val
4422
+ * @param {number} len @param {number} realIndex @param {number} j
4423
+ */
4424
+ _setTop(key, top, t, val, len, realIndex, j) {
4425
+ if (isNaN(t)) return;
4426
+ this.groupCtx.tops.set(key, [
4427
+ t,
4428
+ val,
4429
+ (top ? top[2] : 0) + len,
4430
+ (top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
4431
+ top ? Math.min(top[0], top[4]) : 1 / 0,
4432
+ top ? Math.max(top[0], top[5]) : -1 / 0
4433
+ ]);
4434
+ }
4414
4435
  }
4415
4436
  class RangeBar extends Bar {
4416
4437
  /**
@@ -4418,14 +4439,14 @@ class RangeBar extends Bar {
4418
4439
  * @param {number} seriesIndex
4419
4440
  */
4420
4441
  draw(series, seriesIndex) {
4421
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4442
+ var _a, _b, _c, _d, _e, _f;
4422
4443
  const w = this.w;
4423
4444
  const graphics = new Graphics(this.w);
4424
4445
  this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
4425
4446
  this.series = series;
4426
4447
  this.seriesRangeStart = w.rangeData.seriesRangeStart;
4427
4448
  this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
4428
- this.barHelpers.initVariables(series);
4449
+ this.barHelpers.initVariables(series, seriesIndex);
4429
4450
  const ret = graphics.group({
4430
4451
  class: "apexcharts-rangebar-series apexcharts-plot-series"
4431
4452
  });
@@ -4447,6 +4468,9 @@ class RangeBar extends Bar {
4447
4468
  this.visibleI = this.visibleI + 1;
4448
4469
  }
4449
4470
  const translationsIndex = this.setSeriesAxis(realIndex);
4471
+ if (this.isHorizontal && w.labelData.timescaleLabels.length) {
4472
+ this.isReversed = false;
4473
+ }
4450
4474
  const initPositions = this.barHelpers.initialPositions(realIndex);
4451
4475
  const {
4452
4476
  y: initY,
@@ -4456,10 +4480,8 @@ class RangeBar extends Bar {
4456
4480
  zeroH
4457
4481
  // zeroH is the baseline where 0 meets y axis
4458
4482
  } = initPositions;
4459
- let barWidth = (_a = initPositions.barWidth) != null ? _a : 0;
4460
- let barHeight = (_b = initPositions.barHeight) != null ? _b : 0;
4461
- const yDivision = (_c = initPositions.yDivision) != null ? _c : 0;
4462
- const xDivision = (_d = initPositions.xDivision) != null ? _d : 0;
4483
+ const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
4484
+ const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
4463
4485
  y = initY;
4464
4486
  x2 = initX;
4465
4487
  const elDataLabelsWrap = graphics.group({
@@ -4469,10 +4491,16 @@ class RangeBar extends Bar {
4469
4491
  const elGoalsMarkers = graphics.group({
4470
4492
  class: "apexcharts-rangebar-goals-markers"
4471
4493
  });
4494
+ const data = (
4495
+ /** @type {any} */
4496
+ w.config.series[realIndex].data
4497
+ );
4472
4498
  for (let j = 0; j < w.globals.dataPoints; j++) {
4473
4499
  const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
4474
- const y1 = this.seriesRangeStart[i][j];
4475
- const y2 = this.seriesRangeEnd[i][j];
4500
+ let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
4501
+ let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
4502
+ const y1 = this.seriesRangeStart[realIndex][j];
4503
+ const y2 = this.seriesRangeEnd[realIndex][j];
4476
4504
  let paths = (
4477
4505
  /** @type {any} */
4478
4506
  null
@@ -4484,20 +4512,16 @@ class RangeBar extends Bar {
4484
4512
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
4485
4513
  seriesLen = 1;
4486
4514
  }
4487
- if (typeof /** @type {Record<string,any>} */
4488
- ((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
4515
+ if (typeof (data == null ? void 0 : data[j]) === "undefined") {
4489
4516
  break;
4490
4517
  }
4491
4518
  if (this.isHorizontal) {
4492
4519
  barYPosition = y + barHeight * /** @type {any} */
4493
4520
  this.visibleI;
4494
4521
  const srty = (yDivision - barHeight * seriesLen) / 2;
4495
- if (
4496
- /** @type {Record<string,any>} */
4497
- (_g = (_f = w.config.series[i].data) == null ? void 0 : _f[j]) == null ? void 0 : _g.x
4498
- ) {
4522
+ if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
4499
4523
  const positions = this.detectOverlappingBars({
4500
- i,
4524
+ i: realIndex,
4501
4525
  j,
4502
4526
  barYPosition,
4503
4527
  srty,
@@ -4520,17 +4544,14 @@ class RangeBar extends Bar {
4520
4544
  barWidth = paths.barWidth;
4521
4545
  } else {
4522
4546
  if (w.axisFlags.isXNumeric) {
4523
- x2 = (w.seriesData.seriesX[i][j] - w.globals.minX) / this.xRatio - barWidth / 2;
4547
+ x2 = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
4524
4548
  }
4525
4549
  barXPosition = x2 + barWidth * /** @type {any} */
4526
4550
  this.visibleI;
4527
4551
  const srtx = (xDivision - barWidth * seriesLen) / 2;
4528
- if (
4529
- /** @type {Record<string,any>} */
4530
- (_i = (_h = w.config.series[i].data) == null ? void 0 : _h[j]) == null ? void 0 : _i.x
4531
- ) {
4552
+ if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
4532
4553
  const positions = this.detectOverlappingBars({
4533
- i,
4554
+ i: realIndex,
4534
4555
  j,
4535
4556
  barXPosition,
4536
4557
  srtx,
@@ -4549,9 +4570,10 @@ class RangeBar extends Bar {
4549
4570
  xDivision
4550
4571
  }, params));
4551
4572
  barHeight = paths.barHeight;
4573
+ barXPosition = paths.barXPosition;
4552
4574
  }
4553
4575
  const barGoalLine = this.barHelpers.drawGoalLine({
4554
- barXPosition: paths.barXPosition,
4576
+ barXPosition,
4555
4577
  barYPosition,
4556
4578
  goalX: paths.goalX,
4557
4579
  goalY: paths.goalY,
@@ -4596,19 +4618,11 @@ class RangeBar extends Bar {
4596
4618
  });
4597
4619
  }
4598
4620
  if (w.globals.previousPaths.length > 0) {
4599
- const data = (
4600
- /** @type {Record<string,any>} */
4601
- w.config.series[i].data || []
4602
- );
4603
- const newKeys = [];
4604
- for (let j = 0; j < data.length; j++) {
4605
- newKeys.push(datumKey(w, realIndex, j));
4606
- }
4607
4621
  renderBarExitGhosts({
4608
4622
  w,
4609
4623
  elSeries,
4610
4624
  record: this._prevRecord(realIndex),
4611
- newKeys,
4625
+ newKeys: this._keys(realIndex),
4612
4626
  isHorizontal: this.isHorizontal,
4613
4627
  speed: w.config.chart.animations.dynamicAnimation.speed
4614
4628
  });
@@ -4660,11 +4674,11 @@ class RangeBar extends Bar {
4660
4674
  );
4661
4675
  if (overlaps.indexOf(rangeName) > -1) {
4662
4676
  barHeight = initPositions.barHeight / overlaps.length;
4663
- barYPosition = barHeight * this.visibleI + yDivision * (100 - parseInt(this.barOptions.barHeight, 10)) / 100 / 2 + barHeight * (this.visibleI + overlaps.indexOf(rangeName)) + yDivision * rowIndex;
4677
+ barYPosition += barHeight * overlaps.indexOf(rangeName);
4664
4678
  }
4665
4679
  }
4666
4680
  } else {
4667
- if (rowIndex > -1 && !w.labelData.timescaleLabels.length) {
4681
+ if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
4668
4682
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
4669
4683
  barXPosition = srtx + xDivision * rowIndex;
4670
4684
  } else {
@@ -4678,7 +4692,7 @@ class RangeBar extends Bar {
4678
4692
  );
4679
4693
  if (overlaps.indexOf(rangeName) > -1) {
4680
4694
  barWidth = initPositions.barWidth / overlaps.length;
4681
- barXPosition = barWidth * this.visibleI + xDivision * (100 - parseInt(this.barOptions.barWidth, 10)) / 100 / 2 + barWidth * (this.visibleI + overlaps.indexOf(rangeName)) + xDivision * rowIndex;
4695
+ barXPosition += barWidth * overlaps.indexOf(rangeName);
4682
4696
  }
4683
4697
  }
4684
4698
  }
@@ -4701,7 +4715,7 @@ class RangeBar extends Bar {
4701
4715
  var _a, _b;
4702
4716
  const w = this.w;
4703
4717
  const { i, j, realIndex, translationsIndex } = indexes;
4704
- const yRatio = this.yRatio[translationsIndex];
4718
+ const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
4705
4719
  const range = this.getRangeValue(realIndex, j);
4706
4720
  let y1 = Math.min(range.start, range.end);
4707
4721
  let y2 = Math.max(range.start, range.end);
@@ -4709,7 +4723,7 @@ class RangeBar extends Bar {
4709
4723
  ((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
4710
4724
  ((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
4711
4725
  if (!hasValue) {
4712
- y1 = zeroH;
4726
+ y1 = y2 = zeroH;
4713
4727
  } else {
4714
4728
  y1 = zeroH - y1 / yRatio;
4715
4729
  y2 = zeroH - y2 / yRatio;
@@ -4770,6 +4784,30 @@ class RangeBar extends Bar {
4770
4784
  barXPosition
4771
4785
  };
4772
4786
  }
4787
+ /**
4788
+ * Timeline datums key by their own row, not by the j-th label: a row can
4789
+ * hold several bars, so labels[j] names some other datum's row.
4790
+ * @param {number} realIndex
4791
+ * @returns {string[]}
4792
+ */
4793
+ _keys(realIndex) {
4794
+ const c = (
4795
+ /** @type {any} */
4796
+ this._keyCache || (this._keyCache = {})
4797
+ );
4798
+ const data = (
4799
+ /** @type {any} */
4800
+ this.w.config.series[realIndex].data
4801
+ );
4802
+ return c[realIndex] || (c[realIndex] = uniquifyKeys(
4803
+ (data || []).map(
4804
+ (d, j) => {
4805
+ var _a;
4806
+ return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
4807
+ }
4808
+ )
4809
+ ));
4810
+ }
4773
4811
  /**
4774
4812
  * @param {number} val
4775
4813
  */
@@ -4796,8 +4834,9 @@ class RangeBar extends Bar {
4796
4834
  }) {
4797
4835
  const w = this.w;
4798
4836
  const { realIndex, j } = indexes;
4799
- const x1 = this.preventBarOverflow(zeroW + y1 / this.invertedYRatio);
4800
- const x2 = this.preventBarOverflow(zeroW + y2 / this.invertedYRatio);
4837
+ const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
4838
+ const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
4839
+ const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
4801
4840
  const range = this.getRangeValue(realIndex, j);
4802
4841
  const barWidth = Math.abs(x2 - x1);
4803
4842
  const paths = this.barHelpers.getBarpaths({