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.
- package/README.md +7 -7
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +19793 -19713
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +38 -8
- package/dist/apexcharts.esm.js +1882 -1625
- package/dist/apexcharts.full.js +22044 -21634
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +21414 -21124
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +21413 -21123
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +91 -40
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +478 -406
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +409 -334
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +91 -40
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +409 -334
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +478 -406
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +19793 -19713
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +3 -9
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +478 -406
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +442 -324
- package/dist/features/annotations.common.js +2 -2
- package/dist/features/annotations.esm.js +65 -48
- package/dist/features/annotations.js +2 -2
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +2 -2
- package/dist/features/drilldown.esm.js +4 -2
- package/dist/features/drilldown.js +2 -2
- package/dist/features/dumbbell.common.js +1 -1
- package/dist/features/dumbbell.esm.js +1 -1
- package/dist/features/dumbbell.js +1 -1
- package/dist/features/exports.common.js +2 -2
- package/dist/features/exports.esm.js +10 -4
- package/dist/features/exports.js +2 -2
- package/dist/features/facet.common.js +1 -1
- package/dist/features/facet.esm.js +1 -1
- package/dist/features/facet.js +1 -1
- package/dist/features/highlight-filter.common.js +2 -2
- package/dist/features/highlight-filter.esm.js +14 -9
- package/dist/features/highlight-filter.js +2 -2
- package/dist/features/history.common.js +1 -1
- package/dist/features/history.esm.js +1 -1
- package/dist/features/history.js +1 -1
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +2 -2
- package/dist/features/keyboard.esm.js +97 -145
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +64 -44
- package/dist/features/legend.js +2 -2
- package/dist/features/link.common.js +1 -1
- package/dist/features/link.esm.js +1 -1
- package/dist/features/link.js +1 -1
- package/dist/features/marks.common.js +1 -1
- package/dist/features/marks.esm.js +1 -1
- package/dist/features/marks.js +1 -1
- package/dist/features/measure.common.js +1 -1
- package/dist/features/measure.esm.js +1 -1
- package/dist/features/measure.js +1 -1
- package/dist/features/morph.common.js +2 -2
- package/dist/features/morph.esm.js +9 -5
- package/dist/features/morph.js +2 -2
- package/dist/features/perspectives.common.js +2 -2
- package/dist/features/perspectives.esm.js +4 -1
- package/dist/features/perspectives.js +2 -2
- package/dist/features/raincloud.common.js +2 -2
- package/dist/features/raincloud.esm.js +26 -27
- package/dist/features/raincloud.js +2 -2
- package/dist/features/renderer-canvas.common.js +2 -2
- package/dist/features/renderer-canvas.esm.js +2 -1
- package/dist/features/renderer-canvas.js +2 -2
- package/dist/features/stats.common.js +2 -2
- package/dist/features/stats.esm.js +52 -59
- package/dist/features/stats.js +2 -2
- package/dist/features/storyboard.common.js +2 -2
- package/dist/features/storyboard.esm.js +4 -1
- package/dist/features/storyboard.js +2 -2
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +48 -14
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +148 -18
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +150 -63
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +1 -1
- package/dist/features/waterfall.esm.js +1 -1
- package/dist/features/waterfall.js +1 -1
- package/dist/features/weave.common.js +2 -2
- package/dist/features/weave.esm.js +13 -12
- package/dist/features/weave.js +2 -2
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +1068 -842
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +3 -17
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +529 -464
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +80 -46
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +91 -40
- package/dist/line.js +2 -2
- package/dist/locales/en.json +2 -1
- package/dist/locales/ro.json +3 -2
- package/dist/pictograms.common.js +1 -1
- package/dist/pictograms.esm.js +1 -1
- package/dist/pictograms.js +1 -1
- package/dist/pie.common.js +2 -2
- package/dist/pie.esm.js +3 -9
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +3 -9
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +5 -4
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +2 -2
- package/dist/radialBar.esm.js +5 -12
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +97 -52
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +91 -40
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +478 -406
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +91 -40
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +138 -53
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +116 -94
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +138 -104
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +1 -1
- package/dist/unit-shapes.esm.js +1 -1
- package/dist/unit-shapes.js +1 -1
- package/dist/unit.common.js +2 -2
- package/dist/unit.esm.js +280 -202
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +72 -26
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +477 -405
- package/package.json +1 -1
- package/src/apexcharts.js +40 -59
- package/src/assets/apexcharts.css +38 -8
- package/src/charts/Bar.js +62 -55
- package/src/charts/BarStacked.js +80 -88
- package/src/charts/BoxCandleStick.js +28 -31
- package/src/charts/Icicle.js +68 -47
- package/src/charts/Line.js +118 -42
- package/src/charts/Pie.js +2 -8
- package/src/charts/Radar.js +5 -7
- package/src/charts/Radial.js +2 -6
- package/src/charts/RangeBar.js +47 -43
- package/src/charts/Sunburst.js +101 -98
- package/src/charts/Treemap.js +150 -88
- package/src/charts/Unit.js +368 -250
- package/src/charts/Violin.js +48 -30
- package/src/charts/common/Breadcrumb.js +2 -2
- package/src/charts/common/Hierarchy.js +32 -11
- package/src/charts/common/Jitter.js +32 -7
- package/src/charts/common/Stats.js +30 -23
- package/src/charts/common/bar/DataLabels.js +76 -81
- package/src/charts/common/bar/Helpers.js +43 -7
- package/src/charts/common/line/Helpers.js +12 -15
- package/src/charts/common/partition/NodeTooltip.js +29 -7
- package/src/charts/common/partition/Partition.js +33 -1
- package/src/charts/common/treemap/Helpers.js +3 -11
- package/src/charts/common/treemap/Nested.js +2 -3
- package/src/features/raincloud.js +16 -10
- package/src/features/stats.js +67 -62
- package/src/locales/en.json +2 -1
- package/src/locales/ro.json +3 -2
- package/src/modules/Animations.js +102 -95
- package/src/modules/AxisMapping.js +47 -12
- package/src/modules/Core.js +4 -0
- package/src/modules/CoreUtils.js +18 -42
- package/src/modules/Data.js +23 -24
- package/src/modules/DataLabels.js +6 -6
- package/src/modules/Exports.js +12 -5
- package/src/modules/Fill.js +17 -8
- package/src/modules/Filters.js +50 -50
- package/src/modules/Graphics.js +69 -51
- package/src/modules/Markers.js +3 -1
- package/src/modules/MorphTypeChange.js +13 -7
- package/src/modules/Range.js +44 -29
- package/src/modules/RendererController.js +17 -3
- package/src/modules/Scales.js +32 -9
- package/src/modules/Series.js +41 -19
- package/src/modules/Theme.js +1 -1
- package/src/modules/Toolbar.js +3 -2
- package/src/modules/UnitMarkRegistry.js +0 -5
- package/src/modules/ZoomPanSelection.js +123 -2
- package/src/modules/accessibility/KeyboardNavigation.js +114 -186
- package/src/modules/animations/Easing.js +2 -1
- package/src/modules/animations/LengthTransition.js +22 -2
- package/src/modules/annotations/Helpers.js +68 -52
- package/src/modules/axes/Grid.js +21 -7
- package/src/modules/axes/YAxis.js +8 -9
- package/src/modules/dimensions/Dimensions.js +9 -3
- package/src/modules/dimensions/Grid.js +2 -2
- package/src/modules/dimensions/XAxis.js +2 -5
- package/src/modules/drilldown/Breadcrumb.js +5 -2
- package/src/modules/helpers/Destroy.js +1 -1
- package/src/modules/helpers/UpdateHelpers.js +33 -15
- package/src/modules/highlightFilter/HighlightFilter.js +8 -9
- package/src/modules/highlightFilter/TreemapPart.js +2 -2
- package/src/modules/legend/HeatmapGradientLegend.js +76 -45
- package/src/modules/legend/Helpers.js +8 -1
- package/src/modules/legend/Legend.js +11 -12
- package/src/modules/license/LicenseEnforcer.js +5 -0
- package/src/modules/settings/Defaults.js +28 -56
- package/src/modules/settings/Globals.js +5 -0
- package/src/modules/settings/Options.js +7 -7
- package/src/modules/settings/TypeAliases.js +33 -16
- package/src/modules/streamgraph/StreamLabels.js +1 -0
- package/src/modules/tooltip/Labels.js +73 -76
- package/src/modules/tooltip/Marker.js +25 -21
- package/src/modules/tooltip/Position.js +88 -51
- package/src/modules/tooltip/Tooltip.js +242 -255
- package/src/modules/tooltip/Utils.js +71 -130
- package/src/modules/tooltip/constants.js +5 -5
- package/src/modules/trellis/Trellis.js +6 -0
- package/src/modules/trellis/TrellisChrome.js +18 -7
- package/src/modules/trellis/TrellisSync.js +2 -0
- package/src/modules/trellis/TrellisTooltip.js +2 -11
- package/src/modules/weave/WeaveHost.js +18 -12
- package/src/renderers/canvas/CanvasGraphics.js +1 -0
- package/src/ssr/DOMShim.js +10 -0
- package/src/svg/SVGFilter.js +26 -17
- package/src/types/internal.d.ts +9 -3
- package/src/utils/Utils.js +0 -14
- 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 =
|
|
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
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
if (anno.id) {
|
|
118
|
+
elRect.node.classList.add(anno.id)
|
|
119
|
+
}
|
|
113
120
|
|
|
114
|
-
|
|
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
|
-
|
|
127
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
/**
|
package/src/modules/axes/Grid.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
220
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
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>} */ (
|
|
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
|
-
//
|
|
743
|
-
|
|
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
|
|
1118
|
-
*
|
|
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
|
-
(
|
|
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
|
}
|