apexcharts 8.2.0 → 8.3.1

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 (256) hide show
  1. package/README.md +7 -7
  2. package/dist/apexcharts.common.js +2 -2
  3. package/dist/apexcharts.core.js +19793 -19713
  4. package/dist/apexcharts.core.min.js +2 -2
  5. package/dist/apexcharts.css +38 -8
  6. package/dist/apexcharts.esm.js +1882 -1625
  7. package/dist/apexcharts.full.js +22044 -21634
  8. package/dist/apexcharts.full.min.js +2 -2
  9. package/dist/apexcharts.js +21414 -21124
  10. package/dist/apexcharts.min.js +2 -2
  11. package/dist/apexcharts.ssr.common.js +2 -2
  12. package/dist/apexcharts.ssr.esm.js +21413 -21123
  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 +478 -406
  17. package/dist/bar.js +2 -2
  18. package/dist/boxPlot.common.js +2 -2
  19. package/dist/boxPlot.esm.js +409 -334
  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 +409 -334
  24. package/dist/candlestick.js +2 -2
  25. package/dist/column.common.js +2 -2
  26. package/dist/column.esm.js +478 -406
  27. package/dist/core.common.js +2 -2
  28. package/dist/core.esm.js +19793 -19713
  29. package/dist/donut.common.js +2 -2
  30. package/dist/donut.esm.js +3 -9
  31. package/dist/dumbbell.common.js +2 -2
  32. package/dist/dumbbell.esm.js +478 -406
  33. package/dist/features/all.common.js +2 -2
  34. package/dist/features/all.esm.js +442 -324
  35. package/dist/features/annotations.common.js +2 -2
  36. package/dist/features/annotations.esm.js +65 -48
  37. package/dist/features/annotations.js +2 -2
  38. package/dist/features/context-menu.common.js +1 -1
  39. package/dist/features/context-menu.esm.js +1 -1
  40. package/dist/features/context-menu.js +1 -1
  41. package/dist/features/drilldown.common.js +2 -2
  42. package/dist/features/drilldown.esm.js +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 +2 -2
  48. package/dist/features/exports.esm.js +10 -4
  49. package/dist/features/exports.js +2 -2
  50. package/dist/features/facet.common.js +1 -1
  51. package/dist/features/facet.esm.js +1 -1
  52. package/dist/features/facet.js +1 -1
  53. package/dist/features/highlight-filter.common.js +2 -2
  54. package/dist/features/highlight-filter.esm.js +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 +64 -44
  67. package/dist/features/legend.js +2 -2
  68. package/dist/features/link.common.js +1 -1
  69. package/dist/features/link.esm.js +1 -1
  70. package/dist/features/link.js +1 -1
  71. package/dist/features/marks.common.js +1 -1
  72. package/dist/features/marks.esm.js +1 -1
  73. package/dist/features/marks.js +1 -1
  74. package/dist/features/measure.common.js +1 -1
  75. package/dist/features/measure.esm.js +1 -1
  76. package/dist/features/measure.js +1 -1
  77. package/dist/features/morph.common.js +2 -2
  78. package/dist/features/morph.esm.js +9 -5
  79. package/dist/features/morph.js +2 -2
  80. package/dist/features/perspectives.common.js +2 -2
  81. package/dist/features/perspectives.esm.js +4 -1
  82. package/dist/features/perspectives.js +2 -2
  83. package/dist/features/raincloud.common.js +2 -2
  84. package/dist/features/raincloud.esm.js +26 -27
  85. package/dist/features/raincloud.js +2 -2
  86. package/dist/features/renderer-canvas.common.js +2 -2
  87. package/dist/features/renderer-canvas.esm.js +2 -1
  88. package/dist/features/renderer-canvas.js +2 -2
  89. package/dist/features/stats.common.js +2 -2
  90. package/dist/features/stats.esm.js +52 -59
  91. package/dist/features/stats.js +2 -2
  92. package/dist/features/storyboard.common.js +2 -2
  93. package/dist/features/storyboard.esm.js +4 -1
  94. package/dist/features/storyboard.js +2 -2
  95. package/dist/features/streamgraph.common.js +2 -2
  96. package/dist/features/streamgraph.esm.js +48 -14
  97. package/dist/features/streamgraph.js +2 -2
  98. package/dist/features/toolbar.common.js +2 -2
  99. package/dist/features/toolbar.esm.js +148 -18
  100. package/dist/features/toolbar.js +2 -2
  101. package/dist/features/trellis.common.js +2 -2
  102. package/dist/features/trellis.esm.js +150 -63
  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 +2 -2
  108. package/dist/features/weave.esm.js +13 -12
  109. package/dist/features/weave.js +2 -2
  110. package/dist/full.common.js +2 -2
  111. package/dist/full.esm.js +1068 -842
  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 +529 -464
  117. package/dist/icicle.common.js +2 -2
  118. package/dist/icicle.esm.js +80 -46
  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 +2 -2
  129. package/dist/pie.esm.js +3 -9
  130. package/dist/pie.js +2 -2
  131. package/dist/polarArea.common.js +2 -2
  132. package/dist/polarArea.esm.js +3 -9
  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 +2 -2
  137. package/dist/radialBar.esm.js +5 -12
  138. package/dist/radialBar.js +2 -2
  139. package/dist/raincloud.common.js +2 -2
  140. package/dist/raincloud.esm.js +97 -52
  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 +478 -406
  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 +138 -53
  149. package/dist/sunburst.common.js +2 -2
  150. package/dist/sunburst.esm.js +116 -94
  151. package/dist/sunburst.js +2 -2
  152. package/dist/treemap.common.js +2 -2
  153. package/dist/treemap.esm.js +138 -104
  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 +477 -405
  166. package/package.json +1 -1
  167. package/src/apexcharts.js +40 -59
  168. package/src/assets/apexcharts.css +38 -8
  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 +68 -47
  173. package/src/charts/Line.js +118 -42
  174. package/src/charts/Pie.js +2 -8
  175. package/src/charts/Radar.js +5 -7
  176. package/src/charts/Radial.js +2 -6
  177. package/src/charts/RangeBar.js +47 -43
  178. package/src/charts/Sunburst.js +101 -98
  179. package/src/charts/Treemap.js +150 -88
  180. package/src/charts/Unit.js +368 -250
  181. package/src/charts/Violin.js +48 -30
  182. package/src/charts/common/Breadcrumb.js +2 -2
  183. package/src/charts/common/Hierarchy.js +32 -11
  184. package/src/charts/common/Jitter.js +32 -7
  185. package/src/charts/common/Stats.js +30 -23
  186. package/src/charts/common/bar/DataLabels.js +76 -81
  187. package/src/charts/common/bar/Helpers.js +43 -7
  188. package/src/charts/common/line/Helpers.js +12 -15
  189. package/src/charts/common/partition/NodeTooltip.js +29 -7
  190. package/src/charts/common/partition/Partition.js +33 -1
  191. package/src/charts/common/treemap/Helpers.js +3 -11
  192. package/src/charts/common/treemap/Nested.js +2 -3
  193. package/src/features/raincloud.js +16 -10
  194. package/src/features/stats.js +67 -62
  195. package/src/locales/en.json +2 -1
  196. package/src/locales/ro.json +3 -2
  197. package/src/modules/Animations.js +102 -95
  198. package/src/modules/AxisMapping.js +47 -12
  199. package/src/modules/Core.js +4 -0
  200. package/src/modules/CoreUtils.js +18 -42
  201. package/src/modules/Data.js +23 -24
  202. package/src/modules/DataLabels.js +6 -6
  203. package/src/modules/Exports.js +12 -5
  204. package/src/modules/Fill.js +17 -8
  205. package/src/modules/Filters.js +50 -50
  206. package/src/modules/Graphics.js +69 -51
  207. package/src/modules/Markers.js +3 -1
  208. package/src/modules/MorphTypeChange.js +13 -7
  209. package/src/modules/Range.js +44 -29
  210. package/src/modules/RendererController.js +17 -3
  211. package/src/modules/Scales.js +32 -9
  212. package/src/modules/Series.js +41 -19
  213. package/src/modules/Theme.js +1 -1
  214. package/src/modules/Toolbar.js +3 -2
  215. package/src/modules/UnitMarkRegistry.js +0 -5
  216. package/src/modules/ZoomPanSelection.js +123 -2
  217. package/src/modules/accessibility/KeyboardNavigation.js +114 -186
  218. package/src/modules/animations/Easing.js +2 -1
  219. package/src/modules/animations/LengthTransition.js +22 -2
  220. package/src/modules/annotations/Helpers.js +68 -52
  221. package/src/modules/axes/Grid.js +21 -7
  222. package/src/modules/axes/YAxis.js +8 -9
  223. package/src/modules/dimensions/Dimensions.js +9 -3
  224. package/src/modules/dimensions/Grid.js +2 -2
  225. package/src/modules/dimensions/XAxis.js +2 -5
  226. package/src/modules/drilldown/Breadcrumb.js +5 -2
  227. package/src/modules/helpers/Destroy.js +1 -1
  228. package/src/modules/helpers/UpdateHelpers.js +33 -15
  229. package/src/modules/highlightFilter/HighlightFilter.js +8 -9
  230. package/src/modules/highlightFilter/TreemapPart.js +2 -2
  231. package/src/modules/legend/HeatmapGradientLegend.js +76 -45
  232. package/src/modules/legend/Helpers.js +8 -1
  233. package/src/modules/legend/Legend.js +11 -12
  234. package/src/modules/license/LicenseEnforcer.js +5 -0
  235. package/src/modules/settings/Defaults.js +28 -56
  236. package/src/modules/settings/Globals.js +5 -0
  237. package/src/modules/settings/Options.js +7 -7
  238. package/src/modules/settings/TypeAliases.js +33 -16
  239. package/src/modules/streamgraph/StreamLabels.js +1 -0
  240. package/src/modules/tooltip/Labels.js +73 -76
  241. package/src/modules/tooltip/Marker.js +25 -21
  242. package/src/modules/tooltip/Position.js +88 -51
  243. package/src/modules/tooltip/Tooltip.js +242 -255
  244. package/src/modules/tooltip/Utils.js +71 -130
  245. package/src/modules/tooltip/constants.js +5 -5
  246. package/src/modules/trellis/Trellis.js +6 -0
  247. package/src/modules/trellis/TrellisChrome.js +18 -7
  248. package/src/modules/trellis/TrellisSync.js +2 -0
  249. package/src/modules/trellis/TrellisTooltip.js +2 -11
  250. package/src/modules/weave/WeaveHost.js +18 -12
  251. package/src/renderers/canvas/CanvasGraphics.js +1 -0
  252. package/src/ssr/DOMShim.js +10 -0
  253. package/src/svg/SVGFilter.js +26 -17
  254. package/src/types/internal.d.ts +9 -3
  255. package/src/utils/Utils.js +0 -14
  256. package/types/apexcharts.d.ts +33 -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.1
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
@@ -2157,22 +2170,55 @@ class AxisMapping {
2157
2170
  return w.globals.minX + px * AxisMapping.xRatio(w);
2158
2171
  }
2159
2172
  /**
2160
- * Client (screen) x -> pixels from the plot origin. The origin is the svg
2161
- * element's left edge plus `translateX`, never the `.apexcharts-grid` box
2162
- * (fact 2 above), so the result does not depend on what the grid happens to
2163
- * render. `svgWidth` is the unscaled width the svg was drawn at, so the ratio
2164
- * against the measured one is the CSS zoom of any container the chart sits in.
2173
+ * The plot area on screen, in client px: its corner is where the plot's
2174
+ * group is translated to (translateX, translateY into the svg), and it is
2175
+ * gridWidth by gridHeight. The one screen-to-plot measurement: the tooltip,
2176
+ * zoom, selection and every other pointer reader map through it, so x and y
2177
+ * cannot disagree under CSS zoom.
2178
+ *
2179
+ * Never the `.apexcharts-grid` group's box: a group measures to the union
2180
+ * of what it happens to draw (fact 2 above). The plot's outline starts a
2181
+ * pixel down (`Grid.drawGridArea`), so unless gridlines or row bands reach
2182
+ * the top edge the box starts a pixel below the plot, and on a numeric-x bar
2183
+ * chart the horizontal gridlines run `barPadForNumericAxis` out past both
2184
+ * sides.
2185
+ *
2186
+ * `zoom` is the CSS zoom of any container the chart sits in (screen px per
2187
+ * plot px): the measured svg width over `svgWidth`, the unscaled width it
2188
+ * was drawn at. A distance measured on screen from this corner is divided
2189
+ * by it to land in plot px, the space the series are laid out and painted in.
2190
+ * With nothing mounted to measure, screen px are taken as svg px.
2191
+ *
2192
+ * @param {import('../types/internal').ChartStateW} w
2193
+ * @returns {{ left: number, top: number, width: number, height: number, zoom: number }}
2194
+ */
2195
+ static plotRect(w) {
2196
+ var _a, _b, _c;
2197
+ const svg = ((_a = w.dom.Paper) == null ? void 0 : _a.node) || ((_b = w.dom.baseEl) == null ? void 0 : _b.querySelector(".apexcharts-svg"));
2198
+ const box = ((_c = svg || w.dom.elWrap) == null ? void 0 : _c.getBoundingClientRect()) || {
2199
+ left: 0,
2200
+ top: 0,
2201
+ width: 0
2202
+ };
2203
+ const zoom = (svg && w.globals.svgWidth ? box.width / w.globals.svgWidth : 1) || 1;
2204
+ return {
2205
+ left: box.left + w.layout.translateX * zoom,
2206
+ top: box.top + w.layout.translateY * zoom,
2207
+ width: w.layout.gridWidth * zoom,
2208
+ height: w.layout.gridHeight * zoom,
2209
+ zoom
2210
+ };
2211
+ }
2212
+ /**
2213
+ * Client (screen) x -> pixels from the plot origin of {@link plotRect}.
2214
+ * Pass the rect when the caller has already measured it.
2165
2215
  * @param {import('../types/internal').ChartStateW} w
2166
2216
  * @param {number} screenX
2217
+ * @param {{ left: number, zoom: number }} [plot]
2167
2218
  * @returns {number}
2168
2219
  */
2169
- static screenXToPlotPx(w, screenX) {
2170
- const baseEl = w.dom.baseEl;
2171
- const svg = baseEl && baseEl.querySelector(".apexcharts-svg");
2172
- if (!svg) return screenX - w.layout.translateX;
2173
- const svgRect = svg.getBoundingClientRect();
2174
- const zoom = w.globals.svgWidth ? svgRect.width / w.globals.svgWidth : 1;
2175
- return (screenX - svgRect.left) / (zoom || 1) - w.layout.translateX;
2220
+ static screenXToPlotPx(w, screenX, plot = AxisMapping.plotRect(w)) {
2221
+ return (screenX - plot.left) / plot.zoom;
2176
2222
  }
2177
2223
  }
2178
2224
  function seriesEmitter(ctx, graphics) {
@@ -2245,15 +2291,17 @@ class Bar {
2245
2291
  /**
2246
2292
  * Point the per-series axis state at this series' y axis. Every bar-family
2247
2293
  * renderer calls it before initialPositions, which reads the baseline by
2248
- * this.translationsIndex.
2294
+ * this.translationsIndex and flips it for a reversed axis.
2249
2295
  * @param {number} realIndex
2250
2296
  * @return {number} translationsIndex
2251
2297
  */
2252
2298
  setSeriesAxis(realIndex) {
2299
+ var _a;
2253
2300
  if (this.yRatio.length > 1) {
2254
2301
  this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
2255
2302
  this.translationsIndex = realIndex;
2256
2303
  }
2304
+ this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
2257
2305
  return this.translationsIndex;
2258
2306
  }
2259
2307
  /** primary draw method which is called on bar object
@@ -2270,7 +2318,7 @@ class Bar {
2270
2318
  series = coreUtils.getLogSeries(series);
2271
2319
  this.series = series;
2272
2320
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
2273
- this.barHelpers.initVariables(series);
2321
+ this.barHelpers.initVariables(series, seriesIndex);
2274
2322
  const ret = graphics.group({
2275
2323
  class: "apexcharts-bar-series apexcharts-plot-series"
2276
2324
  });
@@ -2302,7 +2350,6 @@ class Bar {
2302
2350
  this.visibleI = this.visibleI + 1;
2303
2351
  }
2304
2352
  const translationsIndex = this.setSeriesAxis(realIndex);
2305
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
2306
2353
  if (this.isPyramid) {
2307
2354
  this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
2308
2355
  }
@@ -2380,7 +2427,9 @@ class Bar {
2380
2427
  elSeries
2381
2428
  };
2382
2429
  if (this.isHorizontal) {
2383
- paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
2430
+ paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
2431
+ y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
2432
+ }), {
2384
2433
  barHeight,
2385
2434
  zeroW,
2386
2435
  yDivision
@@ -2462,6 +2511,7 @@ class Bar {
2462
2511
  series,
2463
2512
  barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
2464
2513
  barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
2514
+ barXPosition: paths.barXPosition,
2465
2515
  elDataLabelsWrap,
2466
2516
  elGoalsMarkers,
2467
2517
  elBarShadows,
@@ -2472,15 +2522,11 @@ class Bar {
2472
2522
  w.globals.seriesXvalues[realIndex] = xArrj;
2473
2523
  w.globals.seriesYvalues[realIndex] = yArrj;
2474
2524
  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
2525
  renderBarExitGhosts({
2480
2526
  w,
2481
2527
  elSeries,
2482
2528
  record: this._prevRecord(realIndex),
2483
- newKeys,
2529
+ newKeys: this._keys(realIndex),
2484
2530
  isHorizontal: this.isHorizontal,
2485
2531
  speed: w.config.chart.animations.dynamicAnimation.speed
2486
2532
  });
@@ -2489,7 +2535,7 @@ class Bar {
2489
2535
  }
2490
2536
  return ret;
2491
2537
  }
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 */
2538
+ /** @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
2539
  renderSeries({
2494
2540
  hl,
2495
2541
  realIndex,
@@ -2521,7 +2567,9 @@ class Bar {
2521
2567
  visibleSeries,
2522
2568
  type,
2523
2569
  classes,
2524
- fadeReveal = false
2570
+ fadeReveal = false,
2571
+ noLabel
2572
+ // a datum's extra paths (box halves, box lane) label nothing
2525
2573
  }) {
2526
2574
  var _a, _b, _c, _d, _e, _f, _g;
2527
2575
  const w = this.w;
@@ -2595,7 +2643,8 @@ class Bar {
2595
2643
  barXPosition,
2596
2644
  barYPosition,
2597
2645
  visibleSeries,
2598
- hl: hl == null ? void 0 : hl.label
2646
+ hl: hl == null ? void 0 : hl.label,
2647
+ noLabel
2599
2648
  })
2600
2649
  );
2601
2650
  if (delayMs > 0) {
@@ -2611,19 +2660,18 @@ class Bar {
2611
2660
  }
2612
2661
  let leaving = false;
2613
2662
  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) {
2663
+ const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
2664
+ const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
2665
+ if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
2615
2666
  if (this._wasOnScreen(realIndex, j)) leaving = true;
2616
2667
  else skipDrawing = true;
2617
2668
  }
2618
2669
  }
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
- }
2670
+ const datum = (
2671
+ /** @type {any} */
2672
+ w.config.series[realIndex].data[j]
2673
+ );
2674
+ if (datum && datum.strokeColor) lineFill = datum.strokeColor;
2627
2675
  const fill = pathFill;
2628
2676
  if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
2629
2677
  pathFill = "none";
@@ -2646,7 +2694,7 @@ class Bar {
2646
2694
  pathTo,
2647
2695
  stroke: lineFill,
2648
2696
  strokeWidth,
2649
- strokeLineCap: w.config.stroke.lineCap,
2697
+ strokeLinecap: w.config.stroke.lineCap,
2650
2698
  fill: pathFill,
2651
2699
  pathToInterp,
2652
2700
  animationDelay: delay,
@@ -2698,12 +2746,12 @@ class Bar {
2698
2746
  cy: dataLabelsObj.dataLabelsPos.bcy,
2699
2747
  cx: dataLabelsObj.dataLabelsPos.bcx,
2700
2748
  j,
2701
- val: w.seriesData.series[i][j],
2749
+ val: w.seriesData.series[realIndex][j],
2702
2750
  barHeight,
2703
2751
  barWidth,
2704
2752
  // Datum identity for the next update's keyed join (see
2705
2753
  // LengthTransition): survivors match by key, not array position.
2706
- "data:pathKey": datumKey(w, realIndex, j)
2754
+ "data:pathKey": this._keys(realIndex)[j]
2707
2755
  });
2708
2756
  hl == null ? void 0 : hl.paint(renderedPath, {
2709
2757
  delay,
@@ -2779,7 +2827,10 @@ class Bar {
2779
2827
  const j = indexes.j;
2780
2828
  let barYPosition;
2781
2829
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
2782
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
2830
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
2831
+ i: indexes.realIndex,
2832
+ j
2833
+ });
2783
2834
  if (nonZeroColumns > 0) {
2784
2835
  barHeight = this.seriesLen * barHeight / nonZeroColumns;
2785
2836
  }
@@ -2918,7 +2969,7 @@ class Bar {
2918
2969
  barXPosition = xForNumericX.barXPosition;
2919
2970
  } else {
2920
2971
  if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
2921
- const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
2972
+ const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
2922
2973
  if (nonZeroColumns > 0) {
2923
2974
  barWidth = this.seriesLen * barWidth / nonZeroColumns;
2924
2975
  }
@@ -2982,15 +3033,16 @@ class Bar {
2982
3033
  /** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
2983
3034
  getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
2984
3035
  const w = this.w;
3036
+ const overlay = isHistogramOverlay(w);
2985
3037
  let sxI = realIndex;
2986
3038
  if (!w.seriesData.seriesX[realIndex].length) {
2987
3039
  sxI = w.globals.maxValsInArrayIndex;
2988
3040
  }
2989
3041
  if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
2990
- x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
3042
+ x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
2991
3043
  }
2992
3044
  return {
2993
- barXPosition: x + (isHistogramOverlay(w) ? 0 : barWidth * this.visibleI),
3045
+ barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
2994
3046
  x
2995
3047
  };
2996
3048
  }
@@ -3011,7 +3063,20 @@ class Bar {
3011
3063
  _wasOnScreen(realIndex, j) {
3012
3064
  if (!lengthTransitionEnabled(this.w)) return false;
3013
3065
  const keyed = this._prevKeyedPaths(realIndex);
3014
- return !!keyed && keyed.has(datumKey(this.w, realIndex, j));
3066
+ return !!keyed && keyed.has(this._keys(realIndex)[j]);
3067
+ }
3068
+ /**
3069
+ * This render's datum keys for a series (see seriesKeys), as stamped on
3070
+ * each bar and looked up in the previous render's.
3071
+ * @param {number} realIndex
3072
+ * @returns {string[]}
3073
+ */
3074
+ _keys(realIndex) {
3075
+ const c = (
3076
+ /** @type {any} */
3077
+ this._keyCache || (this._keyCache = {})
3078
+ );
3079
+ return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
3015
3080
  }
3016
3081
  /**
3017
3082
  * The captured previous-render record for a series (last match wins, same
@@ -3067,7 +3132,7 @@ class Bar {
3067
3132
  * @returns {boolean}
3068
3133
  */
3069
3134
  isLengthTransition(realIndex) {
3070
- var _a, _b;
3135
+ var _a, _b, _c, _d, _e, _f;
3071
3136
  if (!this._ltCache) this._ltCache = {};
3072
3137
  if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
3073
3138
  const w = this.w;
@@ -3075,20 +3140,14 @@ class Bar {
3075
3140
  if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
3076
3141
  const record = this._prevRecord(realIndex);
3077
3142
  const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
3143
+ const keyed = record && this._prevKeyedPaths(realIndex);
3078
3144
  if (!record) {
3079
3145
  result = dataLen > 0;
3080
- } else if (record.paths.length !== dataLen) {
3081
- result = true;
3146
+ } else if (keyed) {
3147
+ const now = new Set(this._keys(realIndex));
3148
+ 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
3149
  } 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
- }
3150
+ result = record.paths.length !== dataLen;
3092
3151
  }
3093
3152
  }
3094
3153
  this._ltCache[realIndex] = result;
@@ -3148,7 +3207,7 @@ class Bar {
3148
3207
  let isNewDatum = false;
3149
3208
  const keyed = this._prevKeyedPaths(realIndex);
3150
3209
  if (keyed) {
3151
- const prev = keyed.get(datumKey(w, realIndex, j));
3210
+ const prev = keyed.get(this._keys(realIndex)[j]);
3152
3211
  if (prev) {
3153
3212
  oldD = prev.d;
3154
3213
  } else {
@@ -3291,11 +3350,10 @@ class Bar {
3291
3350
  * @returns {boolean | null} null when there is no previous record to consult
3292
3351
  */
3293
3352
  getPreviousFlip(realIndex, j) {
3294
- const w = this.w;
3295
3353
  const record = this._prevRecord(realIndex);
3296
3354
  if (!record) return null;
3297
3355
  const keyed = this._prevKeyedPaths(realIndex);
3298
- const prev = keyed ? keyed.get(datumKey(w, realIndex, j)) : record.paths[j];
3356
+ const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
3299
3357
  return prev ? !!prev.flip : null;
3300
3358
  }
3301
3359
  /**
@@ -3322,7 +3380,7 @@ class BarStacked extends Bar {
3322
3380
  const coreUtils = new CoreUtils(this.w);
3323
3381
  series = coreUtils.getLogSeries(series);
3324
3382
  this.yRatio = coreUtils.getLogYRatios(this.yRatio);
3325
- this.barHelpers.initVariables(series);
3383
+ this.barHelpers.initVariables(series, seriesIndex);
3326
3384
  if (w.config.chart.stackType === "100%") {
3327
3385
  series = w.globals.comboCharts ? (
3328
3386
  /** @type {any} */
@@ -3353,7 +3411,6 @@ class BarStacked extends Bar {
3353
3411
  const xArrValues = [];
3354
3412
  const yArrValues = [];
3355
3413
  const translationsIndex = this.setSeriesAxis(realIndex);
3356
- this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
3357
3414
  let elSeries = this.graphics.group({
3358
3415
  class: `apexcharts-series`,
3359
3416
  seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
@@ -3423,7 +3480,9 @@ class BarStacked extends Bar {
3423
3480
  null
3424
3481
  );
3425
3482
  if (this.isHorizontal) {
3426
- paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
3483
+ paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
3484
+ y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
3485
+ }), {
3427
3486
  zeroW,
3428
3487
  barHeight,
3429
3488
  yDivision
@@ -3497,6 +3556,7 @@ class BarStacked extends Bar {
3497
3556
  series,
3498
3557
  barHeight,
3499
3558
  barWidth,
3559
+ barXPosition: paths.barXPosition,
3500
3560
  elDataLabelsWrap,
3501
3561
  elGoalsMarkers,
3502
3562
  type: "bar",
@@ -3514,7 +3574,7 @@ class BarStacked extends Bar {
3514
3574
  this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
3515
3575
  ret.add(elSeries);
3516
3576
  }
3517
- if (heldMirrors) this.settleHeldMirrors();
3577
+ if (heldMirrors) this.settleHeldMirrors(ret);
3518
3578
  return ret;
3519
3579
  }
3520
3580
  /**
@@ -3535,15 +3595,21 @@ class BarStacked extends Bar {
3535
3595
  * 'bottom' → 'top', where the endpoint really is rounded at the other end;
3536
3596
  * everywhere else the mirror is an exact identity on the settled shape, so
3537
3597
  * removing it changes nothing on screen.
3598
+ *
3599
+ * The marks are collected now, not when the timer fires: a query then also
3600
+ * stripped the mirrors a LATER update was still holding mid-tween.
3601
+ * @param {any} [ret] this draw's series group (default: the whole chart)
3538
3602
  */
3539
- settleHeldMirrors() {
3603
+ settleHeldMirrors(ret) {
3540
3604
  const w = this.w;
3541
3605
  if (!Environment.isBrowser()) return;
3542
3606
  const anim = w.config.chart.animations;
3543
3607
  const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
3608
+ const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
3609
+ ".apexcharts-flip-held"
3610
+ );
3544
3611
  setTimeout(() => {
3545
- if (w.globals.isDestroyed || !Utils.elementExists(w.dom.baseEl)) return;
3546
- w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
3612
+ held.forEach((el) => {
3547
3613
  el.classList.remove(
3548
3614
  "apexcharts-flip-held",
3549
3615
  "apexcharts-flip-y",
@@ -3619,7 +3685,7 @@ class BarStacked extends Bar {
3619
3685
  yDivision,
3620
3686
  elSeries
3621
3687
  }) {
3622
- var _a, _b, _c, _d, _e;
3688
+ var _a, _b;
3623
3689
  const w = this.w;
3624
3690
  const barYPosition = y + columnGroupIndex * barHeight;
3625
3691
  let barXPosition;
@@ -3627,36 +3693,21 @@ class BarStacked extends Bar {
3627
3693
  const j = indexes.j;
3628
3694
  const realIndex = indexes.realIndex;
3629
3695
  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 (
3696
+ const v = (
3649
3697
  /** @type {any} */
3650
- ((_c = this.series[i]) == null ? void 0 : _c[j]) === null
3651
- ) {
3652
- x = barXPosition;
3698
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
3699
+ );
3700
+ const g = this.groupCtx;
3701
+ const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
3702
+ const top = g.tops.get(key);
3703
+ if (top) {
3704
+ const [prevX, prevVal, prevBarW] = top;
3705
+ const flip = (this.isReversed ? prevBarW : 0) * 2;
3706
+ barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
3653
3707
  } 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;
3708
+ barXPosition = zeroW;
3659
3709
  }
3710
+ x = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
3660
3711
  const paths = this.barHelpers.getBarpaths({
3661
3712
  barYPosition,
3662
3713
  barHeight,
@@ -3670,6 +3721,7 @@ class BarStacked extends Bar {
3670
3721
  j,
3671
3722
  w
3672
3723
  });
3724
+ this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
3673
3725
  this.barHelpers.barBackground({
3674
3726
  j,
3675
3727
  i,
@@ -3707,13 +3759,17 @@ class BarStacked extends Bar {
3707
3759
  columnGroupIndex,
3708
3760
  elSeries
3709
3761
  }) {
3710
- var _a, _b, _c, _d, _e, _f;
3762
+ var _a, _b, _c;
3711
3763
  const w = this.w;
3712
3764
  const i = indexes.i;
3713
3765
  const j = indexes.j;
3714
3766
  const bc = indexes.bc;
3715
3767
  const realIndex = indexes.realIndex;
3716
3768
  const translationsIndex = indexes.translationsIndex;
3769
+ const v = (
3770
+ /** @type {any} */
3771
+ (_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
3772
+ );
3717
3773
  if (w.axisFlags.isXNumeric) {
3718
3774
  let seriesVal = w.seriesData.seriesX[realIndex][j];
3719
3775
  if (!seriesVal) seriesVal = 0;
@@ -3728,11 +3784,9 @@ class BarStacked extends Bar {
3728
3784
  const [prevYValue, prevVal, prevBarH] = top;
3729
3785
  let bYP;
3730
3786
  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;
3787
+ bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
3733
3788
  } 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;
3789
+ bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
3736
3790
  }
3737
3791
  if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
3738
3792
  if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
@@ -3745,25 +3799,16 @@ class BarStacked extends Bar {
3745
3799
  } else {
3746
3800
  barYPosition = zeroH;
3747
3801
  }
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
- }
3802
+ y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
3760
3803
  const paths = this.barHelpers.getColumnPaths({
3761
3804
  barXPosition,
3762
3805
  barWidth,
3763
3806
  y1: barYPosition,
3764
3807
  y2: y,
3765
3808
  yRatio: this.yRatio[translationsIndex],
3766
- strokeWidth: this.strokeWidth,
3809
+ // the series' width even for an empty segment, so a hidden layer keeps
3810
+ // its place, but no inset at all when no stroke is drawn
3811
+ strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
3767
3812
  isReversed: this.isReversed,
3768
3813
  series: this.series,
3769
3814
  realIndex: indexes.realIndex,
@@ -3771,17 +3816,7 @@ class BarStacked extends Bar {
3771
3816
  j,
3772
3817
  w
3773
3818
  });
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
- }
3819
+ this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
3785
3820
  this.barHelpers.barBackground({
3786
3821
  bc,
3787
3822
  j,
@@ -3800,13 +3835,32 @@ class BarStacked extends Bar {
3800
3835
  zeroH,
3801
3836
  realIndex,
3802
3837
  j,
3803
- 0
3838
+ translationsIndex
3804
3839
  ),
3805
3840
  barXPosition,
3806
3841
  x: w.axisFlags.isXNumeric ? x : x + xDivision,
3807
3842
  y
3808
3843
  };
3809
3844
  }
3845
+ /**
3846
+ * Record the segment just drawn as the top of its stack. Per key it holds
3847
+ * the top and value of the last segment drawn there, the summed lengths and
3848
+ * raw values of every segment so far (the total label's value), and the
3849
+ * extreme tops below that segment (the total label's position).
3850
+ * @param {any} key @param {any} top @param {number} t @param {any} val
3851
+ * @param {number} len @param {number} realIndex @param {number} j
3852
+ */
3853
+ _setTop(key, top, t, val, len, realIndex, j) {
3854
+ if (isNaN(t)) return;
3855
+ this.groupCtx.tops.set(key, [
3856
+ t,
3857
+ val,
3858
+ (top ? top[2] : 0) + len,
3859
+ (top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
3860
+ top ? Math.min(top[0], top[4]) : 1 / 0,
3861
+ top ? Math.max(top[0], top[5]) : -1 / 0
3862
+ ]);
3863
+ }
3810
3864
  }
3811
3865
  class RangeBar extends Bar {
3812
3866
  /**
@@ -3814,14 +3868,14 @@ class RangeBar extends Bar {
3814
3868
  * @param {number} seriesIndex
3815
3869
  */
3816
3870
  draw(series, seriesIndex) {
3817
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3871
+ var _a, _b, _c, _d, _e, _f;
3818
3872
  const w = this.w;
3819
3873
  const graphics = new Graphics(this.w);
3820
3874
  this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
3821
3875
  this.series = series;
3822
3876
  this.seriesRangeStart = w.rangeData.seriesRangeStart;
3823
3877
  this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
3824
- this.barHelpers.initVariables(series);
3878
+ this.barHelpers.initVariables(series, seriesIndex);
3825
3879
  const ret = graphics.group({
3826
3880
  class: "apexcharts-rangebar-series apexcharts-plot-series"
3827
3881
  });
@@ -3843,6 +3897,9 @@ class RangeBar extends Bar {
3843
3897
  this.visibleI = this.visibleI + 1;
3844
3898
  }
3845
3899
  const translationsIndex = this.setSeriesAxis(realIndex);
3900
+ if (this.isHorizontal && w.labelData.timescaleLabels.length) {
3901
+ this.isReversed = false;
3902
+ }
3846
3903
  const initPositions = this.barHelpers.initialPositions(realIndex);
3847
3904
  const {
3848
3905
  y: initY,
@@ -3852,10 +3909,8 @@ class RangeBar extends Bar {
3852
3909
  zeroH
3853
3910
  // zeroH is the baseline where 0 meets y axis
3854
3911
  } = 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;
3912
+ const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
3913
+ const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
3859
3914
  y = initY;
3860
3915
  x = initX;
3861
3916
  const elDataLabelsWrap = graphics.group({
@@ -3865,10 +3920,16 @@ class RangeBar extends Bar {
3865
3920
  const elGoalsMarkers = graphics.group({
3866
3921
  class: "apexcharts-rangebar-goals-markers"
3867
3922
  });
3923
+ const data = (
3924
+ /** @type {any} */
3925
+ w.config.series[realIndex].data
3926
+ );
3868
3927
  for (let j = 0; j < w.globals.dataPoints; j++) {
3869
3928
  const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
3870
- const y1 = this.seriesRangeStart[i][j];
3871
- const y2 = this.seriesRangeEnd[i][j];
3929
+ let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
3930
+ let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
3931
+ const y1 = this.seriesRangeStart[realIndex][j];
3932
+ const y2 = this.seriesRangeEnd[realIndex][j];
3872
3933
  let paths = (
3873
3934
  /** @type {any} */
3874
3935
  null
@@ -3880,20 +3941,16 @@ class RangeBar extends Bar {
3880
3941
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
3881
3942
  seriesLen = 1;
3882
3943
  }
3883
- if (typeof /** @type {Record<string,any>} */
3884
- ((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
3944
+ if (typeof (data == null ? void 0 : data[j]) === "undefined") {
3885
3945
  break;
3886
3946
  }
3887
3947
  if (this.isHorizontal) {
3888
3948
  barYPosition = y + barHeight * /** @type {any} */
3889
3949
  this.visibleI;
3890
3950
  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
- ) {
3951
+ if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
3895
3952
  const positions = this.detectOverlappingBars({
3896
- i,
3953
+ i: realIndex,
3897
3954
  j,
3898
3955
  barYPosition,
3899
3956
  srty,
@@ -3916,17 +3973,14 @@ class RangeBar extends Bar {
3916
3973
  barWidth = paths.barWidth;
3917
3974
  } else {
3918
3975
  if (w.axisFlags.isXNumeric) {
3919
- x = (w.seriesData.seriesX[i][j] - w.globals.minX) / this.xRatio - barWidth / 2;
3976
+ x = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
3920
3977
  }
3921
3978
  barXPosition = x + barWidth * /** @type {any} */
3922
3979
  this.visibleI;
3923
3980
  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
- ) {
3981
+ if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
3928
3982
  const positions = this.detectOverlappingBars({
3929
- i,
3983
+ i: realIndex,
3930
3984
  j,
3931
3985
  barXPosition,
3932
3986
  srtx,
@@ -3945,9 +3999,10 @@ class RangeBar extends Bar {
3945
3999
  xDivision
3946
4000
  }, params));
3947
4001
  barHeight = paths.barHeight;
4002
+ barXPosition = paths.barXPosition;
3948
4003
  }
3949
4004
  const barGoalLine = this.barHelpers.drawGoalLine({
3950
- barXPosition: paths.barXPosition,
4005
+ barXPosition,
3951
4006
  barYPosition,
3952
4007
  goalX: paths.goalX,
3953
4008
  goalY: paths.goalY,
@@ -3992,19 +4047,11 @@ class RangeBar extends Bar {
3992
4047
  });
3993
4048
  }
3994
4049
  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
4050
  renderBarExitGhosts({
4004
4051
  w,
4005
4052
  elSeries,
4006
4053
  record: this._prevRecord(realIndex),
4007
- newKeys,
4054
+ newKeys: this._keys(realIndex),
4008
4055
  isHorizontal: this.isHorizontal,
4009
4056
  speed: w.config.chart.animations.dynamicAnimation.speed
4010
4057
  });
@@ -4056,11 +4103,11 @@ class RangeBar extends Bar {
4056
4103
  );
4057
4104
  if (overlaps.indexOf(rangeName) > -1) {
4058
4105
  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;
4106
+ barYPosition += barHeight * overlaps.indexOf(rangeName);
4060
4107
  }
4061
4108
  }
4062
4109
  } else {
4063
- if (rowIndex > -1 && !w.labelData.timescaleLabels.length) {
4110
+ if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
4064
4111
  if (w.config.plotOptions.bar.rangeBarGroupRows) {
4065
4112
  barXPosition = srtx + xDivision * rowIndex;
4066
4113
  } else {
@@ -4074,7 +4121,7 @@ class RangeBar extends Bar {
4074
4121
  );
4075
4122
  if (overlaps.indexOf(rangeName) > -1) {
4076
4123
  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;
4124
+ barXPosition += barWidth * overlaps.indexOf(rangeName);
4078
4125
  }
4079
4126
  }
4080
4127
  }
@@ -4097,7 +4144,7 @@ class RangeBar extends Bar {
4097
4144
  var _a, _b;
4098
4145
  const w = this.w;
4099
4146
  const { i, j, realIndex, translationsIndex } = indexes;
4100
- const yRatio = this.yRatio[translationsIndex];
4147
+ const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
4101
4148
  const range = this.getRangeValue(realIndex, j);
4102
4149
  let y1 = Math.min(range.start, range.end);
4103
4150
  let y2 = Math.max(range.start, range.end);
@@ -4105,7 +4152,7 @@ class RangeBar extends Bar {
4105
4152
  ((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
4106
4153
  ((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
4107
4154
  if (!hasValue) {
4108
- y1 = zeroH;
4155
+ y1 = y2 = zeroH;
4109
4156
  } else {
4110
4157
  y1 = zeroH - y1 / yRatio;
4111
4158
  y2 = zeroH - y2 / yRatio;
@@ -4166,6 +4213,30 @@ class RangeBar extends Bar {
4166
4213
  barXPosition
4167
4214
  };
4168
4215
  }
4216
+ /**
4217
+ * Timeline datums key by their own row, not by the j-th label: a row can
4218
+ * hold several bars, so labels[j] names some other datum's row.
4219
+ * @param {number} realIndex
4220
+ * @returns {string[]}
4221
+ */
4222
+ _keys(realIndex) {
4223
+ const c = (
4224
+ /** @type {any} */
4225
+ this._keyCache || (this._keyCache = {})
4226
+ );
4227
+ const data = (
4228
+ /** @type {any} */
4229
+ this.w.config.series[realIndex].data
4230
+ );
4231
+ return c[realIndex] || (c[realIndex] = uniquifyKeys(
4232
+ (data || []).map(
4233
+ (d, j) => {
4234
+ var _a;
4235
+ return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
4236
+ }
4237
+ )
4238
+ ));
4239
+ }
4169
4240
  /**
4170
4241
  * @param {number} val
4171
4242
  */
@@ -4192,8 +4263,9 @@ class RangeBar extends Bar {
4192
4263
  }) {
4193
4264
  const w = this.w;
4194
4265
  const { realIndex, j } = indexes;
4195
- const x1 = this.preventBarOverflow(zeroW + y1 / this.invertedYRatio);
4196
- const x2 = this.preventBarOverflow(zeroW + y2 / this.invertedYRatio);
4266
+ const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
4267
+ const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
4268
+ const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
4197
4269
  const range = this.getRangeValue(realIndex, j);
4198
4270
  const barWidth = Math.abs(x2 - x1);
4199
4271
  const paths = this.barHelpers.getBarpaths({