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
@@ -160,7 +160,7 @@ export function joinKeys(oldKeys, newKeys) {
160
160
  * @param {string[]} keys
161
161
  * @returns {string[]}
162
162
  */
163
- function uniquifyKeys(keys) {
163
+ export function uniquifyKeys(keys) {
164
164
  /** @type {Map<string, number>} */
165
165
  const seen = new Map()
166
166
  return keys.map((k) => {
@@ -170,6 +170,26 @@ function uniquifyKeys(keys) {
170
170
  })
171
171
  }
172
172
 
173
+ /**
174
+ * Datum keys of a series, unique within it: repeated category labels (or a
175
+ * timeline's rows) would otherwise share one key, and the keyed bar morph
176
+ * would hand every duplicate the same previous bar.
177
+ *
178
+ * @param {import('../../types/internal').ChartStateW} w
179
+ * @param {number} realIndex
180
+ * @param {number} [n] how many datums (default: the parsed series length)
181
+ * @returns {string[]}
182
+ */
183
+ export function seriesKeys(
184
+ w,
185
+ realIndex,
186
+ n = w.seriesData.series[realIndex]?.length | 0,
187
+ ) {
188
+ return uniquifyKeys(
189
+ Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j)),
190
+ )
191
+ }
192
+
173
193
  /**
174
194
  * The keyed join for one series against the captured previous frame, or null
175
195
  * when this render is not an animated update for that series (no frame,
@@ -212,7 +232,7 @@ export function seriesJoin(
212
232
  const oldKeys = uniquifyKeys(
213
233
  oldY.map((_, j) => frameDatumKey(frame, realIndex, j)),
214
234
  )
215
- const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)))
235
+ const newKeys = seriesKeys(w, realIndex)
216
236
  const join = joinKeys(oldKeys, newKeys)
217
237
  if (!join.ordered && !allowReorder) return null
218
238
  if (!join.changed && !includeIdentity) return null
@@ -48,10 +48,16 @@ export default class Helpers {
48
48
  }
49
49
 
50
50
  /**
51
+ * Measure a label's background and draw it. With `deferDraw` it only
52
+ * measures, and returns the step that draws the rect: annotationsBackground
53
+ * measures every label before drawing any, since each rect drawn would force
54
+ * a fresh layout for the next label's reads.
51
55
  * @param {any} annoEl
52
56
  * @param {Record<string, any>} anno
57
+ * @param {boolean} [deferDraw]
58
+ * @returns {any}
53
59
  */
54
- addBackgroundToAnno(annoEl, anno) {
60
+ addBackgroundToAnno(annoEl, anno, deferDraw) {
55
61
  const w = this.w
56
62
 
57
63
  if (!annoEl || !anno.label.text || !String(anno.label.text).trim()) {
@@ -94,28 +100,33 @@ export default class Helpers {
94
100
 
95
101
  const x1 = (coords.left - gridLeft) / zoom - pleft
96
102
  const y1 = (coords.top - gridTop) / zoom - ptop
97
- const elRect = this.annoCtx.graphics.drawRect(
98
- x1,
99
- y1,
100
- coords.width / zoom + pleft + pright,
101
- coords.height / zoom + ptop + pbottom,
102
- anno.label.borderRadius,
103
- anno.label.style.background,
104
- 1,
105
- anno.label.borderWidth,
106
- anno.label.borderColor,
107
- 0,
108
- )
103
+ const draw = () => {
104
+ const elRect = this.annoCtx.graphics.drawRect(
105
+ x1,
106
+ y1,
107
+ coords.width / zoom + pleft + pright,
108
+ coords.height / zoom + ptop + pbottom,
109
+ anno.label.borderRadius,
110
+ anno.label.style.background,
111
+ 1,
112
+ anno.label.borderWidth,
113
+ anno.label.borderColor,
114
+ 0,
115
+ )
109
116
 
110
- if (anno.id) {
111
- elRect.node.classList.add(anno.id)
112
- }
117
+ if (anno.id) {
118
+ elRect.node.classList.add(anno.id)
119
+ }
113
120
 
114
- return elRect
121
+ return elRect
122
+ }
123
+ return deferDraw ? draw : draw()
115
124
  }
116
125
 
117
126
  annotationsBackground() {
118
127
  const w = this.w
128
+ /** @type {Function[]} */
129
+ const drawn = []
119
130
 
120
131
  /**
121
132
  * @param {Record<string, any>} anno
@@ -123,44 +134,47 @@ export default class Helpers {
123
134
  * @param {string} type
124
135
  */
125
136
  const add = (anno, i, type) => {
126
- const annoLabel = w.dom.baseEl.querySelector(
127
- `.apexcharts-${type}-annotations .apexcharts-${type}-annotation-label[rel='${i}']`,
137
+ // Null when the label is missing: addBackgroundToAnno returns null then.
138
+ const annoLabel = /** @type {Element} */ (
139
+ w.dom.baseEl.querySelector(
140
+ `.apexcharts-${type}-annotations .apexcharts-${type}-annotation-label[rel='${i}']`,
141
+ )
128
142
  )
143
+ // Measured now, drawn in a second pass: see addBackgroundToAnno.
144
+ const draw = this.addBackgroundToAnno(annoLabel, anno, true)
145
+ if (!draw) return
146
+ drawn.push(() => {
147
+ const elRect = draw()
148
+ // insertBefore, not before(): the SSR DOM has no ChildNode methods.
149
+ const parent = /** @type {Node} */ (annoLabel.parentNode)
150
+ parent?.insertBefore(elRect.node, annoLabel)
151
+
152
+ // Mirror the label's progressive reveal onto the background rect so
153
+ // it doesn't pop in before the line draw reaches the annotation x.
154
+ const labelX = annoLabel.getAttribute('x')
155
+ if (labelX !== null) {
156
+ applyProgressiveReveal(elRect, parseFloat(labelX), w)
157
+ }
129
158
 
130
- if (annoLabel) {
131
- const parent = annoLabel.parentNode
132
- const elRect = this.addBackgroundToAnno(annoLabel, anno)
133
-
134
- if (elRect) {
135
- parent?.insertBefore(elRect.node, annoLabel)
136
-
137
- // Mirror the label's progressive reveal onto the background rect so
138
- // it doesn't pop in before the line draw reaches the annotation x.
139
- const labelX = annoLabel.getAttribute('x')
140
- if (labelX !== null) {
141
- applyProgressiveReveal(elRect, parseFloat(labelX), w)
142
- }
143
-
144
- if (anno.label.mouseEnter) {
145
- elRect.node.addEventListener(
146
- 'mouseenter',
147
- anno.label.mouseEnter.bind(this, anno),
148
- )
149
- }
150
- if (anno.label.mouseLeave) {
151
- elRect.node.addEventListener(
152
- 'mouseleave',
153
- anno.label.mouseLeave.bind(this, anno),
154
- )
155
- }
156
- if (anno.label.click) {
157
- elRect.node.addEventListener(
158
- 'click',
159
- anno.label.click.bind(this, anno),
160
- )
161
- }
159
+ if (anno.label.mouseEnter) {
160
+ elRect.node.addEventListener(
161
+ 'mouseenter',
162
+ anno.label.mouseEnter.bind(this, anno),
163
+ )
162
164
  }
163
- }
165
+ if (anno.label.mouseLeave) {
166
+ elRect.node.addEventListener(
167
+ 'mouseleave',
168
+ anno.label.mouseLeave.bind(this, anno),
169
+ )
170
+ }
171
+ if (anno.label.click) {
172
+ elRect.node.addEventListener(
173
+ 'click',
174
+ anno.label.click.bind(this, anno),
175
+ )
176
+ }
177
+ })
164
178
  }
165
179
 
166
180
  /**
@@ -184,6 +198,8 @@ export default class Helpers {
184
198
  w.config.annotations.points.forEach(
185
199
  (/** @type {any} */ anno, /** @type {any} */ i) => add(anno, i, 'point'),
186
200
  )
201
+
202
+ drawn.forEach((draw) => draw())
187
203
  }
188
204
 
189
205
  /**
@@ -4,6 +4,7 @@ import XAxis from './XAxis'
4
4
  import AxesUtils from './AxesUtils'
5
5
  import { BrowserAPIs } from '../../ssr/BrowserAPIs.js'
6
6
  import { SVGNS } from '../../svg/math'
7
+ import { BAR_PATHWAY_TYPES } from '../settings/TypeAliases'
7
8
 
8
9
  /**
9
10
  * ApexCharts Grid Class for drawing Cartesian Grid.
@@ -98,9 +99,7 @@ class Grid {
98
99
  : w.config.stroke.width
99
100
 
100
101
  const hasBar =
101
- ['bar', 'rangeBar', 'candlestick', 'boxPlot', 'violin'].includes(
102
- w.config.chart.type,
103
- ) || gl.comboBarCount > 0
102
+ BAR_PATHWAY_TYPES.includes(w.config.chart.type) || gl.comboBarCount > 0
104
103
 
105
104
  let barWidthLeft = 0
106
105
  let barWidthRight = 0
@@ -220,11 +219,25 @@ class Grid {
220
219
  }
221
220
  }
222
221
 
223
- const xAxis = new XAxis(this.w, this.ctx)
224
- xAxis.drawXaxisTicks(x1, y_2, w.dom.elGraphical)
222
+ this._drawXTick(x1, y_2)
225
223
  }
226
224
  }
227
225
 
226
+ /**
227
+ * One XAxis per renderGrid draws every tick (each construction copies all
228
+ * labels), and none is built when ticks are off.
229
+ * @param {number} x1
230
+ * @param {number} y2
231
+ */
232
+ _drawXTick(x1, y2) {
233
+ if (!this.w.config.xaxis.axisTicks.show) return
234
+ ;(this._xTicks ||= new XAxis(this.w, this.ctx)).drawXaxisTicks(
235
+ x1,
236
+ y2,
237
+ this.w.dom.elGraphical,
238
+ )
239
+ }
240
+
228
241
  /** @param {{i: any, x1: any, y1: any, x2: any, y2: any, xCount: any, parent: any}} opts */
229
242
  _drawGridLine({ i, x1, y1, x2, y2, xCount, parent }) {
230
243
  const w = this.w
@@ -389,8 +402,7 @@ class Grid {
389
402
  })
390
403
  }
391
404
 
392
- const xAxis = new XAxis(this.w, this.ctx)
393
- xAxis.drawXaxisTicks(x1, 0, w.dom.elGraphical)
405
+ this._drawXTick(x1, 0)
394
406
  x1 += w.layout.gridWidth / xCount
395
407
  x2 = x1
396
408
  }
@@ -424,6 +436,8 @@ class Grid {
424
436
  const gl = w.globals
425
437
  const graphics = new Graphics(this.w)
426
438
 
439
+ /** @type {XAxis | null} */
440
+ this._xTicks = null
427
441
  this.elg = graphics.group({ class: 'apexcharts-grid' })
428
442
  this.elgridLinesH = graphics.group({
429
443
  class: 'apexcharts-gridlines-horizontal',
@@ -87,6 +87,7 @@ export default class YAxis {
87
87
  lY += parseInt(yaxisFontSize, 10) / 3
88
88
 
89
89
  let firstLabel = null
90
+ const drawn = new Set()
90
91
  for (let i = tickAmount; i >= 0; i--) {
91
92
  const thinned = labelStep > 1 && i % labelStep !== 0
92
93
  const val = thinned ? '' : lbFormatter(labels[i], i, w)
@@ -104,20 +105,16 @@ export default class YAxis {
104
105
  )
105
106
  const foreColor = Array.isArray(yColors) ? yColors[i] : yColors
106
107
 
107
- const existingYLabels = Array.from(
108
- w.dom.baseEl.querySelectorAll(
109
- `.apexcharts-yaxis[rel='${realIndex}'] .apexcharts-yaxis-label tspan`,
110
- ),
111
- ).map((label) => label.textContent)
108
+ // a repeat leaves the Set's size unchanged; String() so a formatter
109
+ // returning numbers dedupes like one returning strings
110
+ const seen = drawn.size
111
+ const dup = drawn.add(String(val)).size === seen
112
112
 
113
113
  const label = graphics.drawText({
114
114
  x: xPad,
115
115
  y: lY,
116
116
  text:
117
- existingYLabels.includes(val) &&
118
- !w.config.yaxis[realIndex].labels.showDuplicates
119
- ? ''
120
- : val,
117
+ dup && !w.config.yaxis[realIndex].labels.showDuplicates ? '' : val,
121
118
  textAnchor,
122
119
  fontSize: yaxisFontSize,
123
120
  fontFamily: yaxisFontFamily,
@@ -425,6 +422,8 @@ export default class YAxis {
425
422
  */
426
423
  yAxisTitleRotate(realIndex, yAxisOpposite) {
427
424
  const w = this.w
425
+ // no title to place: skip the labels measure (a forced layout)
426
+ if (w.config.yaxis[realIndex].title.text === undefined) return
428
427
  const graphics = new Graphics(this.w)
429
428
  const elYAxisLabelsWrap = w.dom.baseEl.querySelector(
430
429
  `.apexcharts-yaxis[rel='${realIndex}'] .apexcharts-yaxis-texts-g`,
@@ -10,6 +10,7 @@ import {
10
10
  BREADCRUMB_HEIGHT_FULL,
11
11
  breadcrumbConfig,
12
12
  } from '../../charts/common/Breadcrumb'
13
+ import { getChartClass } from '../ChartFactory'
13
14
 
14
15
  /**
15
16
  * ApexCharts Dimensions Class for calculating rects of all elements that are drawn and will be drawn.
@@ -207,7 +208,7 @@ export default class Dimensions {
207
208
  * to float without covering a tile. Giving it real space is the only way it
208
209
  * never overlaps.
209
210
  *
210
- * Reserved whenever click-to-zoom is enabled, not only while zoomed in: the
211
+ * Reserved whenever click-to-zoom is live, not only while zoomed in: the
211
212
  * strip appears and disappears as the reader navigates, and sizing the plot
212
213
  * around its presence would reflow every tile on each zoom.
213
214
  */
@@ -216,8 +217,13 @@ export default class Dimensions {
216
217
  const isTreemap = w.config.chart.type === 'treemap'
217
218
 
218
219
  if (isTreemap) {
219
- const zoom = w.config.plotOptions?.treemap?.zoom
220
- if (zoom && zoom.enabled) {
220
+ // The renderer's own answer: zoom needs parents to click and stands
221
+ // down for drilldown, so a flat treemap reserves nothing.
222
+ const zoom = getChartClass('treemap').prototype.zoomLive?.(
223
+ w,
224
+ this.ctx.drilldown,
225
+ )
226
+ if (zoom) {
221
227
  if (breadcrumbConfig(w, zoom.breadcrumb).show === false) return
222
228
  this.gridPad.top += BREADCRUMB_HEIGHT + 4
223
229
  return
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
  import AxesUtils from '../axes/AxesUtils'
3
+ import { BAR_PATHWAY_TYPES } from '../settings/TypeAliases'
3
4
  import Graphics from '../Graphics'
4
5
  import Utils from '../../utils/Utils'
5
6
 
@@ -30,8 +31,7 @@ export default class DimGrid {
30
31
  /**
31
32
  * @param {string} type
32
33
  */
33
- const hasBar = (type) =>
34
- ['bar', 'rangeBar', 'candlestick', 'boxPlot', 'violin'].includes(type)
34
+ const hasBar = (type) => BAR_PATHWAY_TYPES.includes(type)
35
35
 
36
36
  const type = cnf.chart.type
37
37
  let barWidth = 0
@@ -3,6 +3,7 @@ import Formatters from '../Formatters'
3
3
  import Graphics from '../Graphics'
4
4
  import Utils from '../../utils/Utils'
5
5
  import DateTime from '../../utils/DateTime'
6
+ import { BAR_PATHWAY_TYPES } from '../settings/TypeAliases'
6
7
 
7
8
  export default class DimXAxis {
8
9
  /**
@@ -371,11 +372,7 @@ export default class DimXAxis {
371
372
  if (
372
373
  firstLabelPosition <
373
374
  -((!yaxe.show || yaxe.floating) &&
374
- (cnf.chart.type === 'bar' ||
375
- cnf.chart.type === 'candlestick' ||
376
- cnf.chart.type === 'rangeBar' ||
377
- cnf.chart.type === 'boxPlot' ||
378
- cnf.chart.type === 'violin')
375
+ BAR_PATHWAY_TYPES.includes(cnf.chart.type)
379
376
  ? lbWidth / 1.75
380
377
  : 10)
381
378
  ) {
@@ -39,8 +39,11 @@ export default class Breadcrumb {
39
39
  const elWrap = w.dom.elWrap
40
40
  if (!elWrap) return
41
41
 
42
- // Remove any stale breadcrumb first (guards against double-render).
43
- const existing = elWrap.querySelector('.apexcharts-breadcrumb')
42
+ // Remove any stale breadcrumb first (guards against double-render), but
43
+ // only its own: a zoomed treemap's shares the class.
44
+ const existing = elWrap.querySelector(
45
+ '.apexcharts-breadcrumb[aria-label^=Drill]',
46
+ )
44
47
  if (existing && existing.parentNode) {
45
48
  existing.parentNode.removeChild(existing)
46
49
  }
@@ -64,7 +64,7 @@ export default class Destroy {
64
64
  // alone leaks the listener + the dead instance on every updateOptions().
65
65
  // zoomPanSelection/toolbar were destroyed above; the full-destroy path
66
66
  // destroys keyboardNavigation via apexcharts.js before calling clear().
67
- this.ctx._keyboardNavigation?.destroy()
67
+ this.ctx._keyboardNavigation?.destroy(true)
68
68
  this.ctx._keyboardNavigation = null
69
69
  } else {
70
70
  // Full destroy — null everything so GC can collect the instances.
@@ -139,10 +139,9 @@ export default class UpdateHelpers {
139
139
  w.globals.resized = true
140
140
  w.globals.dataChanged = true
141
141
 
142
- // see _updateSeries: previous paths only feed update morphs
143
- if (animate && w.config.chart.animations.enabled) {
144
- ch.series.getPreviousPaths()
145
- }
142
+ // A `chart` section can switch the morph on or change the type,
143
+ // both read after this capture, so it captures as before.
144
+ ch.updateHelpers.capture(animate, options?.chart)
146
145
  } else {
147
146
  // From scratch: render as the chart did when it mounted (or, with
148
147
  // animate=false, simply at rest). Both flags outlive the update
@@ -357,6 +356,30 @@ export default class UpdateHelpers {
357
356
  })
358
357
  }
359
358
 
359
+ /**
360
+ * Capture what is on screen for an update to morph from. Previous paths
361
+ * (and the stream, axis chrome and label frames taken with them) only feed
362
+ * data-change MORPHS, which need dynamicAnimation; the capture is O(n). An
363
+ * update that does not capture drops the last one instead: a frame left in
364
+ * place reads as this update's (a canvas line kept building path strings
365
+ * for it on every later pan).
366
+ *
367
+ * @param {boolean} animate
368
+ * @param {any} [chart] the payload's `chart` section, if any
369
+ */
370
+ capture(animate, chart) {
371
+ const w = this.w
372
+ const gl = w.globals
373
+ const a = w.config.chart.animations
374
+ if (animate && a.enabled && (a.dynamicAnimation.enabled || chart)) {
375
+ this.ctx.series.getPreviousPaths()
376
+ } else {
377
+ gl.previousPaths = []
378
+ gl.prevStreamFrame = null
379
+ gl.streamScrolled = false
380
+ }
381
+ }
382
+
360
383
  /**
361
384
  * Private method to update Series.
362
385
  *
@@ -383,12 +406,7 @@ export default class UpdateHelpers {
383
406
 
384
407
  PerformanceCache.invalidateSelectors(w)
385
408
 
386
- // Previous paths (and the stream-frame / axis-chrome snapshots captured
387
- // with them) only feed update MORPHS. When animations are globally off
388
- // nothing consumes them, and the capture is O(n) per update.
389
- if (animate && w.config.chart.animations.enabled) {
390
- this.ctx.series.getPreviousPaths()
391
- }
409
+ this.capture(animate)
392
410
 
393
411
  // The category names on screen. The fast path keeps the axis DOM and the
394
412
  // layout, and the axis-scale signature above only knows the value scale,
@@ -581,13 +599,13 @@ export default class UpdateHelpers {
581
599
  /**
582
600
  * @param {any} s
583
601
  * @param {number} i
602
+ * @param {any} ser the baseline row a partial `s` inherits from. No
603
+ * fallback to the live config row: a row past the end of the baseline
604
+ * is new and inherits nothing.
584
605
  */
585
- _extendSeries(s, i) {
586
- const w = this.w
587
- const ser = w.config.series[i]
588
-
606
+ _extendSeries(s, i, ser) {
589
607
  return {
590
- .../** @type {Record<string,any>} */ (w.config.series[i]),
608
+ .../** @type {Record<string,any>} */ (ser),
591
609
  name: s.name ? s.name : /** @type {any} */ (ser)?.name,
592
610
  color: s.color ? s.color : /** @type {any} */ (ser)?.color,
593
611
  type: s.type ? s.type : /** @type {any} */ (ser)?.type,
@@ -31,7 +31,6 @@ import Utils from '../../utils/Utils'
31
31
  import { prefersReducedMotion } from '../Animations'
32
32
  import DataLabels from '../DataLabels'
33
33
  import {
34
- datumKey,
35
34
  morphEasing,
36
35
  reconcileSeriesPaths,
37
36
  seriesJoin,
@@ -739,8 +738,10 @@ export default class HighlightFilter {
739
738
  // A chart that is not highlighting and was not a frame ago: one check.
740
739
  if (!active && !prevMap?.size) return undefined
741
740
  const { j, realIndex } = o
742
- // datumKey names the category, which every series shares at that x.
743
- const key = BAR + `${realIndex}::${datumKey(w, realIndex, j)}`
741
+ // The bar's own key: the category, which every series shares at that x,
742
+ // made unique per occurrence so a repeated category keeps its own part
743
+ // (and matches the exit ghost's name).
744
+ const key = BAR + `${realIndex}::${bar._keys(realIndex)[j]}`
744
745
  this._seen.add(key)
745
746
  const prev = prevMap?.get(key)
746
747
  const p = active ? hd.parts[realIndex]?.[j] : null
@@ -1114,8 +1115,8 @@ export default class HighlightFilter {
1114
1115
 
1115
1116
  /**
1116
1117
  * The stack a stacked bar datum joins, as the renderer resolves it
1117
- * (BarStacked drawStackedColumnPaths): its series group, then its x value
1118
- * on a numeric or datetime column axis, else its index.
1118
+ * (BarStacked): its series group, then its x value on a numeric or
1119
+ * datetime axis, else its index.
1119
1120
  * @param {number} i @param {number} j
1120
1121
  */
1121
1122
  _barKey(i, j) {
@@ -1123,9 +1124,7 @@ export default class HighlightFilter {
1123
1124
  return (
1124
1125
  w.labelData.seriesGroupIndex[i] +
1125
1126
  '|' +
1126
- (!w.config.plotOptions.bar.horizontal && w.axisFlags.isXNumeric
1127
- ? w.seriesData.seriesX[i]?.[j]
1128
- : j)
1127
+ (w.axisFlags.isXNumeric ? w.seriesData.seriesX[i]?.[j] : j)
1129
1128
  )
1130
1129
  }
1131
1130
 
@@ -1233,7 +1232,7 @@ export default class HighlightFilter {
1233
1232
  ? this._lineBase(ln, type, series, i, realIndex, ti, has ? raw : null)
1234
1233
  : null
1235
1234
  if (pp && w.config.chart.stacked) {
1236
- this._swap(ln, () => ln._recordStackTops(realIndex, pp.yArrj))
1235
+ this._swap(ln, () => ln._recordStackTops(realIndex, pp.yArrj, pp.S[i]))
1237
1236
  this._stkPrev.push(pp.yArrj)
1238
1237
  }
1239
1238
  if (exit) {
@@ -414,10 +414,10 @@ function wrapParentTip(hf, tm) {
414
414
  }
415
415
  const v = tm._tip()?.querySelector('.apexcharts-tooltip-text-y-value')
416
416
  if (!v) return
417
- let rest = `/ ${tm._formatValue(h.total)}`
417
+ let rest = `/ ${tm._formatValue(h.total, node._si)}`
418
418
  if (tt.share && h.total) rest += ` · ${Math.round(h.share * 100)}%`
419
419
  v.innerHTML =
420
- `${tm._formatValue(h.value)} ` +
420
+ `${tm._formatValue(h.value, node._si)} ` +
421
421
  `<span class="apexcharts-highlight-total" style="font-weight: 400; opacity: 0.6">${rest}</span>`
422
422
  }
423
423
  }