apexcharts 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/LICENSE +30 -11
  2. package/dist/apexcharts.common.js +2 -2
  3. package/dist/apexcharts.core.js +545 -463
  4. package/dist/apexcharts.core.min.js +2 -2
  5. package/dist/apexcharts.esm.js +984 -801
  6. package/dist/apexcharts.js +519 -254
  7. package/dist/apexcharts.min.js +2 -2
  8. package/dist/apexcharts.ssr.common.js +2 -2
  9. package/dist/apexcharts.ssr.esm.js +519 -254
  10. package/dist/area.common.js +1 -1
  11. package/dist/area.esm.js +1 -1
  12. package/dist/bar.common.js +2 -2
  13. package/dist/bar.esm.js +20 -10
  14. package/dist/bar.js +2 -2
  15. package/dist/boxPlot.common.js +2 -2
  16. package/dist/boxPlot.esm.js +20 -10
  17. package/dist/bubble.common.js +1 -1
  18. package/dist/bubble.esm.js +1 -1
  19. package/dist/candlestick.common.js +2 -2
  20. package/dist/candlestick.esm.js +20 -10
  21. package/dist/candlestick.js +2 -2
  22. package/dist/column.common.js +2 -2
  23. package/dist/column.esm.js +20 -10
  24. package/dist/core.common.js +2 -2
  25. package/dist/core.esm.js +545 -463
  26. package/dist/donut.common.js +1 -1
  27. package/dist/donut.esm.js +1 -1
  28. package/dist/dumbbell.common.js +2 -2
  29. package/dist/dumbbell.esm.js +20 -10
  30. package/dist/features/all.common.js +2 -2
  31. package/dist/features/all.esm.js +199 -26
  32. package/dist/features/annotations.common.js +1 -1
  33. package/dist/features/annotations.esm.js +1 -1
  34. package/dist/features/annotations.js +1 -1
  35. package/dist/features/context-menu.common.js +1 -1
  36. package/dist/features/context-menu.esm.js +1 -1
  37. package/dist/features/context-menu.js +1 -1
  38. package/dist/features/drilldown.common.js +1 -1
  39. package/dist/features/drilldown.esm.js +1 -1
  40. package/dist/features/drilldown.js +1 -1
  41. package/dist/features/dumbbell.common.js +1 -1
  42. package/dist/features/dumbbell.esm.js +1 -1
  43. package/dist/features/dumbbell.js +1 -1
  44. package/dist/features/exports.common.js +2 -2
  45. package/dist/features/exports.esm.js +12 -14
  46. package/dist/features/exports.js +2 -2
  47. package/dist/features/facet.common.js +1 -1
  48. package/dist/features/facet.esm.js +1 -1
  49. package/dist/features/facet.js +1 -1
  50. package/dist/features/history.common.js +1 -1
  51. package/dist/features/history.esm.js +1 -1
  52. package/dist/features/history.js +1 -1
  53. package/dist/features/ink.common.js +1 -1
  54. package/dist/features/ink.esm.js +1 -1
  55. package/dist/features/ink.js +1 -1
  56. package/dist/features/keyboard.common.js +2 -2
  57. package/dist/features/keyboard.esm.js +14 -1
  58. package/dist/features/keyboard.js +2 -2
  59. package/dist/features/legend.common.js +1 -1
  60. package/dist/features/legend.esm.js +1 -1
  61. package/dist/features/legend.js +1 -1
  62. package/dist/features/link.common.js +1 -1
  63. package/dist/features/link.esm.js +38 -38
  64. package/dist/features/link.js +1 -1
  65. package/dist/features/marks.common.js +1 -1
  66. package/dist/features/marks.esm.js +1 -1
  67. package/dist/features/marks.js +1 -1
  68. package/dist/features/measure.common.js +1 -1
  69. package/dist/features/measure.esm.js +1 -1
  70. package/dist/features/measure.js +1 -1
  71. package/dist/features/morph.common.js +1 -1
  72. package/dist/features/morph.esm.js +1 -1
  73. package/dist/features/morph.js +1 -1
  74. package/dist/features/perspectives.common.js +1 -1
  75. package/dist/features/perspectives.esm.js +11 -11
  76. package/dist/features/perspectives.js +1 -1
  77. package/dist/features/raincloud.common.js +1 -1
  78. package/dist/features/raincloud.esm.js +1 -1
  79. package/dist/features/raincloud.js +1 -1
  80. package/dist/features/renderer-canvas.common.js +1 -1
  81. package/dist/features/renderer-canvas.esm.js +1 -1
  82. package/dist/features/renderer-canvas.js +1 -1
  83. package/dist/features/stats.common.js +1 -1
  84. package/dist/features/stats.esm.js +1 -1
  85. package/dist/features/stats.js +1 -1
  86. package/dist/features/storyboard.common.js +1 -1
  87. package/dist/features/storyboard.esm.js +11 -11
  88. package/dist/features/storyboard.js +1 -1
  89. package/dist/features/streamgraph.common.js +1 -1
  90. package/dist/features/streamgraph.esm.js +1 -1
  91. package/dist/features/streamgraph.js +1 -1
  92. package/dist/features/toolbar.common.js +2 -2
  93. package/dist/features/toolbar.esm.js +172 -25
  94. package/dist/features/toolbar.js +2 -2
  95. package/dist/features/trellis.common.js +1 -1
  96. package/dist/features/trellis.esm.js +1 -1
  97. package/dist/features/trellis.js +1 -1
  98. package/dist/features/waterfall.common.js +1 -1
  99. package/dist/features/waterfall.esm.js +1 -1
  100. package/dist/features/waterfall.js +1 -1
  101. package/dist/features/weave.common.js +2 -2
  102. package/dist/features/weave.esm.js +15 -2
  103. package/dist/features/weave.js +2 -2
  104. package/dist/heatmap.common.js +1 -1
  105. package/dist/heatmap.esm.js +1 -1
  106. package/dist/heatmap.js +1 -1
  107. package/dist/histogram.common.js +2 -2
  108. package/dist/histogram.esm.js +20 -10
  109. package/dist/line.common.js +1 -1
  110. package/dist/line.esm.js +1 -1
  111. package/dist/line.js +1 -1
  112. package/dist/pictograms.common.js +1 -1
  113. package/dist/pictograms.esm.js +1 -1
  114. package/dist/pictograms.js +1 -1
  115. package/dist/pie.common.js +1 -1
  116. package/dist/pie.esm.js +1 -1
  117. package/dist/pie.js +1 -1
  118. package/dist/polarArea.common.js +1 -1
  119. package/dist/polarArea.esm.js +1 -1
  120. package/dist/radar.common.js +1 -1
  121. package/dist/radar.esm.js +1 -1
  122. package/dist/radar.js +1 -1
  123. package/dist/radialBar.common.js +1 -1
  124. package/dist/radialBar.esm.js +1 -1
  125. package/dist/radialBar.js +1 -1
  126. package/dist/raincloud.common.js +2 -2
  127. package/dist/raincloud.esm.js +20 -10
  128. package/dist/rangeArea.common.js +1 -1
  129. package/dist/rangeArea.esm.js +1 -1
  130. package/dist/rangeBar.common.js +2 -2
  131. package/dist/rangeBar.esm.js +20 -10
  132. package/dist/scatter.common.js +1 -1
  133. package/dist/scatter.esm.js +1 -1
  134. package/dist/streamgraph.common.js +1 -1
  135. package/dist/streamgraph.esm.js +1 -1
  136. package/dist/sunburst.common.js +1 -1
  137. package/dist/sunburst.esm.js +1 -1
  138. package/dist/sunburst.js +1 -1
  139. package/dist/treemap.common.js +1 -1
  140. package/dist/treemap.esm.js +1 -1
  141. package/dist/treemap.js +1 -1
  142. package/dist/unit-shapes.common.js +1 -1
  143. package/dist/unit-shapes.esm.js +1 -1
  144. package/dist/unit-shapes.js +1 -1
  145. package/dist/unit.common.js +1 -1
  146. package/dist/unit.esm.js +79 -79
  147. package/dist/unit.js +1 -1
  148. package/dist/violin.common.js +2 -2
  149. package/dist/violin.esm.js +20 -10
  150. package/dist/violin.js +2 -2
  151. package/dist/waterfall.common.js +2 -2
  152. package/dist/waterfall.esm.js +20 -10
  153. package/package.json +2 -2
  154. package/src/apexcharts.js +39 -15
  155. package/src/charts/common/bar/Helpers.js +31 -12
  156. package/src/modules/Data.js +8 -2
  157. package/src/modules/Exports.js +14 -12
  158. package/src/modules/Formatters.js +24 -1
  159. package/src/modules/Range.js +28 -1
  160. package/src/modules/Toolbar.js +112 -2
  161. package/src/modules/ZoomPanSelection.js +85 -7
  162. package/src/modules/accessibility/KeyboardNavigation.js +14 -0
  163. package/src/modules/axes/YAxis.js +12 -15
  164. package/src/modules/helpers/UpdateHelpers.js +25 -8
  165. package/src/modules/settings/Globals.js +5 -10
  166. package/src/modules/settings/Options.js +15 -0
  167. package/src/modules/weave/PluginAPI.js +21 -1
  168. package/src/ssr/DOMShim.js +50 -0
  169. package/src/types/internal.d.ts +1 -1
  170. package/src/utils/Utils.js +6 -9
  171. package/types/apexcharts.d.ts +17 -0
@@ -25,12 +25,17 @@
25
25
  * tooltip and its `dataPoint*` events; before this a plugin either re-derived
26
26
  * it from raw pixels or did without.
27
27
  *
28
+ * v5 added `api.info.stroke`, the caller's own `stroke.dashArray`. That option
29
+ * is indexed by series position, so a plugin that wants its own derived series
30
+ * dashed must write the whole array; reporting the current value is what lets
31
+ * it put back what it found instead of flattening the caller's dashed lines.
32
+ *
28
33
  * Feature-detect rather than bumping `apiVersion` unless the plugin genuinely
29
34
  * cannot work without the new surface: a plugin declaring v3 is SKIPPED
30
35
  * outright on a v2 host, so `apiVersion: 2` plus `typeof api.reserve ===
31
36
  * 'function'` keeps one build working on both.
32
37
  */
33
- export const WEAVE_API_VERSION = 4
38
+ export const WEAVE_API_VERSION = 5
34
39
 
35
40
  /**
36
41
  * Public chart methods safe to expose to plugins (each bound to ctx). Excludes
@@ -307,6 +312,21 @@ export function buildPluginAPI(host, record) {
307
312
  ? w.config.dataLabels.enabledOnSeries.slice()
308
313
  : null,
309
314
  }),
315
+ // The caller's own dashing, reported for the same reason and against
316
+ // the same trap (v5). `stroke.dashArray` is indexed by series position
317
+ // with no per-series escape hatch, so a plugin that wants ITS OWN
318
+ // computed series dashed has to write the whole array, and writing one
319
+ // without knowing what was there discards the caller's dashed lines
320
+ // with nothing to restore them from.
321
+ //
322
+ // A scalar applies to every series and an array is per series. There is
323
+ // no "unset" to report: the option defaults to 0, and 0 already means
324
+ // no dashing, so restoring it restores exactly what was there.
325
+ stroke: Object.freeze({
326
+ dashArray: Array.isArray(w.config.stroke && w.config.stroke.dashArray)
327
+ ? w.config.stroke.dashArray.slice()
328
+ : (w.config.stroke && w.config.stroke.dashArray) || 0,
329
+ }),
310
330
  })
311
331
  },
312
332
 
@@ -4,6 +4,14 @@
4
4
  * Provides just enough SVG element emulation to create chart structure without full DOM
5
5
  */
6
6
 
7
+ // Approximate sans-serif metrics, in em, used to estimate SVG text bounds when
8
+ // no font engine is available to measure the glyphs.
9
+ const CHAR_WIDTH_EM = 0.55
10
+ const ASCENT_EM = 0.917
11
+ const DESCENT_EM = 0.25
12
+ const LINE_HEIGHT_EM = 1.1
13
+ const DEFAULT_FONT_SIZE = 11
14
+
7
15
  /**
8
16
  * Mock SVG element for SSR environment
9
17
  */
@@ -148,6 +156,48 @@ class SSRElement {
148
156
  }
149
157
  }
150
158
 
159
+ getBBox() {
160
+ if (this.nodeName !== 'text' && this.nodeName !== 'tspan') {
161
+ return { x: 0, y: 0, width: 0, height: 0 }
162
+ }
163
+
164
+ const lines = this._textLines()
165
+ const longest = lines.reduce((acc, line) => Math.max(acc, line.length), 0)
166
+ if (!longest) {
167
+ return { x: 0, y: 0, width: 0, height: 0 }
168
+ }
169
+
170
+ const fontSize =
171
+ parseFloat(this.attributes.get('font-size')) || DEFAULT_FONT_SIZE
172
+ const width = longest * fontSize * CHAR_WIDTH_EM
173
+ const height =
174
+ fontSize * (ASCENT_EM + DESCENT_EM) +
175
+ (lines.length - 1) * fontSize * LINE_HEIGHT_EM
176
+
177
+ const anchor = this.attributes.get('text-anchor')
178
+ const x = parseFloat(this.attributes.get('x')) || 0
179
+ const y = parseFloat(this.attributes.get('y')) || 0
180
+
181
+ return {
182
+ x: anchor === 'middle' ? x - width / 2 : anchor === 'end' ? x - width : x,
183
+ y: y - fontSize * ASCENT_EM,
184
+ width,
185
+ height,
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Text of this element, one entry per rendered line
191
+ * @returns {string[]}
192
+ */
193
+ _textLines() {
194
+ const tspans = this.children.filter((child) => child.nodeName === 'tspan')
195
+ if (tspans.length) {
196
+ return tspans.map((tspan) => String(tspan.textContent ?? ''))
197
+ }
198
+ return [String(this.textContent ?? '')]
199
+ }
200
+
151
201
  getRootNode() {
152
202
  /** @type {SSRElement} */
153
203
  let root = this
@@ -802,7 +802,7 @@ export interface ChartContext {
802
802
  eventList: string[]
803
803
 
804
804
  // Public methods on the ApexCharts instance
805
- update(options?: any): Promise<any>
805
+ update(options?: any, overwriteInitialSeries?: boolean): Promise<any>
806
806
  getSyncedCharts(): any[]
807
807
  getGroupedCharts(): any[]
808
808
  fastUpdate(animate?: boolean, prevAxisScaleSig?: string): Promise<any>
@@ -75,15 +75,12 @@ class Utils {
75
75
  }
76
76
 
77
77
  // A per-series shallow copy: the series OBJECTS are copied, their data arrays
78
- // are shared. Almost every internal "mutation" of a series' data is a
79
- // property REPLACEMENT (`series[i].data = []` on legend collapse,
80
- // `series[i] = 0` for non-axis charts), and those cannot reach a copy made
81
- // this way because the series object was copied at capture time. The
82
- // exception is appendData(), whose push loop grows the shared data array in
83
- // place, so a copy taken before it does see the appended points; see the
84
- // note above defineLazyInitialSeries(). This is the same cheap shape
85
- // `globals.initialSeries` captures, so snapshotting a config stays O(n)
86
- // instead of deep-cloning every point.
78
+ // are shared. Every internal "mutation" of a series' data is a property
79
+ // REPLACEMENT (`series[i].data = []` on legend collapse, `series[i] = 0` for
80
+ // non-axis charts, appendData's concat), and those cannot reach a copy made
81
+ // this way because the series object was copied at capture time. This is the
82
+ // same cheap shape `globals.initialSeries` captures, so snapshotting a config
83
+ // stays O(n) instead of deep-cloning every point.
87
84
  /**
88
85
  * @param {any} series
89
86
  */
@@ -1878,6 +1878,17 @@ type ApexChart = {
1878
1878
  * @default 'auto'
1879
1879
  */
1880
1880
  pinch?: boolean | 'auto'
1881
+ /**
1882
+ * The way back out of a zoom on a chart whose toolbar is hidden. While the
1883
+ * chart is zoomed and nothing else on screen can reset it, one reset
1884
+ * control is drawn where the toolbar would have been, and it goes when the
1885
+ * range does; `Escape` resets the zoom as well. `'auto'` supplies both only
1886
+ * where there is no reset button already, `true` also forces the control on
1887
+ * where `toolbar.tools.reset` is off, and `false` turns both off for a page
1888
+ * that supplies its own reset. Requires `enabled: true`.
1889
+ * @default 'auto'
1890
+ */
1891
+ resetControl?: boolean | 'auto'
1881
1892
  zoomedArea?: {
1882
1893
  fill?: {
1883
1894
  color?: string
@@ -2656,6 +2667,12 @@ type ApexPlotOptions = {
2656
2667
  distributed?: boolean
2657
2668
  borderRadius?: number;
2658
2669
  borderRadiusApplication?: 'around' | 'end';
2670
+ /**
2671
+ * Which segments of a stack round. 'all' (default) caps both ends of the
2672
+ * stack, the baseline and the far end; 'last' caps only the far end so
2673
+ * the stack sits square on the baseline. Stacked bar/column only.
2674
+ */
2675
+ borderRadiusWhenStacked?: 'all' | 'last';
2659
2676
  hideZeroBarsWhenGrouped?: boolean
2660
2677
  rangeBarOverlap?: boolean
2661
2678
  rangeBarGroupRows?: boolean