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
@@ -27,7 +27,7 @@ class BarStacked extends Bar {
27
27
  series = coreUtils.getLogSeries(series)
28
28
  this.yRatio = coreUtils.getLogYRatios(this.yRatio)
29
29
 
30
- this.barHelpers.initVariables(series)
30
+ this.barHelpers.initVariables(series, seriesIndex)
31
31
 
32
32
  if (w.config.chart.stackType === '100%') {
33
33
  series = w.globals.comboCharts
@@ -74,10 +74,6 @@ class BarStacked extends Bar {
74
74
 
75
75
  const translationsIndex = this.setSeriesAxis(realIndex)
76
76
 
77
- this.isReversed =
78
- w.config.yaxis[this.yaxisIndex] &&
79
- w.config.yaxis[this.yaxisIndex].reversed
80
-
81
77
  // el to which series will be drawn
82
78
  let elSeries = this.graphics.group({
83
79
  class: `apexcharts-series`,
@@ -160,6 +156,11 @@ class BarStacked extends Bar {
160
156
  if (this.isHorizontal) {
161
157
  paths = this.drawStackedBarPaths({
162
158
  ...commonPathOpts,
159
+ ...(this.barHelpers.rows && {
160
+ y:
161
+ initPositions.y +
162
+ this.barHelpers.barRow(realIndex, j) * yDivision,
163
+ }),
163
164
  zeroW,
164
165
  barHeight,
165
166
  yDivision,
@@ -263,6 +264,7 @@ class BarStacked extends Bar {
263
264
  series,
264
265
  barHeight,
265
266
  barWidth,
267
+ barXPosition: paths.barXPosition,
266
268
  elDataLabelsWrap,
267
269
  elGoalsMarkers,
268
270
  type: 'bar',
@@ -286,7 +288,7 @@ class BarStacked extends Bar {
286
288
  ret.add(elSeries)
287
289
  }
288
290
 
289
- if (heldMirrors) this.settleHeldMirrors()
291
+ if (heldMirrors) this.settleHeldMirrors(ret)
290
292
 
291
293
  return ret
292
294
  }
@@ -310,8 +312,12 @@ class BarStacked extends Bar {
310
312
  * 'bottom' → 'top', where the endpoint really is rounded at the other end;
311
313
  * everywhere else the mirror is an exact identity on the settled shape, so
312
314
  * removing it changes nothing on screen.
315
+ *
316
+ * The marks are collected now, not when the timer fires: a query then also
317
+ * stripped the mirrors a LATER update was still holding mid-tween.
318
+ * @param {any} [ret] this draw's series group (default: the whole chart)
313
319
  */
314
- settleHeldMirrors() {
320
+ settleHeldMirrors(ret) {
315
321
  const w = this.w
316
322
  if (!Environment.isBrowser()) return
317
323
 
@@ -319,18 +325,18 @@ class BarStacked extends Bar {
319
325
  // Matches the collapsing-series hold: morphSVG applies the stagger delay
320
326
  // twice, so the real tail runs past dynamicAnimation.speed on its own.
321
327
  const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100
328
+ const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
329
+ '.apexcharts-flip-held',
330
+ )
322
331
 
323
332
  setTimeout(() => {
324
- if (w.globals.isDestroyed || !Utils.elementExists(w.dom.baseEl)) return
325
- w.dom.baseEl
326
- .querySelectorAll('.apexcharts-flip-held')
327
- .forEach((/** @type {Element} */ el) => {
328
- el.classList.remove(
329
- 'apexcharts-flip-held',
330
- 'apexcharts-flip-y',
331
- 'apexcharts-flip-x',
332
- )
333
- })
333
+ held.forEach((/** @type {Element} */ el) => {
334
+ el.classList.remove(
335
+ 'apexcharts-flip-held',
336
+ 'apexcharts-flip-y',
337
+ 'apexcharts-flip-x',
338
+ )
339
+ })
334
340
  }, hold)
335
341
  }
336
342
 
@@ -454,53 +460,34 @@ class BarStacked extends Bar {
454
460
  const j = indexes.j
455
461
  const realIndex = indexes.realIndex
456
462
  const translationsIndex = indexes.translationsIndex
463
+ // past the end of a short series reads as null, as a padded one would
464
+ const v = /** @type {any} */ (this.series)[i]?.[j] ?? null
457
465
 
458
- let prevBarW = 0
459
- for (let k = 0; k < this.groupCtx.prevXF.length; k++) {
460
- prevBarW = prevBarW + this.groupCtx.prevXF[k][j]
461
- }
462
-
463
- // Where this series sits in its group's stack. See the note in
464
- // drawStackedColumnPaths: the index has to count the series this renderer
465
- // has already drawn for the group, which is exactly what prevX holds.
466
- const gsi = this.groupCtx.prevX.length
467
-
468
- if (gsi > 0) {
469
- let bXP = zeroW
470
-
471
- if (this.groupCtx.prevXVal[gsi - 1][j] < 0) {
472
- bXP =
473
- /** @type {any} */ (this.series)[i]?.[j] >= 0
474
- ? this.groupCtx.prevX[gsi - 1][j] +
475
- prevBarW -
476
- (this.isReversed ? prevBarW : 0) * 2
477
- : this.groupCtx.prevX[gsi - 1][j]
478
- } else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) {
479
- bXP =
480
- /** @type {any} */ (this.series)[i]?.[j] >= 0
481
- ? this.groupCtx.prevX[gsi - 1][j]
482
- : this.groupCtx.prevX[gsi - 1][j] -
483
- prevBarW +
484
- (this.isReversed ? prevBarW : 0) * 2
485
- }
486
-
487
- barXPosition = bXP
466
+ // The layer below is found by x on a numeric axis, as for columns (see
467
+ // drawStackedColumnPaths): a series without a row's x leaves that row's
468
+ // stack as it was.
469
+ const g = this.groupCtx
470
+ const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j
471
+ const top = g.tops.get(key)
472
+ if (top) {
473
+ const [prevX, prevVal, prevBarW] = top
474
+ const flip = (this.isReversed ? prevBarW : 0) * 2
475
+ barXPosition =
476
+ prevVal < 0
477
+ ? v >= 0
478
+ ? prevX + prevBarW - flip
479
+ : prevX
480
+ : v >= 0
481
+ ? prevX
482
+ : prevX - prevBarW + flip
488
483
  } else {
489
- // the first series will not have prevX values
484
+ // nothing is stacked in this row yet
490
485
  barXPosition = zeroW
491
486
  }
492
487
 
493
- if (/** @type {any} */ (this.series)[i]?.[j] === null) {
494
- x = barXPosition
495
- } else {
496
- x =
497
- barXPosition +
498
- /** @type {any} */ (this.series)[i]?.[j] / this.invertedYRatio -
499
- (this.isReversed
500
- ? /** @type {any} */ (this.series)[i]?.[j] / this.invertedYRatio
501
- : 0) *
502
- 2
503
- }
488
+ x =
489
+ barXPosition +
490
+ (v / this.invertedYRatio) * (this.isReversed ? -1 : 1)
504
491
 
505
492
  const paths = this.barHelpers.getBarpaths({
506
493
  barYPosition,
@@ -516,6 +503,8 @@ class BarStacked extends Bar {
516
503
  w,
517
504
  })
518
505
 
506
+ this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j)
507
+
519
508
  this.barHelpers.barBackground({
520
509
  j,
521
510
  i,
@@ -561,6 +550,7 @@ class BarStacked extends Bar {
561
550
  const bc = indexes.bc
562
551
  const realIndex = indexes.realIndex
563
552
  const translationsIndex = indexes.translationsIndex
553
+ const v = /** @type {any} */ (this.series)[i]?.[j] ?? null
564
554
 
565
555
  if (w.axisFlags.isXNumeric) {
566
556
  let seriesVal = w.seriesData.seriesX[realIndex][j]
@@ -589,12 +579,12 @@ class BarStacked extends Bar {
589
579
  let bYP
590
580
  if (prevVal < 0) {
591
581
  bYP =
592
- /** @type {any} */ (this.series)[i]?.[j] >= 0
582
+ v >= 0
593
583
  ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2
594
584
  : prevYValue
595
585
  } else if (prevVal >= 0) {
596
586
  bYP =
597
- /** @type {any} */ (this.series)[i]?.[j] >= 0
587
+ v >= 0
598
588
  ? prevYValue
599
589
  : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2
600
590
  }
@@ -621,20 +611,10 @@ class BarStacked extends Bar {
621
611
  barYPosition = zeroH
622
612
  }
623
613
 
624
- if (/** @type {any} */ (this.series)[i]?.[j]) {
625
- y =
626
- barYPosition -
627
- /** @type {any} */ (this.series)[i]?.[j] /
628
- this.yRatio[translationsIndex] +
629
- (this.isReversed
630
- ? /** @type {any} */ (this.series)[i]?.[j] /
631
- this.yRatio[translationsIndex]
632
- : 0) *
633
- 2
634
- } else {
635
- // fixes #3610
636
- y = barYPosition
637
- }
614
+ // a null stays on its layer below (#3610)
615
+ y =
616
+ barYPosition -
617
+ (v / this.yRatio[translationsIndex]) * (this.isReversed ? -1 : 1)
638
618
 
639
619
  const paths = this.barHelpers.getColumnPaths({
640
620
  barXPosition,
@@ -642,7 +622,9 @@ class BarStacked extends Bar {
642
622
  y1: barYPosition,
643
623
  y2: y,
644
624
  yRatio: this.yRatio[translationsIndex],
645
- strokeWidth: this.strokeWidth,
625
+ // the series' width even for an empty segment, so a hidden layer keeps
626
+ // its place, but no inset at all when no stroke is drawn
627
+ strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
646
628
  isReversed: this.isReversed,
647
629
  series: this.series,
648
630
  realIndex: indexes.realIndex,
@@ -651,17 +633,7 @@ class BarStacked extends Bar {
651
633
  w,
652
634
  })
653
635
 
654
- const t = g.yArrj[j]
655
- if (!isNaN(t)) {
656
- g.tops.set(key, [
657
- t,
658
- g.yArrjVal[j],
659
- (top ? top[2] : 0) + g.yArrjF[j],
660
- (top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
661
- top ? Math.min(top[0], top[4]) : 1 / 0,
662
- top ? Math.max(top[0], top[5]) : -1 / 0,
663
- ])
664
- }
636
+ this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j)
665
637
 
666
638
  this.barHelpers.barBackground({
667
639
  bc,
@@ -681,13 +653,33 @@ class BarStacked extends Bar {
681
653
  zeroH,
682
654
  realIndex,
683
655
  j,
684
- 0,
656
+ translationsIndex,
685
657
  ),
686
658
  barXPosition,
687
659
  x: w.axisFlags.isXNumeric ? x : x + xDivision,
688
660
  y,
689
661
  }
690
662
  }
663
+
664
+ /**
665
+ * Record the segment just drawn as the top of its stack. Per key it holds
666
+ * the top and value of the last segment drawn there, the summed lengths and
667
+ * raw values of every segment so far (the total label's value), and the
668
+ * extreme tops below that segment (the total label's position).
669
+ * @param {any} key @param {any} top @param {number} t @param {any} val
670
+ * @param {number} len @param {number} realIndex @param {number} j
671
+ */
672
+ _setTop(key, top, t, val, len, realIndex, j) {
673
+ if (isNaN(t)) return
674
+ this.groupCtx.tops.set(key, [
675
+ t,
676
+ val,
677
+ (top ? top[2] : 0) + len,
678
+ (top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
679
+ top ? Math.min(top[0], top[4]) : 1 / 0,
680
+ top ? Math.max(top[0], top[5]) : -1 / 0,
681
+ ])
682
+ }
691
683
  }
692
684
 
693
685
  export default BarStacked
@@ -5,9 +5,8 @@ import Fill from '../modules/Fill'
5
5
  import Graphics from '../modules/Graphics'
6
6
  import Series from '../modules/Series'
7
7
  import Utils from '../utils/Utils'
8
- import { buildJitterGroups, renderJitter } from './common/Jitter'
8
+ import { buildJitterGroups, jitterExtent, renderJitter } from './common/Jitter'
9
9
  import {
10
- datumKey,
11
10
  lengthTransitionEnabled,
12
11
  renderBarExitGhosts,
13
12
  } from '../modules/animations/LengthTransition'
@@ -55,7 +54,7 @@ class BoxCandleStick extends Bar {
55
54
  if (!keyed || keyed.size === 0 || !row || row.length === 0) return false
56
55
  let survivors = 0
57
56
  for (let j = 0; j < row.length; j++) {
58
- if (keyed.has(datumKey(this.w, realIndex, j))) survivors++
57
+ if (keyed.has(this._keys(realIndex)[j])) survivors++
59
58
  }
60
59
  return survivors / keyed.size < 0.5
61
60
  }
@@ -86,7 +85,7 @@ class BoxCandleStick extends Bar {
86
85
  }
87
86
  this._prevHalves[realIndex] = map
88
87
  }
89
- const halves = map && map.get(datumKey(this.w, realIndex, j))
88
+ const halves = map && map.get(this._keys(realIndex)[j])
90
89
  return halves && halves.length === 2 ? halves[pi] : null
91
90
  }
92
91
 
@@ -105,15 +104,13 @@ class BoxCandleStick extends Bar {
105
104
  this.candlestickOptions = this.w.config.plotOptions.candlestick
106
105
  this.boxOptions = this.w.config.plotOptions.boxPlot
107
106
  this.isHorizontal = w.config.plotOptions.bar.horizontal
108
- this.isOHLC =
109
- this.candlestickOptions && this.candlestickOptions.type === 'ohlc'
110
107
 
111
108
  this.coreUtils = new CoreUtils(this.w)
112
109
  series = this.coreUtils.getLogSeries(series)
113
110
  this.series = series
114
111
  this.yRatio = this.coreUtils.getLogYRatios(this.yRatio)
115
112
 
116
- this.barHelpers.initVariables(series)
113
+ this.barHelpers.initVariables(series, seriesIndex)
117
114
 
118
115
  const ret = graphics.group({
119
116
  class: `apexcharts-${type}-series apexcharts-plot-series`,
@@ -124,6 +121,8 @@ class BoxCandleStick extends Bar {
124
121
  // beside candles), and `i` counts only this type's series, not the
125
122
  // config's: reading either drew a candle as a box, or a box as a candle.
126
123
  this.isBoxPlot = type === 'boxPlot'
124
+ this.isOHLC = !this.isBoxPlot && this.candlestickOptions?.type === 'ohlc'
125
+ const jx = jitterExtent(w.candleData.seriesBoxPoints, w)
127
126
 
128
127
  for (let i = 0; i < series.length; i++) {
129
128
  /** @type {any} */
@@ -264,7 +263,7 @@ class BoxCandleStick extends Bar {
264
263
  yArrj.push(y)
265
264
 
266
265
  // drawVerticalBoxPaths returns culled:true for off-screen bars (it
267
- // skipped the path-string build). Horizontal bars are never culled.
266
+ // skipped the path-string build), and both do for a null datum.
268
267
  if (paths.culled) {
269
268
  continue
270
269
  }
@@ -310,6 +309,7 @@ class BoxCandleStick extends Bar {
310
309
  i,
311
310
  pathFrom: this._prevBoxHalf(realIndex, j, pi) ?? paths.pathFrom,
312
311
  fadeReveal,
312
+ noLabel: pi > 0,
313
313
  pathTo,
314
314
  strokeWidth,
315
315
  elSeries,
@@ -343,14 +343,14 @@ class BoxCandleStick extends Bar {
343
343
  )
344
344
  let center, halfExtent, alongFn
345
345
  if (this.isHorizontal) {
346
- const yRatio = this.invertedYRatio
346
+ const yRatio = this.invertedYRatio * (this.isReversed ? -1 : 1)
347
347
  const bh = barHeight ?? 0
348
348
  const z = zeroW ?? 0
349
349
  center = paths.barYPosition + bh / 2
350
350
  halfExtent = bh / 2
351
351
  alongFn = (/** @type {number} */ v) => z + logVal(v) / yRatio
352
352
  } else {
353
- const yRatio = this.yRatio[translationsIndex]
353
+ const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1)
354
354
  const bw = barWidth ?? 0
355
355
  const z = zeroH ?? 0
356
356
  center = paths.barXPosition + bw / 2
@@ -358,8 +358,8 @@ class BoxCandleStick extends Bar {
358
358
  alongFn = (/** @type {number} */ v) => z - logVal(v) / yRatio
359
359
  }
360
360
  const groups = buildJitterGroups({
361
- w,
362
361
  points: pts,
362
+ extent: jx,
363
363
  seedA: realIndex,
364
364
  seedB: j,
365
365
  center,
@@ -397,18 +397,16 @@ class BoxCandleStick extends Bar {
397
397
  // gone (a series hidden from the legend, rows removed) shrink away under
398
398
  // the survivors instead of vanishing. Keyed by every datum the series
399
399
  // still has, culled ones included: a candle only scrolled off-screen
400
- // has not left, it is just not drawn.
400
+ // has not left, it is just not drawn. One turned null has left.
401
401
  // (Not when the series fades: the fade replaces the whole set at once.)
402
402
  if (w.globals.previousPaths.length > 0 && !fadeReveal) {
403
- const newKeys = []
404
- for (let j = 0; j < series[i].length; j++) {
405
- newKeys.push(datumKey(w, realIndex, j))
406
- }
407
403
  renderBarExitGhosts({
408
404
  w,
409
405
  elSeries,
410
406
  record: this._prevRecord(realIndex),
411
- newKeys,
407
+ newKeys: this._keys(realIndex).filter(
408
+ (_, j) => series[i][j] != null,
409
+ ),
412
410
  isHorizontal: this.isHorizontal,
413
411
  speed: w.config.chart.animations.dynamicAnimation.speed,
414
412
  })
@@ -449,7 +447,7 @@ class BoxCandleStick extends Bar {
449
447
  const colorPos = getColor(candleColors.upward)
450
448
  const colorNeg = getColor(candleColors.downward)
451
449
 
452
- const yRatio = this.yRatio[indexes.translationsIndex]
450
+ const yRatio = this.yRatio[indexes.translationsIndex] * (this.isReversed ? -1 : 1)
453
451
 
454
452
  const ohlc = this.getOHLCValue(realIndex, j)
455
453
  let l1 = zeroH
@@ -478,10 +476,9 @@ class BoxCandleStick extends Bar {
478
476
  barXPosition = pos.barXPosition
479
477
  }
480
478
 
481
- if (
482
- typeof /** @type {any} */ (this.series)[i]?.[j] === 'undefined' ||
483
- /** @type {any} */ (this.series)[i]?.[j] === null
484
- ) {
479
+ // a null or missing datum draws nothing, culled like an off-screen one
480
+ const hole = /** @type {any} */ (this.series)[i]?.[j] == null
481
+ if (hole) {
485
482
  y1 = zeroH
486
483
  y2 = zeroH
487
484
  } else {
@@ -506,10 +503,11 @@ class BoxCandleStick extends Bar {
506
503
  // are bounded by what was visible before, and large datasets skip the
507
504
  // morph for the bulk fade anyway.
508
505
  if (
509
- cullBounds &&
510
- (barXPosition + barWidth < cullBounds.lo ||
511
- barXPosition > cullBounds.hi) &&
512
- !this._wasOnScreen(realIndex, j)
506
+ hole ||
507
+ (cullBounds &&
508
+ (barXPosition + barWidth < cullBounds.lo ||
509
+ barXPosition > cullBounds.hi) &&
510
+ !this._wasOnScreen(realIndex, j))
513
511
  ) {
514
512
  return {
515
513
  pathTo: null,
@@ -646,7 +644,7 @@ class BoxCandleStick extends Bar {
646
644
  const getColor = (color) =>
647
645
  Array.isArray(color) ? color[realIndex] : color
648
646
 
649
- const yRatio = this.invertedYRatio
647
+ const yRatio = this.invertedYRatio * (this.isReversed ? -1 : 1)
650
648
  const ohlc = this.getOHLCValue(realIndex, j)
651
649
 
652
650
  let color =
@@ -669,10 +667,8 @@ class BoxCandleStick extends Bar {
669
667
  // Bar.drawBarPaths.
670
668
  const barYPosition = y + barHeight * this.visibleI
671
669
 
672
- if (
673
- typeof /** @type {any} */ (this.series)[i]?.[j] === 'undefined' ||
674
- /** @type {any} */ (this.series)[i]?.[j] === null
675
- ) {
670
+ const hole = /** @type {any} */ (this.series)[i]?.[j] == null
671
+ if (hole) {
676
672
  x1 = zeroW
677
673
  x2 = zeroW
678
674
  } else {
@@ -743,6 +739,7 @@ class BoxCandleStick extends Bar {
743
739
  ),
744
740
  barYPosition,
745
741
  color,
742
+ culled: hole,
746
743
  }
747
744
  }
748
745