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
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * ApexCharts v8.2.0
21
+ * ApexCharts v8.3.0
22
22
  * (c) 2018-2026 ApexCharts
23
23
  */
24
24
  import * as _core from "apexcharts/core";
@@ -36,181 +36,6 @@ const resolveDataLabelOffset = (value, w, seriesIndex, dataPointIndex) => {
36
36
  });
37
37
  return Number.isFinite(resolved) ? resolved : 0;
38
38
  };
39
- const Animations = _core.__apex_Animations;
40
- const computeStagger = _core.__apex_Animations_computeStagger;
41
- const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
42
- const Environment = _core.__apex_Environment_Environment;
43
- function lengthTransitionEnabled(w) {
44
- var _a;
45
- const anim = w.config.chart.animations;
46
- if (!anim || anim.enabled === false) return false;
47
- if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
48
- return false;
49
- }
50
- const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
51
- if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
52
- return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
53
- }
54
- function datumKey(w, realIndex, j) {
55
- var _a, _b, _c, _d;
56
- if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
57
- const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
58
- if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
59
- }
60
- const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
61
- if (lbl != null && String(lbl) !== "") {
62
- return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
63
- }
64
- return "j:" + j;
65
- }
66
- function frameDatumKey(frame, realIndex, j) {
67
- var _a, _b;
68
- if (frame.isXNumeric) {
69
- const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
70
- if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
71
- }
72
- const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
73
- if (lbl != null && String(lbl) !== "") {
74
- return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
75
- }
76
- return "j:" + j;
77
- }
78
- function joinKeys(oldKeys, newKeys) {
79
- const oldIndex = /* @__PURE__ */ new Map();
80
- oldKeys.forEach((k, i) => {
81
- if (!oldIndex.has(k)) oldIndex.set(k, i);
82
- });
83
- const toOld = new Array(newKeys.length);
84
- const usedOld = /* @__PURE__ */ new Set();
85
- let prev = -1;
86
- let ordered = true;
87
- let identity = oldKeys.length === newKeys.length;
88
- newKeys.forEach((k, i) => {
89
- const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
90
- toOld[i] = oi;
91
- if (oi !== -1) {
92
- usedOld.add(oi);
93
- if (oi < prev) ordered = false;
94
- prev = oi;
95
- }
96
- if (oi !== i) identity = false;
97
- });
98
- const exits = [];
99
- for (let i = 0; i < oldKeys.length; i++) {
100
- if (!usedOld.has(i)) exits.push(i);
101
- }
102
- return { toOld, exits, ordered, changed: !identity };
103
- }
104
- function uniquifyKeys(keys) {
105
- const seen = /* @__PURE__ */ new Map();
106
- return keys.map((k) => {
107
- const count = seen.get(k) || 0;
108
- seen.set(k, count + 1);
109
- return count === 0 ? k : `${k}#${count}`;
110
- });
111
- }
112
- function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
113
- var _a, _b;
114
- if (!lengthTransitionEnabled(w)) return null;
115
- const frame = w.globals.prevStreamFrame;
116
- if (!frame) return null;
117
- const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
118
- const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
119
- if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
120
- if (!oldY.length || !newY.length) return null;
121
- const oldKeys = uniquifyKeys(
122
- oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
123
- );
124
- const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)));
125
- const join = joinKeys(oldKeys, newKeys);
126
- if (!join.ordered && !allowReorder) return null;
127
- if (!join.changed && !includeIdentity) return null;
128
- return { join, oldKeys, newKeys };
129
- }
130
- function firstMove(d) {
131
- const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
132
- if (!m) return null;
133
- const x = parseFloat(m[1]);
134
- const y = parseFloat(m[2]);
135
- return isFinite(x) && isFinite(y) ? { x, y } : null;
136
- }
137
- function renderBarExitGhosts({
138
- w,
139
- elSeries,
140
- record,
141
- newKeys,
142
- isHorizontal,
143
- speed
144
- }) {
145
- var _a;
146
- if (!lengthTransitionEnabled(w)) return;
147
- if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
148
- const newKeySet = new Set(newKeys);
149
- const exits = record.paths.filter(
150
- (p) => p && p.d && p.key != null && !newKeySet.has(p.key)
151
- );
152
- if (!exits.length) return;
153
- const graphics = new Graphics(w);
154
- const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
155
- exits.forEach((p) => {
156
- let fill = p.fill || fallbackFill || "#c8c8c8";
157
- if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
158
- const ghost = graphics.drawPath({
159
- d: p.d,
160
- stroke: "none",
161
- strokeWidth: 0,
162
- fill,
163
- fillOpacity: 1,
164
- classes: "apexcharts-bar-ghost"
165
- });
166
- const node = ghost.node;
167
- node.setAttribute("pointer-events", "none");
168
- ghost.attr(
169
- "clip-path",
170
- `url(#gridRectBarMask${w.globals.cuid})`
171
- );
172
- elSeries.node.insertBefore(node, elSeries.node.firstChild);
173
- const start = firstMove(p.d);
174
- let origin = isHorizontal ? "left center" : "center bottom";
175
- try {
176
- const bb = node.getBBox();
177
- if (start && bb) {
178
- if (isHorizontal) {
179
- origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
180
- } else {
181
- origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
182
- }
183
- }
184
- } catch (_) {
185
- }
186
- const style = node.style;
187
- style.transformBox = "fill-box";
188
- style.transformOrigin = origin;
189
- node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
190
- try {
191
- const bb = node.getBBox();
192
- const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
193
- if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
194
- } catch (_) {
195
- }
196
- const duration = Math.max(1, speed || 1);
197
- const startAt = performance.now();
198
- const step = (now) => {
199
- if (w.globals.isDestroyed || !node.parentNode) return;
200
- const t = Math.max(0, Math.min(1, (now - startAt) / duration));
201
- const eased = 1 - Math.pow(1 - t, 3);
202
- const scale = 1 - eased;
203
- style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
204
- style.opacity = String(1 - eased);
205
- if (t < 1) {
206
- BrowserAPIs.requestAnimationFrame(step);
207
- } else {
208
- node.parentNode.removeChild(node);
209
- }
210
- };
211
- BrowserAPIs.requestAnimationFrame(step);
212
- });
213
- }
214
39
  class BarDataLabels {
215
40
  /**
216
41
  * @param {import('../../../charts/Bar').default} barCtx
@@ -246,7 +71,8 @@ class BarDataLabels {
246
71
  barXPosition,
247
72
  barYPosition,
248
73
  visibleSeries,
249
- hl
74
+ hl,
75
+ noLabel
250
76
  } = opts;
251
77
  const w = this.w;
252
78
  const graphics = new Graphics(this.barCtx.w);
@@ -360,7 +186,7 @@ class BarDataLabels {
360
186
  dataLabelsPos.dataLabelsX = (box.levelStart + box.levelEnd) / 2 + offX;
361
187
  }
362
188
  }
363
- dataLabels = this.drawCalculatedDataLabels({
189
+ dataLabels = noLabel ? null : this.drawCalculatedDataLabels({
364
190
  x: dataLabelsPos.dataLabelsX,
365
191
  y: dataLabelsPos.dataLabelsY,
366
192
  neg: params.neg,
@@ -446,8 +272,8 @@ class BarDataLabels {
446
272
  return ctx && byGroups && byGroups[ctx.groupIndex] ? byGroups[ctx.groupIndex][j] : this.barCtx.stackedSeriesTotals[j];
447
273
  }
448
274
  /**
449
- * The running stack at this column's x (BarStacked `tops`, columns only) on
450
- * a numeric axis, where columns stack by x rather than by index.
275
+ * The running stack at this bar's x (BarStacked `tops`) on a numeric axis,
276
+ * where bars stack by x rather than by index.
451
277
  * @param {number} realIndex @param {number} j
452
278
  */
453
279
  xStackTop(realIndex, j) {
@@ -456,6 +282,21 @@ class BarDataLabels {
456
282
  return w.axisFlags.isXNumeric && /** @type {any} */
457
283
  ((_b = (_a = this.barCtx.stacks) == null ? void 0 : _a[w.labelData.seriesGroupIndex[realIndex]]) == null ? void 0 : _b.tops.get(w.seriesData.seriesX[realIndex][j]));
458
284
  }
285
+ /**
286
+ * The stacked total's text box, measured in the total's own font.
287
+ * @param {number} realIndex @param {number} j
288
+ */
289
+ totalRects(realIndex, j) {
290
+ const s = this.barCtx.barOptions.dataLabels.total.style;
291
+ return new Graphics(this.w).getTextRects(
292
+ this.getStackedTotalDataLabel({ realIndex, j }),
293
+ s.fontSize,
294
+ s.fontFamily,
295
+ void 0,
296
+ true,
297
+ s.fontWeight
298
+ );
299
+ }
459
300
  /** @param {{realIndex: any, j: any}} opts */
460
301
  getStackedTotalDataLabel({ realIndex, j }) {
461
302
  const w = this.w;
@@ -476,7 +317,6 @@ class BarDataLabels {
476
317
  var _a;
477
318
  const w = this.w;
478
319
  let {
479
- i,
480
320
  j,
481
321
  realIndex,
482
322
  y,
@@ -486,7 +326,6 @@ class BarDataLabels {
486
326
  textRects,
487
327
  dataLabelsX,
488
328
  dataLabelsY,
489
- dataLabelsConfig,
490
329
  barDataLabelsConfig,
491
330
  barTotalDataLabelsConfig,
492
331
  strokeWidth,
@@ -500,7 +339,7 @@ class BarDataLabels {
500
339
  barHeight = Math.abs(barHeight);
501
340
  const vertical = w.config.plotOptions.bar.dataLabels.orientation === "vertical";
502
341
  const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
503
- i,
342
+ i: realIndex,
504
343
  j
505
344
  });
506
345
  bcx = bcx - strokeWidth / 2;
@@ -521,7 +360,7 @@ class BarDataLabels {
521
360
  const offsetDLX = 2;
522
361
  dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX;
523
362
  }
524
- const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[i][j] < 0;
363
+ const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[realIndex][j] < 0;
525
364
  let newY = y;
526
365
  if (this.barCtx.isReversed) {
527
366
  newY = y + (valIsNegative ? barHeight : -barHeight);
@@ -595,16 +434,11 @@ class BarDataLabels {
595
434
  });
596
435
  if (this.hlt) lowestPrevY = this.hlt.edge;
597
436
  if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
598
- const ADDITIONAL_OFFY = 18;
599
- const graphics = new Graphics(this.barCtx.w);
600
- const totalLabeltextRects = graphics.getTextRects(
601
- this.getStackedTotalDataLabel({ realIndex, j }),
602
- dataLabelsConfig.fontSize
603
- );
437
+ const h = this.totalRects(realIndex, j).height;
604
438
  if (valIsNegative) {
605
- totalDataLabelsY = lowestPrevY - totalLabeltextRects.height / 2 - offY - barTotalDataLabelsConfig.offsetY + ADDITIONAL_OFFY;
439
+ totalDataLabelsY = lowestPrevY + h * 0.77 - offY - barTotalDataLabelsConfig.offsetY;
606
440
  } else {
607
- totalDataLabelsY = lowestPrevY + totalLabeltextRects.height + offY + barTotalDataLabelsConfig.offsetY - ADDITIONAL_OFFY;
441
+ totalDataLabelsY = lowestPrevY - h * 0.3 + offY + barTotalDataLabelsConfig.offsetY;
608
442
  }
609
443
  const xDivision = dataPointsDividedWidth;
610
444
  totalDataLabelsX = totalDataLabelsBcx + (w.axisFlags.isXNumeric ? -barWidth / 2 : barWidth / 2 - xDivision) + barTotalDataLabelsConfig.offsetX;
@@ -634,7 +468,6 @@ class BarDataLabels {
634
468
  const w = this.w;
635
469
  let {
636
470
  x,
637
- i,
638
471
  j,
639
472
  realIndex,
640
473
  bcy,
@@ -651,7 +484,7 @@ class BarDataLabels {
651
484
  } = opts;
652
485
  const dataPointsDividedHeight = w.layout.gridHeight / w.globals.dataPoints;
653
486
  const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
654
- i,
487
+ i: realIndex,
655
488
  j
656
489
  });
657
490
  barWidth = Math.abs(barWidth);
@@ -668,7 +501,7 @@ class BarDataLabels {
668
501
  let totalDataLabelsX;
669
502
  let totalDataLabelsY;
670
503
  let totalDataLabelsAnchor = "start";
671
- const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[i][j] < 0;
504
+ const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[realIndex][j] < 0;
672
505
  let newX = x;
673
506
  if (this.barCtx.isReversed) {
674
507
  newX = x + (valIsNegative ? -barWidth : barWidth);
@@ -703,10 +536,14 @@ class BarDataLabels {
703
536
  }
704
537
  let lowestPrevX = newX;
705
538
  const totalGroupCtx = this.getTotalGroupContext(realIndex);
706
- const stacks = (
539
+ const top = this.xStackTop(realIndex, j);
540
+ const stacks = top ? [] : (
707
541
  /** @type {any} */
708
542
  this.barCtx.stacks || []
709
543
  );
544
+ if (top) {
545
+ lowestPrevX = valIsNegative ? Math.min(newX, top[4]) : Math.max(newX, top[5]);
546
+ }
710
547
  stacks.forEach((g, gi) => {
711
548
  if (totalGroupCtx && gi !== totalGroupCtx.groupIndex) return;
712
549
  g.prevX.forEach((arr) => {
@@ -719,11 +556,7 @@ class BarDataLabels {
719
556
  });
720
557
  if (this.hlt) lowestPrevX = this.hlt.edge;
721
558
  if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
722
- const graphics = new Graphics(this.barCtx.w);
723
- const totalLabeltextRects = graphics.getTextRects(
724
- this.getStackedTotalDataLabel({ realIndex, j }),
725
- dataLabelsConfig.fontSize
726
- );
559
+ const totalLabeltextRects = this.totalRects(realIndex, j);
727
560
  if (valIsNegative) {
728
561
  totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX;
729
562
  totalDataLabelsAnchor = "end";
@@ -792,8 +625,9 @@ class BarDataLabels {
792
625
  let elDataLabelsWrap = null;
793
626
  const isSeriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1;
794
627
  const isSeriesCollapsing = (w.globals.collapsingSeriesIndices || []).indexOf(i) > -1;
628
+ const dlKey = `${i}::${this.barCtx._keys(i)[j]}`;
795
629
  if (isSeriesCollapsing) {
796
- const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(`${i}::${datumKey(w, i, j)}`);
630
+ const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(dlKey);
797
631
  if (prev && isFinite(prev.val)) {
798
632
  val = prev.val;
799
633
  text = void 0;
@@ -806,10 +640,7 @@ class BarDataLabels {
806
640
  });
807
641
  const dlCfg = w.config.dataLabels;
808
642
  if (((_b = dlCfg.animate) == null ? void 0 : _b.enabled) || ((_c = dlCfg.countUp) == null ? void 0 : _c.enabled)) {
809
- elDataLabelsWrap.node.setAttribute(
810
- "data:dlKey",
811
- `${i}::${datumKey(w, i, j)}`
812
- );
643
+ elDataLabelsWrap.node.setAttribute("data:dlKey", dlKey);
813
644
  elDataLabelsWrap.node.setAttribute("data:dlJ", String(j));
814
645
  if (typeof val === "number" && isFinite(val)) {
815
646
  elDataLabelsWrap.node.setAttribute("data:dlVal", String(val));
@@ -827,29 +658,12 @@ class BarDataLabels {
827
658
  if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
828
659
  text = "";
829
660
  }
830
- const valIsNegative = neg != null ? neg : w.seriesData.series[i][j] < 0;
831
- const position = w.config.plotOptions.bar.dataLabels.position;
661
+ let anchor = dataLabelsConfig.textAnchor;
832
662
  if (w.config.plotOptions.bar.dataLabels.orientation === "vertical") {
833
- if (position === "top") {
834
- if (valIsNegative) dataLabelsConfig.textAnchor = "end";
835
- else dataLabelsConfig.textAnchor = "start";
836
- }
837
- if (position === "center") {
838
- dataLabelsConfig.textAnchor = "middle";
839
- }
840
- if (position === "bottom") {
841
- if (valIsNegative) dataLabelsConfig.textAnchor = "end";
842
- else dataLabelsConfig.textAnchor = "start";
843
- }
663
+ anchor = w.config.plotOptions.bar.dataLabels.position === "center" ? "middle" : (neg != null ? neg : w.seriesData.series[i][j] < 0) ? "end" : "start";
844
664
  }
845
- if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) {
846
- const txRect = graphics.getTextRects(
847
- text,
848
- parseFloat(dataLabelsConfig.style.fontSize).toString()
849
- );
850
- if (barWidth < txRect.width) {
851
- text = "";
852
- }
665
+ if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && barWidth < textRects.width) {
666
+ text = "";
853
667
  }
854
668
  if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && // A collapsing series is measured against its NEW extent, which is
855
669
  // already zero, so this would blank a label whose bar is still at full
@@ -865,14 +679,14 @@ class BarDataLabels {
865
679
  }
866
680
  }
867
681
  }
868
- const modifiedDataLabelsConfig = __spreadValues({}, dataLabelsConfig);
869
- if (this.barCtx.isHorizontal) {
870
- if (val < 0) {
871
- if (dataLabelsConfig.textAnchor === "start") {
872
- modifiedDataLabelsConfig.textAnchor = "end";
873
- } else if (dataLabelsConfig.textAnchor === "end") {
874
- modifiedDataLabelsConfig.textAnchor = "start";
875
- }
682
+ const modifiedDataLabelsConfig = __spreadProps(__spreadValues({}, dataLabelsConfig), {
683
+ textAnchor: anchor
684
+ });
685
+ if (this.barCtx.isHorizontal && val < 0) {
686
+ if (anchor === "start") {
687
+ modifiedDataLabelsConfig.textAnchor = "end";
688
+ } else if (anchor === "end") {
689
+ modifiedDataLabelsConfig.textAnchor = "start";
876
690
  }
877
691
  }
878
692
  dataLabels.plotDataLabelsText({
@@ -924,7 +738,7 @@ class BarDataLabels {
924
738
  const { groupIndex } = this.barCtx.barHelpers.getGroupIndex(realIndex);
925
739
  totalDataLabelText.node.setAttribute(
926
740
  "data:dlTotalKey",
927
- `${groupIndex}::${datumKey(this.w, realIndex, j)}`
741
+ `${groupIndex}::${this.barCtx._keys(realIndex)[j]}`
928
742
  );
929
743
  totalDataLabelText.node.setAttribute(
930
744
  "data:dlTotalSeries",
@@ -940,6 +754,7 @@ class BarDataLabels {
940
754
  }
941
755
  const Series = _core.__apex_Series;
942
756
  const Fill = _core.__apex_Fill;
757
+ const CoreUtils = _core.__apex_CoreUtils;
943
758
  const Utils = _core.__apex_Utils;
944
759
  function isHistogramOverlay(w) {
945
760
  var _a, _b, _c, _d, _e, _f, _g;
@@ -957,9 +772,11 @@ class Helpers {
957
772
  }
958
773
  /**
959
774
  * @param {any[]} series
775
+ * @param {any} [seriesIndex] a combo's real indices of `series`
960
776
  */
961
- initVariables(series) {
777
+ initVariables(series, seriesIndex) {
962
778
  const w = this.w;
779
+ this.seriesIndex = seriesIndex;
963
780
  this.barCtx.series = series;
964
781
  this.barCtx.totalItems = 0;
965
782
  this.barCtx.seriesLen = 0;
@@ -980,6 +797,8 @@ class Helpers {
980
797
  this.barCtx.visibleItems = w.globals.dataPoints;
981
798
  }
982
799
  }
800
+ const labels = w.labelData.labels;
801
+ 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;
983
802
  this.arrBorderRadius = this.createBorderRadiusArr(w.seriesData.series);
984
803
  if (Utils.isSafari()) {
985
804
  this.arrBorderRadius = this.arrBorderRadius.map(
@@ -1044,15 +863,19 @@ class Helpers {
1044
863
  * Collapsed series count too, exactly as they did for `minXDiff`. Skipping
1045
864
  * them would widen every bar the moment someone hid the tightest-spaced
1046
865
  * series from the legend, so bar geometry would depend on legend state.
866
+ * In a combo only this renderer's own series count: a line's x values say
867
+ * nothing about how wide a column may be.
1047
868
  *
1048
869
  * @returns {number}
1049
870
  */
1050
871
  _unionMinXGap() {
1051
872
  const w = this.w;
1052
873
  const seriesX = w.seriesData.seriesX || [];
874
+ const own = this.seriesIndex;
1053
875
  const arrays = [];
1054
876
  for (let i = 0; i < seriesX.length; i++) {
1055
877
  const xs = seriesX[i];
878
+ if (own && own.indexOf(i) < 0) continue;
1056
879
  if (Array.isArray(xs) && xs.length > 0) {
1057
880
  arrays.push(
1058
881
  xs.some((v, n) => v < xs[n - 1]) ? xs.filter((v) => v === +v).sort((a, b) => a - b) : xs
@@ -1093,6 +916,15 @@ class Helpers {
1093
916
  }
1094
917
  return isFinite(min) ? min : 0;
1095
918
  }
919
+ /**
920
+ * The band a horizontal bar is drawn in: its x's band when the series do
921
+ * not line up by index (see initVariables), else its index.
922
+ * @param {number} realIndex @param {number} j
923
+ */
924
+ barRow(realIndex, j) {
925
+ var _a, _b, _c;
926
+ return (_c = (_b = this.rows) == null ? void 0 : _b.get((_a = this.w.seriesData.seriesX[realIndex]) == null ? void 0 : _a[j])) != null ? _c : j;
927
+ }
1096
928
  /**
1097
929
  * @param {number} realIndex
1098
930
  */
@@ -1215,7 +1047,7 @@ class Helpers {
1215
1047
  });
1216
1048
  }
1217
1049
  const connectorFill = this.getDumbbellConnectorFill(i, j);
1218
- const datumFill = connectorFill || ((_a = w.config.series[i].data[j]) == null ? void 0 : _a.fill);
1050
+ const datumFill = connectorFill || ((_a = w.config.series[realIndex].data[j]) == null ? void 0 : _a.fill);
1219
1051
  const connector = this.barCtx.barOptions.isDumbbell ? w.config.plotOptions.bar.dumbbell.connector : null;
1220
1052
  let connectorOpacity;
1221
1053
  if (connector && connector.color) {
@@ -1368,11 +1200,10 @@ class Helpers {
1368
1200
  * @returns {string[][]}
1369
1201
  */
1370
1202
  createBorderRadiusArr(series) {
1371
- var _a;
1372
1203
  const w = this.w;
1373
1204
  const alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0;
1374
1205
  const numSeries = series.length;
1375
- const numColumns = ((_a = series[0]) == null ? void 0 : _a.length) | 0;
1206
+ const numColumns = Math.max(0, ...series.map((s) => (s == null ? void 0 : s.length) | 0));
1376
1207
  const output = Array.from(
1377
1208
  { length: numSeries },
1378
1209
  () => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
@@ -1528,7 +1359,7 @@ class Helpers {
1528
1359
  j,
1529
1360
  w
1530
1361
  }) {
1531
- var _a, _b;
1362
+ var _a, _b, _c;
1532
1363
  const r = this.barRect({
1533
1364
  a: barXPosition,
1534
1365
  len: barWidth,
@@ -1559,7 +1390,7 @@ class Helpers {
1559
1390
  const _ctx = this.barCtx.groupCtx;
1560
1391
  _ctx.yArrj.push(y2 - strokeCenter * direction);
1561
1392
  _ctx.yArrjF.push(Math.abs(y1 - y2 + r.strokeWidth * direction));
1562
- _ctx.yArrjVal.push(this.barCtx.series[i][j]);
1393
+ _ctx.yArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
1563
1394
  }
1564
1395
  return {
1565
1396
  pathTo,
@@ -1749,7 +1580,7 @@ class Helpers {
1749
1580
  j,
1750
1581
  w
1751
1582
  }) {
1752
- var _a, _b;
1583
+ var _a, _b, _c;
1753
1584
  const graphics = new Graphics(this.barCtx.w);
1754
1585
  const r = this.barRect({
1755
1586
  a: barYPosition,
@@ -1785,7 +1616,7 @@ class Helpers {
1785
1616
  const _ctx = this.barCtx.groupCtx;
1786
1617
  _ctx.xArrj.push(x2 + strokeCenter * direction);
1787
1618
  _ctx.xArrjF.push(Math.abs(x1 - x2 - r.strokeWidth * direction));
1788
- _ctx.xArrjVal.push(this.barCtx.series[i][j]);
1619
+ _ctx.xArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
1789
1620
  }
1790
1621
  return {
1791
1622
  pathTo,
@@ -1830,6 +1661,9 @@ class Helpers {
1830
1661
  const w = this.w;
1831
1662
  const goals = [];
1832
1663
  const pushGoal = (value, attrs) => {
1664
+ if (!w.globals.invalidLogScale) {
1665
+ value = new CoreUtils(w).getLogValAtSeriesIndex(value, i);
1666
+ }
1833
1667
  goals.push({
1834
1668
  [type]: type === "x" ? this.getXForValue(value, zeroW, false) : this.getYForValue(value, zeroH, translationsIndex, false),
1835
1669
  attrs
@@ -2084,11 +1918,11 @@ class Helpers {
2084
1918
  let zeroEncounters = 0;
2085
1919
  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)) || [];
2086
1920
  seriesIndices.forEach((_si) => {
2087
- const val = w.globals.seriesPercent[_si][j];
1921
+ const val = w.seriesData.series[_si][j];
2088
1922
  if (val) {
2089
1923
  nonZeroColumns++;
2090
1924
  }
2091
- if (_si < i && val === 0) {
1925
+ if (_si < i && !val) {
2092
1926
  zeroEncounters++;
2093
1927
  }
2094
1928
  });
@@ -2125,8 +1959,187 @@ class Helpers {
2125
1959
  return { groupIndex, columnGroupIndex };
2126
1960
  }
2127
1961
  }
2128
- const CoreUtils = _core.__apex_CoreUtils;
2129
1962
  const Filters = _core.__apex_Filters;
1963
+ const Animations = _core.__apex_Animations;
1964
+ const computeStagger = _core.__apex_Animations_computeStagger;
1965
+ const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
1966
+ const Environment = _core.__apex_Environment_Environment;
1967
+ function lengthTransitionEnabled(w) {
1968
+ var _a;
1969
+ const anim = w.config.chart.animations;
1970
+ if (!anim || anim.enabled === false) return false;
1971
+ if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
1972
+ return false;
1973
+ }
1974
+ const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
1975
+ if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
1976
+ return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
1977
+ }
1978
+ function datumKey(w, realIndex, j) {
1979
+ var _a, _b, _c, _d;
1980
+ if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
1981
+ const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
1982
+ if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
1983
+ }
1984
+ const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
1985
+ if (lbl != null && String(lbl) !== "") {
1986
+ return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
1987
+ }
1988
+ return "j:" + j;
1989
+ }
1990
+ function frameDatumKey(frame, realIndex, j) {
1991
+ var _a, _b;
1992
+ if (frame.isXNumeric) {
1993
+ const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
1994
+ if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
1995
+ }
1996
+ const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
1997
+ if (lbl != null && String(lbl) !== "") {
1998
+ return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
1999
+ }
2000
+ return "j:" + j;
2001
+ }
2002
+ function joinKeys(oldKeys, newKeys) {
2003
+ const oldIndex = /* @__PURE__ */ new Map();
2004
+ oldKeys.forEach((k, i) => {
2005
+ if (!oldIndex.has(k)) oldIndex.set(k, i);
2006
+ });
2007
+ const toOld = new Array(newKeys.length);
2008
+ const usedOld = /* @__PURE__ */ new Set();
2009
+ let prev = -1;
2010
+ let ordered = true;
2011
+ let identity = oldKeys.length === newKeys.length;
2012
+ newKeys.forEach((k, i) => {
2013
+ const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
2014
+ toOld[i] = oi;
2015
+ if (oi !== -1) {
2016
+ usedOld.add(oi);
2017
+ if (oi < prev) ordered = false;
2018
+ prev = oi;
2019
+ }
2020
+ if (oi !== i) identity = false;
2021
+ });
2022
+ const exits = [];
2023
+ for (let i = 0; i < oldKeys.length; i++) {
2024
+ if (!usedOld.has(i)) exits.push(i);
2025
+ }
2026
+ return { toOld, exits, ordered, changed: !identity };
2027
+ }
2028
+ function uniquifyKeys(keys) {
2029
+ const seen = /* @__PURE__ */ new Map();
2030
+ return keys.map((k) => {
2031
+ const count = seen.get(k) || 0;
2032
+ seen.set(k, count + 1);
2033
+ return count === 0 ? k : `${k}#${count}`;
2034
+ });
2035
+ }
2036
+ function seriesKeys(w, realIndex, n = ((_a) => (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length)() | 0) {
2037
+ return uniquifyKeys(
2038
+ Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j))
2039
+ );
2040
+ }
2041
+ function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
2042
+ var _a, _b;
2043
+ if (!lengthTransitionEnabled(w)) return null;
2044
+ const frame = w.globals.prevStreamFrame;
2045
+ if (!frame) return null;
2046
+ const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
2047
+ const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
2048
+ if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
2049
+ if (!oldY.length || !newY.length) return null;
2050
+ const oldKeys = uniquifyKeys(
2051
+ oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
2052
+ );
2053
+ const newKeys = seriesKeys(w, realIndex);
2054
+ const join = joinKeys(oldKeys, newKeys);
2055
+ if (!join.ordered && !allowReorder) return null;
2056
+ if (!join.changed && !includeIdentity) return null;
2057
+ return { join, oldKeys, newKeys };
2058
+ }
2059
+ function firstMove(d) {
2060
+ const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
2061
+ if (!m) return null;
2062
+ const x = parseFloat(m[1]);
2063
+ const y = parseFloat(m[2]);
2064
+ return isFinite(x) && isFinite(y) ? { x, y } : null;
2065
+ }
2066
+ function renderBarExitGhosts({
2067
+ w,
2068
+ elSeries,
2069
+ record,
2070
+ newKeys,
2071
+ isHorizontal,
2072
+ speed
2073
+ }) {
2074
+ var _a;
2075
+ if (!lengthTransitionEnabled(w)) return;
2076
+ if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
2077
+ const newKeySet = new Set(newKeys);
2078
+ const exits = record.paths.filter(
2079
+ (p) => p && p.d && p.key != null && !newKeySet.has(p.key)
2080
+ );
2081
+ if (!exits.length) return;
2082
+ const graphics = new Graphics(w);
2083
+ const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
2084
+ exits.forEach((p) => {
2085
+ let fill = p.fill || fallbackFill || "#c8c8c8";
2086
+ if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
2087
+ const ghost = graphics.drawPath({
2088
+ d: p.d,
2089
+ stroke: "none",
2090
+ strokeWidth: 0,
2091
+ fill,
2092
+ fillOpacity: 1,
2093
+ classes: "apexcharts-bar-ghost"
2094
+ });
2095
+ const node = ghost.node;
2096
+ node.setAttribute("pointer-events", "none");
2097
+ ghost.attr(
2098
+ "clip-path",
2099
+ `url(#gridRectBarMask${w.globals.cuid})`
2100
+ );
2101
+ elSeries.node.insertBefore(node, elSeries.node.firstChild);
2102
+ const start = firstMove(p.d);
2103
+ let origin = isHorizontal ? "left center" : "center bottom";
2104
+ try {
2105
+ const bb = node.getBBox();
2106
+ if (start && bb) {
2107
+ if (isHorizontal) {
2108
+ origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
2109
+ } else {
2110
+ origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
2111
+ }
2112
+ }
2113
+ } catch (_) {
2114
+ }
2115
+ const style = node.style;
2116
+ style.transformBox = "fill-box";
2117
+ style.transformOrigin = origin;
2118
+ node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
2119
+ try {
2120
+ const bb = node.getBBox();
2121
+ const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
2122
+ if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
2123
+ } catch (_) {
2124
+ }
2125
+ const duration = Math.max(1, speed || 1);
2126
+ const startAt = performance.now();
2127
+ const step = (now) => {
2128
+ if (w.globals.isDestroyed || !node.parentNode) return;
2129
+ const t = Math.max(0, Math.min(1, (now - startAt) / duration));
2130
+ const eased = 1 - Math.pow(1 - t, 3);
2131
+ const scale = 1 - eased;
2132
+ style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
2133
+ style.opacity = String(1 - eased);
2134
+ if (t < 1) {
2135
+ BrowserAPIs.requestAnimationFrame(step);
2136
+ } else {
2137
+ node.parentNode.removeChild(node);
2138
+ }
2139
+ };
2140
+ BrowserAPIs.requestAnimationFrame(step);
2141
+ });
2142
+ }
2130
2143
  class AxisMapping {
2131
2144
  /**
2132
2145
  * Pixels per data-unit on the x-axis. Derived from `minX..maxX` so it is the
@@ -2245,15 +2258,17 @@ class Bar {
2245
2258
  /**
2246
2259
  * Point the per-series axis state at this series' y axis. Every bar-family
2247
2260
  * renderer calls it before initialPositions, which reads the baseline by
2248
- * this.translationsIndex.
2261
+ * this.translationsIndex and flips it for a reversed axis.
2249
2262
  * @param {number} realIndex
2250
2263
  * @return {number} translationsIndex
2251
2264
  */
2252
2265
  setSeriesAxis(realIndex) {
2266
+ var _a;
2253
2267
  if (this.yRatio.length > 1) {
2254
2268
  this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
2255
2269
  this.translationsIndex = realIndex;
2256
2270
  }
2271
+ this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
2257
2272
  return this.translationsIndex;
2258
2273
  }
2259
2274
  /** primary draw method which is called on bar object
@@ -2270,7 +2285,7 @@ class Bar {
2270
2285
  series = coreUtils.getLogSeries(series);
2271
2286
  this.series = series;
2272
2287
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
2273
- this.barHelpers.initVariables(series);
2288
+ this.barHelpers.initVariables(series, seriesIndex);
2274
2289
  const ret = graphics.group({
2275
2290
  class: "apexcharts-bar-series apexcharts-plot-series"
2276
2291
  });
@@ -2302,7 +2317,6 @@ class Bar {
2302
2317
  this.visibleI = this.visibleI + 1;
2303
2318
  }
2304
2319
  const translationsIndex = this.setSeriesAxis(realIndex);
2305
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
2306
2320
  if (this.isPyramid) {
2307
2321
  this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
2308
2322
  }
@@ -2380,7 +2394,9 @@ class Bar {
2380
2394
  elSeries
2381
2395
  };
2382
2396
  if (this.isHorizontal) {
2383
- paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
2397
+ paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
2398
+ y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
2399
+ }), {
2384
2400
  barHeight,
2385
2401
  zeroW,
2386
2402
  yDivision
@@ -2462,6 +2478,7 @@ class Bar {
2462
2478
  series,
2463
2479
  barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
2464
2480
  barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
2481
+ barXPosition: paths.barXPosition,
2465
2482
  elDataLabelsWrap,
2466
2483
  elGoalsMarkers,
2467
2484
  elBarShadows,
@@ -2472,15 +2489,11 @@ class Bar {
2472
2489
  w.globals.seriesXvalues[realIndex] = xArrj;
2473
2490
  w.globals.seriesYvalues[realIndex] = yArrj;
2474
2491
  if (w.globals.previousPaths.length > 0) {
2475
- const newKeys = [];
2476
- for (let j = 0; j < series[i].length; j++) {
2477
- newKeys.push(datumKey(w, realIndex, j));
2478
- }
2479
2492
  renderBarExitGhosts({
2480
2493
  w,
2481
2494
  elSeries,
2482
2495
  record: this._prevRecord(realIndex),
2483
- newKeys,
2496
+ newKeys: this._keys(realIndex),
2484
2497
  isHorizontal: this.isHorizontal,
2485
2498
  speed: w.config.chart.animations.dynamicAnimation.speed
2486
2499
  });
@@ -2489,7 +2502,7 @@ class Bar {
2489
2502
  }
2490
2503
  return ret;
2491
2504
  }
2492
- /** @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 */
2505
+ /** @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 */
2493
2506
  renderSeries({
2494
2507
  hl,
2495
2508
  realIndex,
@@ -2521,7 +2534,9 @@ class Bar {
2521
2534
  visibleSeries,
2522
2535
  type,
2523
2536
  classes,
2524
- fadeReveal = false
2537
+ fadeReveal = false,
2538
+ noLabel
2539
+ // a datum's extra paths (box halves, box lane) label nothing
2525
2540
  }) {
2526
2541
  var _a, _b, _c, _d, _e, _f, _g;
2527
2542
  const w = this.w;
@@ -2595,7 +2610,8 @@ class Bar {
2595
2610
  barXPosition,
2596
2611
  barYPosition,
2597
2612
  visibleSeries,
2598
- hl: hl == null ? void 0 : hl.label
2613
+ hl: hl == null ? void 0 : hl.label,
2614
+ noLabel
2599
2615
  })
2600
2616
  );
2601
2617
  if (delayMs > 0) {
@@ -2611,19 +2627,18 @@ class Bar {
2611
2627
  }
2612
2628
  let leaving = false;
2613
2629
  if (!w.globals.isBarHorizontal) {
2614
- if (dataLabelsObj.dataLabelsPos.dataLabelsX + Math.max(barWidth, w.globals.barPadForNumericAxis) < 0 || dataLabelsObj.dataLabelsPos.dataLabelsX - Math.max(barWidth, w.globals.barPadForNumericAxis) > w.layout.gridWidth) {
2630
+ const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
2631
+ const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
2632
+ if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
2615
2633
  if (this._wasOnScreen(realIndex, j)) leaving = true;
2616
2634
  else skipDrawing = true;
2617
2635
  }
2618
2636
  }
2619
- if (
2620
- /** @type {Record<string,any>} */
2621
- w.config.series[i].data[j] && /** @type {Record<string,any>} */
2622
- w.config.series[i].data[j].strokeColor
2623
- ) {
2624
- lineFill = /** @type {Record<string,any>} */
2625
- w.config.series[i].data[j].strokeColor;
2626
- }
2637
+ const datum = (
2638
+ /** @type {any} */
2639
+ w.config.series[realIndex].data[j]
2640
+ );
2641
+ if (datum && datum.strokeColor) lineFill = datum.strokeColor;
2627
2642
  const fill = pathFill;
2628
2643
  if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
2629
2644
  pathFill = "none";
@@ -2646,7 +2661,7 @@ class Bar {
2646
2661
  pathTo,
2647
2662
  stroke: lineFill,
2648
2663
  strokeWidth,
2649
- strokeLineCap: w.config.stroke.lineCap,
2664
+ strokeLinecap: w.config.stroke.lineCap,
2650
2665
  fill: pathFill,
2651
2666
  pathToInterp,
2652
2667
  animationDelay: delay,
@@ -2698,12 +2713,12 @@ class Bar {
2698
2713
  cy: dataLabelsObj.dataLabelsPos.bcy,
2699
2714
  cx: dataLabelsObj.dataLabelsPos.bcx,
2700
2715
  j,
2701
- val: w.seriesData.series[i][j],
2716
+ val: w.seriesData.series[realIndex][j],
2702
2717
  barHeight,
2703
2718
  barWidth,
2704
2719
  // Datum identity for the next update's keyed join (see
2705
2720
  // LengthTransition): survivors match by key, not array position.
2706
- "data:pathKey": datumKey(w, realIndex, j)
2721
+ "data:pathKey": this._keys(realIndex)[j]
2707
2722
  });
2708
2723
  hl == null ? void 0 : hl.paint(renderedPath, {
2709
2724
  delay,
@@ -2779,7 +2794,10 @@ class Bar {
2779
2794
  const j = indexes.j;
2780
2795
  let barYPosition;
2781
2796
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
2782
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
2797
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
2798
+ i: indexes.realIndex,
2799
+ j
2800
+ });
2783
2801
  if (nonZeroColumns > 0) {
2784
2802
  barHeight = this.seriesLen * barHeight / nonZeroColumns;
2785
2803
  }
@@ -2918,7 +2936,7 @@ class Bar {
2918
2936
  barXPosition = xForNumericX.barXPosition;
2919
2937
  } else {
2920
2938
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
2921
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
2939
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
2922
2940
  if (nonZeroColumns > 0) {
2923
2941
  barWidth = this.seriesLen * barWidth / nonZeroColumns;
2924
2942
  }
@@ -2982,15 +3000,16 @@ class Bar {
2982
3000
  /** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
2983
3001
  getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
2984
3002
  const w = this.w;
3003
+ const overlay = isHistogramOverlay(w);
2985
3004
  let sxI = realIndex;
2986
3005
  if (!w.seriesData.seriesX[realIndex].length) {
2987
3006
  sxI = w.globals.maxValsInArrayIndex;
2988
3007
  }
2989
3008
  if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
2990
- x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
3009
+ x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
2991
3010
  }
2992
3011
  return {
2993
- barXPosition: x + (isHistogramOverlay(w) ? 0 : barWidth * this.visibleI),
3012
+ barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
2994
3013
  x
2995
3014
  };
2996
3015
  }
@@ -3011,7 +3030,20 @@ class Bar {
3011
3030
  _wasOnScreen(realIndex, j) {
3012
3031
  if (!lengthTransitionEnabled(this.w)) return false;
3013
3032
  const keyed = this._prevKeyedPaths(realIndex);
3014
- return !!keyed && keyed.has(datumKey(this.w, realIndex, j));
3033
+ return !!keyed && keyed.has(this._keys(realIndex)[j]);
3034
+ }
3035
+ /**
3036
+ * This render's datum keys for a series (see seriesKeys), as stamped on
3037
+ * each bar and looked up in the previous render's.
3038
+ * @param {number} realIndex
3039
+ * @returns {string[]}
3040
+ */
3041
+ _keys(realIndex) {
3042
+ const c = (
3043
+ /** @type {any} */
3044
+ this._keyCache || (this._keyCache = {})
3045
+ );
3046
+ return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
3015
3047
  }
3016
3048
  /**
3017
3049
  * The captured previous-render record for a series (last match wins, same
@@ -3067,7 +3099,7 @@ class Bar {
3067
3099
  * @returns {boolean}
3068
3100
  */
3069
3101
  isLengthTransition(realIndex) {
3070
- var _a, _b;
3102
+ var _a, _b, _c, _d, _e, _f;
3071
3103
  if (!this._ltCache) this._ltCache = {};
3072
3104
  if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
3073
3105
  const w = this.w;
@@ -3075,20 +3107,14 @@ class Bar {
3075
3107
  if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
3076
3108
  const record = this._prevRecord(realIndex);
3077
3109
  const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
3110
+ const keyed = record && this._prevKeyedPaths(realIndex);
3078
3111
  if (!record) {
3079
3112
  result = dataLen > 0;
3080
- } else if (record.paths.length !== dataLen) {
3081
- result = true;
3113
+ } else if (keyed) {
3114
+ const now = new Set(this._keys(realIndex));
3115
+ 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));
3082
3116
  } else {
3083
- const keyed = this._prevKeyedPaths(realIndex);
3084
- if (keyed) {
3085
- for (let j = 0; j < dataLen; j++) {
3086
- if (!keyed.has(datumKey(w, realIndex, j))) {
3087
- result = true;
3088
- break;
3089
- }
3090
- }
3091
- }
3117
+ result = record.paths.length !== dataLen;
3092
3118
  }
3093
3119
  }
3094
3120
  this._ltCache[realIndex] = result;
@@ -3148,7 +3174,7 @@ class Bar {
3148
3174
  let isNewDatum = false;
3149
3175
  const keyed = this._prevKeyedPaths(realIndex);
3150
3176
  if (keyed) {
3151
- const prev = keyed.get(datumKey(w, realIndex, j));
3177
+ const prev = keyed.get(this._keys(realIndex)[j]);
3152
3178
  if (prev) {
3153
3179
  oldD = prev.d;
3154
3180
  } else {
@@ -3291,11 +3317,10 @@ class Bar {
3291
3317
  * @returns {boolean | null} null when there is no previous record to consult
3292
3318
  */
3293
3319
  getPreviousFlip(realIndex, j) {
3294
- const w = this.w;
3295
3320
  const record = this._prevRecord(realIndex);
3296
3321
  if (!record) return null;
3297
3322
  const keyed = this._prevKeyedPaths(realIndex);
3298
- const prev = keyed ? keyed.get(datumKey(w, realIndex, j)) : record.paths[j];
3323
+ const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
3299
3324
  return prev ? !!prev.flip : null;
3300
3325
  }
3301
3326
  /**
@@ -3322,7 +3347,7 @@ class BarStacked extends Bar {
3322
3347
  const coreUtils = new CoreUtils(this.w);
3323
3348
  series = coreUtils.getLogSeries(series);
3324
3349
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
3325
- this.barHelpers.initVariables(series);
3350
+ this.barHelpers.initVariables(series, seriesIndex);
3326
3351
  if (w.config.chart.stackType === "100%") {
3327
3352
  series = w.globals.comboCharts ? (
3328
3353
  /** @type {any} */
@@ -3353,7 +3378,6 @@ class BarStacked extends Bar {
3353
3378
  const xArrValues = [];
3354
3379
  const yArrValues = [];
3355
3380
  const translationsIndex = this.setSeriesAxis(realIndex);
3356
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
3357
3381
  let elSeries = this.graphics.group({
3358
3382
  class: `apexcharts-series`,
3359
3383
  seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
@@ -3423,7 +3447,9 @@ class BarStacked extends Bar {
3423
3447
  null
3424
3448
  );
3425
3449
  if (this.isHorizontal) {
3426
- paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
3450
+ paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
3451
+ y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
3452
+ }), {
3427
3453
  zeroW,
3428
3454
  barHeight,
3429
3455
  yDivision
@@ -3497,6 +3523,7 @@ class BarStacked extends Bar {
3497
3523
  series,
3498
3524
  barHeight,
3499
3525
  barWidth,
3526
+ barXPosition: paths.barXPosition,
3500
3527
  elDataLabelsWrap,
3501
3528
  elGoalsMarkers,
3502
3529
  type: "bar",
@@ -3514,7 +3541,7 @@ class BarStacked extends Bar {
3514
3541
  this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
3515
3542
  ret.add(elSeries);
3516
3543
  }
3517
- if (heldMirrors) this.settleHeldMirrors();
3544
+ if (heldMirrors) this.settleHeldMirrors(ret);
3518
3545
  return ret;
3519
3546
  }
3520
3547
  /**
@@ -3535,15 +3562,21 @@ class BarStacked extends Bar {
3535
3562
  * 'bottom' → 'top', where the endpoint really is rounded at the other end;
3536
3563
  * everywhere else the mirror is an exact identity on the settled shape, so
3537
3564
  * removing it changes nothing on screen.
3565
+ *
3566
+ * The marks are collected now, not when the timer fires: a query then also
3567
+ * stripped the mirrors a LATER update was still holding mid-tween.
3568
+ * @param {any} [ret] this draw's series group (default: the whole chart)
3538
3569
  */
3539
- settleHeldMirrors() {
3570
+ settleHeldMirrors(ret) {
3540
3571
  const w = this.w;
3541
3572
  if (!Environment.isBrowser()) return;
3542
3573
  const anim = w.config.chart.animations;
3543
3574
  const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
3575
+ const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
3576
+ ".apexcharts-flip-held"
3577
+ );
3544
3578
  setTimeout(() => {
3545
- if (w.globals.isDestroyed || !Utils.elementExists(w.dom.baseEl)) return;
3546
- w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
3579
+ held.forEach((el) => {
3547
3580
  el.classList.remove(
3548
3581
  "apexcharts-flip-held",
3549
3582
  "apexcharts-flip-y",
@@ -3619,7 +3652,7 @@ class BarStacked extends Bar {
3619
3652
  yDivision,
3620
3653
  elSeries
3621
3654
  }) {
3622
- var _a, _b, _c, _d, _e;
3655
+ var _a, _b;
3623
3656
  const w = this.w;
3624
3657
  const barYPosition = y + columnGroupIndex * barHeight;
3625
3658
  let barXPosition;
@@ -3627,36 +3660,21 @@ class BarStacked extends Bar {
3627
3660
  const j = indexes.j;
3628
3661
  const realIndex = indexes.realIndex;
3629
3662
  const translationsIndex = indexes.translationsIndex;
3630
- let prevBarW = 0;
3631
- for (let k = 0; k < this.groupCtx.prevXF.length; k++) {
3632
- prevBarW = prevBarW + this.groupCtx.prevXF[k][j];
3633
- }
3634
- const gsi = this.groupCtx.prevX.length;
3635
- if (gsi > 0) {
3636
- let bXP = zeroW;
3637
- if (this.groupCtx.prevXVal[gsi - 1][j] < 0) {
3638
- bXP = /** @type {any} */
3639
- ((_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];
3640
- } else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) {
3641
- bXP = /** @type {any} */
3642
- ((_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;
3643
- }
3644
- barXPosition = bXP;
3645
- } else {
3646
- barXPosition = zeroW;
3647
- }
3648
- if (
3663
+ const v = (
3649
3664
  /** @type {any} */
3650
- ((_c = this.series[i]) == null ? void 0 : _c[j]) === null
3651
- ) {
3652
- x = barXPosition;
3665
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
3666
+ );
3667
+ const g = this.groupCtx;
3668
+ const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
3669
+ const top = g.tops.get(key);
3670
+ if (top) {
3671
+ const [prevX, prevVal, prevBarW] = top;
3672
+ const flip = (this.isReversed ? prevBarW : 0) * 2;
3673
+ barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
3653
3674
  } else {
3654
- x = barXPosition + /** @type {any} */
3655
- ((_d = this.series[i]) == null ? void 0 : _d[j]) / this.invertedYRatio - (this.isReversed ? (
3656
- /** @type {any} */
3657
- ((_e = this.series[i]) == null ? void 0 : _e[j]) / this.invertedYRatio
3658
- ) : 0) * 2;
3675
+ barXPosition = zeroW;
3659
3676
  }
3677
+ x = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
3660
3678
  const paths = this.barHelpers.getBarpaths({
3661
3679
  barYPosition,
3662
3680
  barHeight,
@@ -3670,6 +3688,7 @@ class BarStacked extends Bar {
3670
3688
  j,
3671
3689
  w
3672
3690
  });
3691
+ this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
3673
3692
  this.barHelpers.barBackground({
3674
3693
  j,
3675
3694
  i,
@@ -3707,13 +3726,17 @@ class BarStacked extends Bar {
3707
3726
  columnGroupIndex,
3708
3727
  elSeries
3709
3728
  }) {
3710
- var _a, _b, _c, _d, _e, _f;
3729
+ var _a, _b, _c;
3711
3730
  const w = this.w;
3712
3731
  const i = indexes.i;
3713
3732
  const j = indexes.j;
3714
3733
  const bc = indexes.bc;
3715
3734
  const realIndex = indexes.realIndex;
3716
3735
  const translationsIndex = indexes.translationsIndex;
3736
+ const v = (
3737
+ /** @type {any} */
3738
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
3739
+ );
3717
3740
  if (w.axisFlags.isXNumeric) {
3718
3741
  let seriesVal = w.seriesData.seriesX[realIndex][j];
3719
3742
  if (!seriesVal) seriesVal = 0;
@@ -3728,11 +3751,9 @@ class BarStacked extends Bar {
3728
3751
  const [prevYValue, prevVal, prevBarH] = top;
3729
3752
  let bYP;
3730
3753
  if (prevVal < 0) {
3731
- bYP = /** @type {any} */
3732
- ((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
3754
+ bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
3733
3755
  } else if (prevVal >= 0) {
3734
- bYP = /** @type {any} */
3735
- ((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
3756
+ bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
3736
3757
  }
3737
3758
  if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
3738
3759
  if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
@@ -3745,25 +3766,16 @@ class BarStacked extends Bar {
3745
3766
  } else {
3746
3767
  barYPosition = zeroH;
3747
3768
  }
3748
- if (
3749
- /** @type {any} */
3750
- (_d = this.series[i]) == null ? void 0 : _d[j]
3751
- ) {
3752
- y = barYPosition - /** @type {any} */
3753
- ((_e = this.series[i]) == null ? void 0 : _e[j]) / this.yRatio[translationsIndex] + (this.isReversed ? (
3754
- /** @type {any} */
3755
- ((_f = this.series[i]) == null ? void 0 : _f[j]) / this.yRatio[translationsIndex]
3756
- ) : 0) * 2;
3757
- } else {
3758
- y = barYPosition;
3759
- }
3769
+ y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
3760
3770
  const paths = this.barHelpers.getColumnPaths({
3761
3771
  barXPosition,
3762
3772
  barWidth,
3763
3773
  y1: barYPosition,
3764
3774
  y2: y,
3765
3775
  yRatio: this.yRatio[translationsIndex],
3766
- strokeWidth: this.strokeWidth,
3776
+ // the series' width even for an empty segment, so a hidden layer keeps
3777
+ // its place, but no inset at all when no stroke is drawn
3778
+ strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
3767
3779
  isReversed: this.isReversed,
3768
3780
  series: this.series,
3769
3781
  realIndex: indexes.realIndex,
@@ -3771,17 +3783,7 @@ class BarStacked extends Bar {
3771
3783
  j,
3772
3784
  w
3773
3785
  });
3774
- const t = g.yArrj[j];
3775
- if (!isNaN(t)) {
3776
- g.tops.set(key, [
3777
- t,
3778
- g.yArrjVal[j],
3779
- (top ? top[2] : 0) + g.yArrjF[j],
3780
- (top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
3781
- top ? Math.min(top[0], top[4]) : 1 / 0,
3782
- top ? Math.max(top[0], top[5]) : -1 / 0
3783
- ]);
3784
- }
3786
+ this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
3785
3787
  this.barHelpers.barBackground({
3786
3788
  bc,
3787
3789
  j,
@@ -3800,13 +3802,32 @@ class BarStacked extends Bar {
3800
3802
  zeroH,
3801
3803
  realIndex,
3802
3804
  j,
3803
- 0
3805
+ translationsIndex
3804
3806
  ),
3805
3807
  barXPosition,
3806
3808
  x: w.axisFlags.isXNumeric ? x : x + xDivision,
3807
3809
  y
3808
3810
  };
3809
3811
  }
3812
+ /**
3813
+ * Record the segment just drawn as the top of its stack. Per key it holds
3814
+ * the top and value of the last segment drawn there, the summed lengths and
3815
+ * raw values of every segment so far (the total label's value), and the
3816
+ * extreme tops below that segment (the total label's position).
3817
+ * @param {any} key @param {any} top @param {number} t @param {any} val
3818
+ * @param {number} len @param {number} realIndex @param {number} j
3819
+ */
3820
+ _setTop(key, top, t, val, len, realIndex, j) {
3821
+ if (isNaN(t)) return;
3822
+ this.groupCtx.tops.set(key, [
3823
+ t,
3824
+ val,
3825
+ (top ? top[2] : 0) + len,
3826
+ (top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
3827
+ top ? Math.min(top[0], top[4]) : 1 / 0,
3828
+ top ? Math.max(top[0], top[5]) : -1 / 0
3829
+ ]);
3830
+ }
3810
3831
  }
3811
3832
  class RangeBar extends Bar {
3812
3833
  /**
@@ -3814,14 +3835,14 @@ class RangeBar extends Bar {
3814
3835
  * @param {number} seriesIndex
3815
3836
  */
3816
3837
  draw(series, seriesIndex) {
3817
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3838
+ var _a, _b, _c, _d, _e, _f;
3818
3839
  const w = this.w;
3819
3840
  const graphics = new Graphics(this.w);
3820
3841
  this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
3821
3842
  this.series = series;
3822
3843
  this.seriesRangeStart = w.rangeData.seriesRangeStart;
3823
3844
  this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
3824
- this.barHelpers.initVariables(series);
3845
+ this.barHelpers.initVariables(series, seriesIndex);
3825
3846
  const ret = graphics.group({
3826
3847
  class: "apexcharts-rangebar-series apexcharts-plot-series"
3827
3848
  });
@@ -3843,6 +3864,9 @@ class RangeBar extends Bar {
3843
3864
  this.visibleI = this.visibleI + 1;
3844
3865
  }
3845
3866
  const translationsIndex = this.setSeriesAxis(realIndex);
3867
+ if (this.isHorizontal && w.labelData.timescaleLabels.length) {
3868
+ this.isReversed = false;
3869
+ }
3846
3870
  const initPositions = this.barHelpers.initialPositions(realIndex);
3847
3871
  const {
3848
3872
  y: initY,
@@ -3852,10 +3876,8 @@ class RangeBar extends Bar {
3852
3876
  zeroH
3853
3877
  // zeroH is the baseline where 0 meets y axis
3854
3878
  } = initPositions;
3855
- let barWidth = (_a = initPositions.barWidth) != null ? _a : 0;
3856
- let barHeight = (_b = initPositions.barHeight) != null ? _b : 0;
3857
- const yDivision = (_c = initPositions.yDivision) != null ? _c : 0;
3858
- const xDivision = (_d = initPositions.xDivision) != null ? _d : 0;
3879
+ const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
3880
+ const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
3859
3881
  y = initY;
3860
3882
  x = initX;
3861
3883
  const elDataLabelsWrap = graphics.group({
@@ -3865,10 +3887,16 @@ class RangeBar extends Bar {
3865
3887
  const elGoalsMarkers = graphics.group({
3866
3888
  class: "apexcharts-rangebar-goals-markers"
3867
3889
  });
3890
+ const data = (
3891
+ /** @type {any} */
3892
+ w.config.series[realIndex].data
3893
+ );
3868
3894
  for (let j = 0; j < w.globals.dataPoints; j++) {
3869
3895
  const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
3870
- const y1 = this.seriesRangeStart[i][j];
3871
- const y2 = this.seriesRangeEnd[i][j];
3896
+ let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
3897
+ let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
3898
+ const y1 = this.seriesRangeStart[realIndex][j];
3899
+ const y2 = this.seriesRangeEnd[realIndex][j];
3872
3900
  let paths = (
3873
3901
  /** @type {any} */
3874
3902
  null
@@ -3880,20 +3908,16 @@ class RangeBar extends Bar {
3880
3908
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
3881
3909
  seriesLen = 1;
3882
3910
  }
3883
- if (typeof /** @type {Record<string,any>} */
3884
- ((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
3911
+ if (typeof (data == null ? void 0 : data[j]) === "undefined") {
3885
3912
  break;
3886
3913
  }
3887
3914
  if (this.isHorizontal) {
3888
3915
  barYPosition = y + barHeight * /** @type {any} */
3889
3916
  this.visibleI;
3890
3917
  const srty = (yDivision - barHeight * seriesLen) / 2;
3891
- if (
3892
- /** @type {Record<string,any>} */
3893
- (_g = (_f = w.config.series[i].data) == null ? void 0 : _f[j]) == null ? void 0 : _g.x
3894
- ) {
3918
+ if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
3895
3919
  const positions = this.detectOverlappingBars({
3896
- i,
3920
+ i: realIndex,
3897
3921
  j,
3898
3922
  barYPosition,
3899
3923
  srty,
@@ -3916,17 +3940,14 @@ class RangeBar extends Bar {
3916
3940
  barWidth = paths.barWidth;
3917
3941
  } else {
3918
3942
  if (w.axisFlags.isXNumeric) {
3919
- x = (w.seriesData.seriesX[i][j] - w.globals.minX) / this.xRatio - barWidth / 2;
3943
+ x = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
3920
3944
  }
3921
3945
  barXPosition = x + barWidth * /** @type {any} */
3922
3946
  this.visibleI;
3923
3947
  const srtx = (xDivision - barWidth * seriesLen) / 2;
3924
- if (
3925
- /** @type {Record<string,any>} */
3926
- (_i = (_h = w.config.series[i].data) == null ? void 0 : _h[j]) == null ? void 0 : _i.x
3927
- ) {
3948
+ if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
3928
3949
  const positions = this.detectOverlappingBars({
3929
- i,
3950
+ i: realIndex,
3930
3951
  j,
3931
3952
  barXPosition,
3932
3953
  srtx,
@@ -3945,9 +3966,10 @@ class RangeBar extends Bar {
3945
3966
  xDivision
3946
3967
  }, params));
3947
3968
  barHeight = paths.barHeight;
3969
+ barXPosition = paths.barXPosition;
3948
3970
  }
3949
3971
  const barGoalLine = this.barHelpers.drawGoalLine({
3950
- barXPosition: paths.barXPosition,
3972
+ barXPosition,
3951
3973
  barYPosition,
3952
3974
  goalX: paths.goalX,
3953
3975
  goalY: paths.goalY,
@@ -3992,19 +4014,11 @@ class RangeBar extends Bar {
3992
4014
  });
3993
4015
  }
3994
4016
  if (w.globals.previousPaths.length > 0) {
3995
- const data = (
3996
- /** @type {Record<string,any>} */
3997
- w.config.series[i].data || []
3998
- );
3999
- const newKeys = [];
4000
- for (let j = 0; j < data.length; j++) {
4001
- newKeys.push(datumKey(w, realIndex, j));
4002
- }
4003
4017
  renderBarExitGhosts({
4004
4018
  w,
4005
4019
  elSeries,
4006
4020
  record: this._prevRecord(realIndex),
4007
- newKeys,
4021
+ newKeys: this._keys(realIndex),
4008
4022
  isHorizontal: this.isHorizontal,
4009
4023
  speed: w.config.chart.animations.dynamicAnimation.speed
4010
4024
  });
@@ -4056,11 +4070,11 @@ class RangeBar extends Bar {
4056
4070
  );
4057
4071
  if (overlaps.indexOf(rangeName) > -1) {
4058
4072
  barHeight = initPositions.barHeight / overlaps.length;
4059
- barYPosition = barHeight * this.visibleI + yDivision * (100 - parseInt(this.barOptions.barHeight, 10)) / 100 / 2 + barHeight * (this.visibleI + overlaps.indexOf(rangeName)) + yDivision * rowIndex;
4073
+ barYPosition += barHeight * overlaps.indexOf(rangeName);
4060
4074
  }
4061
4075
  }
4062
4076
  } else {
4063
- if (rowIndex > -1 && !w.labelData.timescaleLabels.length) {
4077
+ if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
4064
4078
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
4065
4079
  barXPosition = srtx + xDivision * rowIndex;
4066
4080
  } else {
@@ -4074,7 +4088,7 @@ class RangeBar extends Bar {
4074
4088
  );
4075
4089
  if (overlaps.indexOf(rangeName) > -1) {
4076
4090
  barWidth = initPositions.barWidth / overlaps.length;
4077
- barXPosition = barWidth * this.visibleI + xDivision * (100 - parseInt(this.barOptions.barWidth, 10)) / 100 / 2 + barWidth * (this.visibleI + overlaps.indexOf(rangeName)) + xDivision * rowIndex;
4091
+ barXPosition += barWidth * overlaps.indexOf(rangeName);
4078
4092
  }
4079
4093
  }
4080
4094
  }
@@ -4097,7 +4111,7 @@ class RangeBar extends Bar {
4097
4111
  var _a, _b;
4098
4112
  const w = this.w;
4099
4113
  const { i, j, realIndex, translationsIndex } = indexes;
4100
- const yRatio = this.yRatio[translationsIndex];
4114
+ const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
4101
4115
  const range = this.getRangeValue(realIndex, j);
4102
4116
  let y1 = Math.min(range.start, range.end);
4103
4117
  let y2 = Math.max(range.start, range.end);
@@ -4105,7 +4119,7 @@ class RangeBar extends Bar {
4105
4119
  ((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
4106
4120
  ((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
4107
4121
  if (!hasValue) {
4108
- y1 = zeroH;
4122
+ y1 = y2 = zeroH;
4109
4123
  } else {
4110
4124
  y1 = zeroH - y1 / yRatio;
4111
4125
  y2 = zeroH - y2 / yRatio;
@@ -4166,6 +4180,30 @@ class RangeBar extends Bar {
4166
4180
  barXPosition
4167
4181
  };
4168
4182
  }
4183
+ /**
4184
+ * Timeline datums key by their own row, not by the j-th label: a row can
4185
+ * hold several bars, so labels[j] names some other datum's row.
4186
+ * @param {number} realIndex
4187
+ * @returns {string[]}
4188
+ */
4189
+ _keys(realIndex) {
4190
+ const c = (
4191
+ /** @type {any} */
4192
+ this._keyCache || (this._keyCache = {})
4193
+ );
4194
+ const data = (
4195
+ /** @type {any} */
4196
+ this.w.config.series[realIndex].data
4197
+ );
4198
+ return c[realIndex] || (c[realIndex] = uniquifyKeys(
4199
+ (data || []).map(
4200
+ (d, j) => {
4201
+ var _a;
4202
+ return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
4203
+ }
4204
+ )
4205
+ ));
4206
+ }
4169
4207
  /**
4170
4208
  * @param {number} val
4171
4209
  */
@@ -4192,8 +4230,9 @@ class RangeBar extends Bar {
4192
4230
  }) {
4193
4231
  const w = this.w;
4194
4232
  const { realIndex, j } = indexes;
4195
- const x1 = this.preventBarOverflow(zeroW + y1 / this.invertedYRatio);
4196
- const x2 = this.preventBarOverflow(zeroW + y2 / this.invertedYRatio);
4233
+ const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
4234
+ const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
4235
+ const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
4197
4236
  const range = this.getRangeValue(realIndex, j);
4198
4237
  const barWidth = Math.abs(x2 - x1);
4199
4238
  const paths = this.barHelpers.getBarpaths({