apexcharts 8.0.1 → 8.2.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.
- package/README.md +14 -8
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +2310 -2274
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.esm.js +1367 -1110
- package/dist/apexcharts.full.js +3880 -3531
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +3676 -3409
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +4114 -3591
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +25 -67
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +159 -163
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +125 -106
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +25 -67
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +125 -106
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +159 -163
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +2310 -2274
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +100 -78
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +192 -167
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +945 -640
- package/dist/features/annotations.common.js +2 -2
- package/dist/features/annotations.esm.js +46 -21
- 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 +22 -2
- package/dist/features/drilldown.js +2 -2
- package/dist/features/dumbbell.common.js +2 -2
- package/dist/features/dumbbell.esm.js +34 -5
- package/dist/features/dumbbell.js +2 -2
- package/dist/features/exports.common.js +2 -2
- package/dist/features/exports.esm.js +203 -204
- 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 +97 -41
- package/dist/features/highlight-filter.js +2 -2
- package/dist/features/history.common.js +2 -2
- package/dist/features/history.esm.js +4 -3
- package/dist/features/history.js +2 -2
- 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 +20 -23
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +61 -41
- package/dist/features/legend.js +2 -2
- package/dist/features/link.common.js +2 -2
- package/dist/features/link.esm.js +8 -8
- package/dist/features/link.js +2 -2
- package/dist/features/marks.common.js +2 -2
- 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 +260 -279
- package/dist/features/morph.js +2 -2
- package/dist/features/perspectives.common.js +2 -2
- package/dist/features/perspectives.esm.js +28 -19
- package/dist/features/perspectives.js +2 -2
- package/dist/features/raincloud.common.js +2 -2
- package/dist/features/raincloud.esm.js +54 -36
- package/dist/features/raincloud.js +2 -2
- package/dist/features/renderer-canvas.common.js +1 -1
- package/dist/features/renderer-canvas.esm.js +1 -1
- package/dist/features/renderer-canvas.js +1 -1
- package/dist/features/stats.common.js +2 -2
- package/dist/features/stats.esm.js +66 -18
- package/dist/features/stats.js +2 -2
- package/dist/features/storyboard.common.js +2 -2
- package/dist/features/storyboard.esm.js +24 -15
- package/dist/features/storyboard.js +2 -2
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +34 -5
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +211 -217
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +31 -19
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +2 -2
- package/dist/features/waterfall.esm.js +34 -5
- package/dist/features/waterfall.js +2 -2
- package/dist/features/weave.common.js +2 -2
- package/dist/features/weave.esm.js +290 -48
- package/dist/features/weave.js +2 -2
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +289 -150
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +48 -17
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +224 -180
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +1 -1
- package/dist/icicle.js +1 -1
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +25 -67
- package/dist/line.js +2 -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 +100 -78
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +100 -78
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +8 -5
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +2 -2
- package/dist/radialBar.esm.js +166 -133
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +55 -42
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +25 -67
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +159 -163
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +25 -67
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +58 -71
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +1 -1
- package/dist/sunburst.js +1 -1
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +28 -90
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +2 -2
- 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 +30 -6
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +2 -7
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +192 -167
- package/package.json +3 -1
- package/src/apexcharts.js +260 -201
- package/src/charts/Bar.js +16 -5
- package/src/charts/BarStacked.js +42 -88
- package/src/charts/BoxCandleStick.js +1 -7
- package/src/charts/HeatMap.js +73 -16
- package/src/charts/Line.js +21 -71
- package/src/charts/Pie.js +142 -89
- package/src/charts/Radar.js +4 -1
- package/src/charts/Radial.js +91 -63
- package/src/charts/RangeBar.js +1 -7
- package/src/charts/Treemap.js +25 -78
- package/src/charts/Unit.js +28 -10
- package/src/charts/Violin.js +1 -7
- package/src/charts/common/Hierarchy.js +0 -22
- package/src/charts/common/OuterLabels.js +12 -5
- package/src/charts/common/Stats.js +55 -28
- package/src/charts/common/bar/DataLabels.js +94 -83
- package/src/charts/common/bar/Helpers.js +34 -57
- package/src/charts/common/circle/Helpers.js +5 -2
- package/src/charts/common/treemap/Helpers.js +1 -1
- package/src/entries/full.js +0 -17
- package/src/features/link.js +9 -10
- package/src/features/perspectives.js +20 -19
- package/src/features/raincloud.js +51 -53
- package/src/features/stats.js +23 -35
- package/src/libs/Treemap-squared.js +7 -47
- package/src/modules/Animations.js +55 -73
- package/src/modules/Base.js +3 -2
- package/src/modules/ChartFactory.js +6 -1
- package/src/modules/Core.js +57 -30
- package/src/modules/CoreUtils.js +32 -33
- package/src/modules/Crosshairs.js +29 -11
- package/src/modules/Data.js +279 -153
- package/src/modules/DataLabels.js +18 -2
- package/src/modules/Events.js +1 -4
- package/src/modules/Exports.js +284 -305
- package/src/modules/Fill.js +23 -10
- package/src/modules/Formatters.js +14 -3
- package/src/modules/Graphics.js +8 -14
- package/src/modules/MorphPieces.js +4 -2
- package/src/modules/MorphTypeChange.js +332 -316
- package/src/modules/Range.js +56 -99
- package/src/modules/Responsive.js +186 -61
- package/src/modules/Scales.js +4 -47
- package/src/modules/Series.js +14 -45
- package/src/modules/Theme.js +108 -57
- package/src/modules/Toolbar.js +7 -13
- package/src/modules/accessibility/KeyboardNavigation.js +29 -28
- package/src/modules/animations/AxisTransition.js +54 -16
- package/src/modules/animations/CircleTransition.js +1 -4
- package/src/modules/animations/DataLabelTransition.js +15 -10
- package/src/modules/animations/StreamScroll.js +6 -4
- package/src/modules/annotations/Annotations.js +18 -17
- package/src/modules/annotations/Helpers.js +41 -17
- package/src/modules/axes/XAxis.js +4 -4
- package/src/modules/axes/YAxis.js +1 -6
- package/src/modules/dimensions/Dimensions.js +12 -7
- package/src/modules/dimensions/Grid.js +15 -3
- package/src/modules/dimensions/YAxis.js +7 -6
- package/src/modules/drilldown/Drilldown.js +22 -1
- package/src/modules/dumbbell/DumbbellData.js +3 -5
- package/src/modules/helpers/Destroy.js +10 -1
- package/src/modules/helpers/InitCtxVariables.js +19 -16
- package/src/modules/helpers/RawStash.js +51 -0
- package/src/modules/helpers/UpdateHelpers.js +95 -30
- package/src/modules/highlightFilter/HighlightFilter.js +107 -52
- package/src/modules/highlightFilter/PiePart.js +1 -1
- package/src/modules/highlightFilter/RadialPart.js +1 -1
- package/src/modules/history/History.js +7 -2
- package/src/modules/legend/Legend.js +100 -62
- package/src/modules/license/LicenseEnforcer.js +6 -1
- package/src/modules/settings/Config.js +60 -153
- package/src/modules/settings/Defaults.js +352 -58
- package/src/modules/settings/Globals.js +23 -5
- package/src/modules/settings/Options.js +19 -5
- package/src/modules/settings/TypeAliases.js +3 -6
- package/src/modules/streamgraph/StreamData.js +3 -5
- package/src/modules/tooltip/AxesTooltip.js +33 -41
- package/src/modules/tooltip/Intersect.js +50 -43
- package/src/modules/tooltip/Labels.js +62 -23
- package/src/modules/tooltip/Marker.js +6 -7
- package/src/modules/tooltip/Position.js +31 -35
- package/src/modules/tooltip/Tooltip.js +107 -119
- package/src/modules/tooltip/Utils.js +94 -159
- package/src/modules/trellis/TrellisExports.js +21 -9
- package/src/modules/trellis/TrellisTooltip.js +18 -8
- package/src/modules/waterfall/WaterfallData.js +3 -5
- package/src/modules/weave/Claims.js +14 -3
- package/src/modules/weave/Highlights.js +209 -0
- package/src/modules/weave/PluginAPI.js +64 -3
- package/src/modules/weave/WeaveHost.js +215 -51
- package/src/ssr/BrowserAPIs.js +5 -3
- package/src/ssr/DOMShim.js +6 -30
- package/src/ssr/Hydration.js +5 -36
- package/src/ssr/RenderShim.js +333 -0
- package/src/ssr/SSRRenderer.js +81 -36
- package/src/svg/SVGAnimation.js +10 -7
- package/src/types/internal.d.ts +37 -7
- package/src/utils/Constants.js +7 -8
- package/src/utils/DateTime.js +21 -195
- package/src/utils/MissingFeature.js +7 -9
- package/src/utils/Resize.js +4 -0
- package/src/utils/Utils.js +102 -171
- package/types/apexcharts.d.ts +57 -7
|
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
/*!
|
|
18
|
-
* ApexCharts v8.0
|
|
18
|
+
* ApexCharts v8.2.0
|
|
19
19
|
* (c) 2018-2026 ApexCharts
|
|
20
20
|
*/
|
|
21
21
|
import * as _core from "apexcharts/core";
|
|
@@ -205,7 +205,7 @@ function makeColorLerp(from, to) {
|
|
|
205
205
|
function easeInOutCubic(t) {
|
|
206
206
|
return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
207
207
|
}
|
|
208
|
-
function runPieceTween({ pieces, duration, onPieceDone, onAllDone }) {
|
|
208
|
+
function runPieceTween({ pieces, duration, onPieceDone, onAllDone, alive }) {
|
|
209
209
|
let cancelled = false;
|
|
210
210
|
const start = Date.now();
|
|
211
211
|
const dur = Math.max(1, duration);
|
|
@@ -222,7 +222,7 @@ function runPieceTween({ pieces, duration, onPieceDone, onAllDone }) {
|
|
|
222
222
|
else if (e >= 1 && p.fillEnd) el.setAttribute("fill", p.fillEnd);
|
|
223
223
|
};
|
|
224
224
|
const frame = () => {
|
|
225
|
-
if (cancelled) return;
|
|
225
|
+
if (cancelled || alive && !alive()) return;
|
|
226
226
|
const elapsed = Date.now() - start;
|
|
227
227
|
let live = false;
|
|
228
228
|
for (let k = 0; k < pieces.length; k++) {
|
|
@@ -255,8 +255,13 @@ const UNIT_FAMILY = /* @__PURE__ */ new Set(["unit", "waffle"]);
|
|
|
255
255
|
const PARTITION_FAMILY = /* @__PURE__ */ new Set(["treemap", "sunburst"]);
|
|
256
256
|
const SUMMARY_FAMILY = /* @__PURE__ */ new Set(["boxPlot", "violin"]);
|
|
257
257
|
const GHOST_FADE_FRACTION = 0.55;
|
|
258
|
+
let ghostSeq = 0;
|
|
258
259
|
const PIECE_BUDGET = 1500;
|
|
259
260
|
const PIECE_STAGGER_MAX = 300;
|
|
261
|
+
const reveal = (el) => {
|
|
262
|
+
el.removeAttribute("opacity");
|
|
263
|
+
el.removeAttribute("data-piece-hidden");
|
|
264
|
+
};
|
|
260
265
|
function familyOf(type) {
|
|
261
266
|
if (BAR_FAMILY.has(type)) return "bar";
|
|
262
267
|
if (RADIAL_FAMILY.has(type)) return "radial";
|
|
@@ -278,6 +283,7 @@ class MorphTypeChange {
|
|
|
278
283
|
this._ghost = null;
|
|
279
284
|
this._pieceLayer = null;
|
|
280
285
|
this._pieceCancel = null;
|
|
286
|
+
this._ghostTimer = void 0;
|
|
281
287
|
}
|
|
282
288
|
/**
|
|
283
289
|
* @param {string} fromType
|
|
@@ -384,7 +390,9 @@ class MorphTypeChange {
|
|
|
384
390
|
if (tf === "unit" && pieceFamilies) {
|
|
385
391
|
const total = this._countUnitSeries(newSeries);
|
|
386
392
|
this._snapshot.pieceOut = total > 0 && total <= PIECE_BUDGET;
|
|
387
|
-
} else if (ff === "unit" && (tf === "bar" || tf === "summary" ||
|
|
393
|
+
} else if (ff === "unit" && (tf === "bar" || tf === "summary" || // Only slices can be tiled: a radialBar ring is a stroked arc the
|
|
394
|
+
// target collector does not read, so it keeps the ghost fade.
|
|
395
|
+
tf === "radial" && canShape && !/^(radialBar|gauge)$/.test(toType))) {
|
|
388
396
|
let total = 0;
|
|
389
397
|
unitDots.forEach((list) => {
|
|
390
398
|
total += list.length;
|
|
@@ -392,24 +400,7 @@ class MorphTypeChange {
|
|
|
392
400
|
if (total > 0 && total <= PIECE_BUDGET) {
|
|
393
401
|
this._snapshot.pieceIn = true;
|
|
394
402
|
this._snapshot.sourceDots = unitDots;
|
|
395
|
-
|
|
396
|
-
if (tf === "radial") {
|
|
397
|
-
(Array.isArray(newSeries) ? newSeries : []).forEach(
|
|
398
|
-
(_v, i) => {
|
|
399
|
-
keyOrder.push(`${i}:0`);
|
|
400
|
-
}
|
|
401
|
-
);
|
|
402
|
-
} else {
|
|
403
|
-
(Array.isArray(newSeries) ? newSeries : []).forEach(
|
|
404
|
-
(s, seriesIdx) => {
|
|
405
|
-
const data = s && Array.isArray(s.data) ? s.data : [];
|
|
406
|
-
for (let j = 0; j < data.length; j++) {
|
|
407
|
-
keyOrder.push(`${seriesIdx}:${j}`);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
this._snapshot.keyOrder = keyOrder;
|
|
403
|
+
this._snapshot.keyOrder = this._targetKeys(tf, newSeries);
|
|
413
404
|
}
|
|
414
405
|
}
|
|
415
406
|
if (this._needsGhost(fromType, toType) && !this._snapshot.pieceOut && !this._snapshot.pieceIn) {
|
|
@@ -463,9 +454,8 @@ class MorphTypeChange {
|
|
|
463
454
|
const drop = [
|
|
464
455
|
".apexcharts-xaxis",
|
|
465
456
|
".apexcharts-yaxis",
|
|
457
|
+
// (the gridlines go with it)
|
|
466
458
|
".apexcharts-grid",
|
|
467
|
-
".apexcharts-gridlines-horizontal",
|
|
468
|
-
".apexcharts-gridlines-vertical",
|
|
469
459
|
".apexcharts-legend",
|
|
470
460
|
".apexcharts-title-text",
|
|
471
461
|
".apexcharts-subtitle-text",
|
|
@@ -478,13 +468,25 @@ class MorphTypeChange {
|
|
|
478
468
|
if (typeof clone.querySelectorAll === "function") {
|
|
479
469
|
drop.forEach((sel) => {
|
|
480
470
|
clone.querySelectorAll(sel).forEach((el) => {
|
|
481
|
-
|
|
471
|
+
el.remove();
|
|
482
472
|
});
|
|
483
473
|
});
|
|
484
474
|
}
|
|
485
475
|
if (typeof clone.querySelectorAll === "function") {
|
|
476
|
+
const tag = `-ghost${++ghostSeq}`;
|
|
477
|
+
const ids = /* @__PURE__ */ new Set();
|
|
486
478
|
clone.querySelectorAll("[id]").forEach((el) => {
|
|
487
|
-
el.
|
|
479
|
+
ids.add(el.id);
|
|
480
|
+
el.id += tag;
|
|
481
|
+
});
|
|
482
|
+
clone.querySelectorAll("*").forEach((el) => {
|
|
483
|
+
for (const a of el.attributes) {
|
|
484
|
+
const v = a.value.replace(
|
|
485
|
+
/(url\(['"]?#|^#)([^'")\s]+)/g,
|
|
486
|
+
(m, pre, id) => ids.has(id) ? pre + id + tag : m
|
|
487
|
+
);
|
|
488
|
+
if (v !== a.value) a.value = v;
|
|
489
|
+
}
|
|
488
490
|
});
|
|
489
491
|
}
|
|
490
492
|
(_b = clone.removeAttribute) == null ? void 0 : _b.call(clone, "id");
|
|
@@ -534,13 +536,14 @@ class MorphTypeChange {
|
|
|
534
536
|
style.transition = `opacity ${fade}ms ease-in`;
|
|
535
537
|
style.opacity = "0";
|
|
536
538
|
});
|
|
537
|
-
setTimeout(() => this._removeGhost(), fade + 60);
|
|
539
|
+
this._ghostTimer = setTimeout(() => this._removeGhost(), fade + 60);
|
|
538
540
|
}
|
|
539
541
|
/** Detach the ghost if one is mounted. Safe to call at any time. */
|
|
540
542
|
_removeGhost() {
|
|
543
|
+
clearTimeout(this._ghostTimer);
|
|
541
544
|
const ghost = this._ghost;
|
|
542
545
|
this._ghost = null;
|
|
543
|
-
|
|
546
|
+
ghost == null ? void 0 : ghost.remove();
|
|
544
547
|
}
|
|
545
548
|
/* ------------------------------------------------------------------ *
|
|
546
549
|
* The piece layer (see MorphPieces for the geometry).
|
|
@@ -620,12 +623,7 @@ class MorphTypeChange {
|
|
|
620
623
|
var _a;
|
|
621
624
|
const baseEl = (_a = this.w.globals.dom) == null ? void 0 : _a.baseEl;
|
|
622
625
|
if (!baseEl || typeof baseEl.querySelectorAll !== "function") return;
|
|
623
|
-
baseEl.querySelectorAll("[data-piece-hidden]").forEach(
|
|
624
|
-
(el) => {
|
|
625
|
-
el.removeAttribute("opacity");
|
|
626
|
-
el.removeAttribute("data-piece-hidden");
|
|
627
|
-
}
|
|
628
|
-
);
|
|
626
|
+
baseEl.querySelectorAll("[data-piece-hidden]").forEach(reveal);
|
|
629
627
|
}
|
|
630
628
|
/** Stop the piece run, drop the overlay, and reveal anything still hidden. */
|
|
631
629
|
_cancelPieces() {
|
|
@@ -635,7 +633,7 @@ class MorphTypeChange {
|
|
|
635
633
|
}
|
|
636
634
|
const layer = this._pieceLayer;
|
|
637
635
|
this._pieceLayer = null;
|
|
638
|
-
|
|
636
|
+
layer == null ? void 0 : layer.remove();
|
|
639
637
|
this._revealPieceHidden();
|
|
640
638
|
}
|
|
641
639
|
/**
|
|
@@ -761,7 +759,7 @@ class MorphTypeChange {
|
|
|
761
759
|
return {
|
|
762
760
|
intervalsAt,
|
|
763
761
|
dispose: () => {
|
|
764
|
-
|
|
762
|
+
probe.remove();
|
|
765
763
|
}
|
|
766
764
|
};
|
|
767
765
|
}
|
|
@@ -777,35 +775,10 @@ class MorphTypeChange {
|
|
|
777
775
|
const snap = this._snapshot;
|
|
778
776
|
const baseEl = (_a = this.w.globals.dom) == null ? void 0 : _a.baseEl;
|
|
779
777
|
if (!snap || !baseEl) return this._revealPieceHidden();
|
|
780
|
-
const byCluster = /* @__PURE__ */ new Map();
|
|
778
|
+
const byCluster = this._readUnitDots(baseEl, /* @__PURE__ */ new Map());
|
|
781
779
|
let total = 0;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
const i = parseInt((_a2 = dot.getAttribute("i")) != null ? _a2 : "", 10);
|
|
785
|
-
if (isNaN(i)) return;
|
|
786
|
-
const cxAttr = dot.getAttribute("cx");
|
|
787
|
-
let x;
|
|
788
|
-
let y;
|
|
789
|
-
let r = 3;
|
|
790
|
-
if (cxAttr != null) {
|
|
791
|
-
x = parseFloat(cxAttr);
|
|
792
|
-
y = parseFloat((_b = dot.getAttribute("cy")) != null ? _b : "");
|
|
793
|
-
r = parseFloat((_c = dot.getAttribute("r")) != null ? _c : "3") || 3;
|
|
794
|
-
} else {
|
|
795
|
-
const wAttr = parseFloat((_d = dot.getAttribute("width")) != null ? _d : "0") || 0;
|
|
796
|
-
const hAttr = parseFloat((_e = dot.getAttribute("height")) != null ? _e : "0") || 0;
|
|
797
|
-
x = parseFloat((_f = dot.getAttribute("x")) != null ? _f : "") + wAttr / 2;
|
|
798
|
-
y = parseFloat((_g = dot.getAttribute("y")) != null ? _g : "") + hAttr / 2;
|
|
799
|
-
r = Math.max(wAttr, hAttr) / 2 || 3;
|
|
800
|
-
}
|
|
801
|
-
if (!isFinite(x) || !isFinite(y)) return;
|
|
802
|
-
let list = byCluster.get(i);
|
|
803
|
-
if (!list) {
|
|
804
|
-
list = [];
|
|
805
|
-
byCluster.set(i, list);
|
|
806
|
-
}
|
|
807
|
-
list.push({ el: dot, x, y, r, fill: dot.getAttribute("fill") });
|
|
808
|
-
total++;
|
|
780
|
+
byCluster.forEach((list) => {
|
|
781
|
+
total += list.length;
|
|
809
782
|
});
|
|
810
783
|
if (total === 0 || total > PIECE_BUDGET) return this._revealPieceHidden();
|
|
811
784
|
const layer = this._makePieceLayer();
|
|
@@ -823,10 +796,7 @@ class MorphTypeChange {
|
|
|
823
796
|
const box = this.getInitialBBoxFor(i);
|
|
824
797
|
const entry = snap.mapping.get(`${i}:0`);
|
|
825
798
|
if (!box || !entry) {
|
|
826
|
-
dots.forEach((d) =>
|
|
827
|
-
d.el.removeAttribute("opacity");
|
|
828
|
-
d.el.removeAttribute("data-piece-hidden");
|
|
829
|
-
});
|
|
799
|
+
dots.forEach((d) => reveal(d.el));
|
|
830
800
|
return;
|
|
831
801
|
}
|
|
832
802
|
const markFill = entry.fill && entry.fill.indexOf("url(") !== 0 ? entry.fill : ((_a2 = this.w.globals.colors) == null ? void 0 : _a2[i]) || dots[0].fill;
|
|
@@ -847,6 +817,7 @@ class MorphTypeChange {
|
|
|
847
817
|
const dot = ordered[k];
|
|
848
818
|
const el = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
849
819
|
el.setAttribute("data-i", String(i));
|
|
820
|
+
el.setAttribute("data-key", dot.el.getAttribute("data-key"));
|
|
850
821
|
el.setAttribute("x", String(cell.x));
|
|
851
822
|
el.setAttribute("y", String(cell.y));
|
|
852
823
|
el.setAttribute("width", String(cell.width));
|
|
@@ -873,11 +844,35 @@ class MorphTypeChange {
|
|
|
873
844
|
});
|
|
874
845
|
if (!pieces.length) return this._cancelPieces();
|
|
875
846
|
this._runPieces(pieces, (piece) => {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
847
|
+
reveal(piece.meta.dotEl);
|
|
848
|
+
piece.el.remove();
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* The unit chart's dots, grouped by cluster index into `into`. Circles
|
|
853
|
+
* carry cx/cy; square and image dots carry their top-left x/y.
|
|
854
|
+
*
|
|
855
|
+
* @param {any} baseEl
|
|
856
|
+
* @param {Map<number, any[]>} into - each dot as {el, x, y, r, fill}
|
|
857
|
+
*/
|
|
858
|
+
_readUnitDots(baseEl, into) {
|
|
859
|
+
baseEl.querySelectorAll(".apexcharts-unit-area").forEach((dot) => {
|
|
860
|
+
var _a;
|
|
861
|
+
const i = parseInt((_a = dot.getAttribute("i")) != null ? _a : "", 10);
|
|
862
|
+
if (isNaN(i)) return;
|
|
863
|
+
const num = (a) => parseFloat(dot.getAttribute(a));
|
|
864
|
+
const cx = dot.getAttribute("cx");
|
|
865
|
+
const w = num("width") || 0;
|
|
866
|
+
const h = num("height") || 0;
|
|
867
|
+
const x = cx != null ? parseFloat(cx) : num("x") + w / 2;
|
|
868
|
+
const y = cx != null ? num("cy") : num("y") + h / 2;
|
|
869
|
+
const r = (cx != null ? num("r") : Math.max(w, h) / 2) || 3;
|
|
870
|
+
if (!isFinite(x) || !isFinite(y)) return;
|
|
871
|
+
let list = into.get(i);
|
|
872
|
+
if (!list) into.set(i, list = []);
|
|
873
|
+
list.push({ el: dot, x, y, r, fill: dot.getAttribute("fill") });
|
|
880
874
|
});
|
|
875
|
+
return into;
|
|
881
876
|
}
|
|
882
877
|
/**
|
|
883
878
|
* objects -> mark. Each captured outgoing dot flies to one cell of the
|
|
@@ -908,36 +903,32 @@ class MorphTypeChange {
|
|
|
908
903
|
/** @type {any[]} */
|
|
909
904
|
snap.sourceDots.get(clusterIdx[k])
|
|
910
905
|
);
|
|
911
|
-
const key = snap.keyOrder[k];
|
|
912
|
-
const target =
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
906
|
+
const key = snap.keyOrder[clusterIdx[k]];
|
|
907
|
+
const target = (
|
|
908
|
+
/** @type {any} */
|
|
909
|
+
key ? targets.get(key) : null
|
|
910
|
+
);
|
|
911
|
+
const d = target && this._markD(target);
|
|
912
|
+
const b = d && this._pathBBox(d);
|
|
913
|
+
if (!b || !dots || !dots.length) {
|
|
914
|
+
if (target) target.els.forEach(reveal);
|
|
920
915
|
continue;
|
|
921
916
|
}
|
|
917
|
+
const bbox = { x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY };
|
|
922
918
|
const markFill = target.fill && target.fill.indexOf("url(") !== 0 ? target.fill : ((_b = this.w.globals.colors) == null ? void 0 : _b[target.realIndex]) || dots[0].fill;
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
const d = target.d || target.els.map(
|
|
926
|
-
(p) => p.getAttribute("pathTo") || p.getAttribute("d")
|
|
927
|
-
).filter(Boolean).join(" ");
|
|
928
|
-
if (d) prober = this._makeExtentProber(d, target.bbox, layer);
|
|
929
|
-
}
|
|
930
|
-
const divided = prober ? gridDivideShape(target.bbox, dots.length, prober.intervalsAt) : gridDivideRect(target.bbox, dots.length);
|
|
919
|
+
const prober = shapedTarget ? this._makeExtentProber(d, bbox, layer) : null;
|
|
920
|
+
const divided = prober ? gridDivideShape(bbox, dots.length, prober.intervalsAt) : gridDivideRect(bbox, dots.length);
|
|
931
921
|
if (prober) prober.dispose();
|
|
932
922
|
const cells = sortByHilbert(divided, (c) => [
|
|
933
923
|
c.x + c.width / 2,
|
|
934
924
|
c.y + c.height / 2
|
|
935
925
|
]);
|
|
936
|
-
const ordered = sortByHilbert(dots, (
|
|
937
|
-
const markState = {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
926
|
+
const ordered = sortByHilbert(dots, (d2) => [d2.x, d2.y]);
|
|
927
|
+
const markState = {
|
|
928
|
+
remaining: ordered.length,
|
|
929
|
+
els: target.els,
|
|
930
|
+
g: layer.appendChild(doc.createElementNS("http://www.w3.org/2000/svg", "g"))
|
|
931
|
+
};
|
|
941
932
|
for (let m = 0; m < ordered.length; m++) {
|
|
942
933
|
const dot = ordered[m];
|
|
943
934
|
const cell = cells[m];
|
|
@@ -951,8 +942,7 @@ class MorphTypeChange {
|
|
|
951
942
|
el.setAttribute("height", String(dot.r * 2));
|
|
952
943
|
el.setAttribute("rx", String(dot.r));
|
|
953
944
|
el.setAttribute("fill", String(dot.fill || markFill));
|
|
954
|
-
|
|
955
|
-
markState.tiles.push(el);
|
|
945
|
+
markState.g.appendChild(el);
|
|
956
946
|
pieces.push({
|
|
957
947
|
el,
|
|
958
948
|
from: { x: fx, y: fy, width: dot.r * 2, height: dot.r * 2, rx: dot.r },
|
|
@@ -969,16 +959,22 @@ class MorphTypeChange {
|
|
|
969
959
|
const state = piece.meta.markState;
|
|
970
960
|
state.remaining--;
|
|
971
961
|
if (state.remaining === 0) {
|
|
972
|
-
state.els.forEach(
|
|
973
|
-
|
|
974
|
-
el.removeAttribute("data-piece-hidden");
|
|
975
|
-
});
|
|
976
|
-
state.tiles.forEach((t) => {
|
|
977
|
-
if (t.parentNode) t.parentNode.removeChild(t);
|
|
978
|
-
});
|
|
962
|
+
state.els.forEach(reveal);
|
|
963
|
+
state.g.remove();
|
|
979
964
|
}
|
|
980
965
|
});
|
|
981
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* A collected target mark's final geometry as one path: the radial `d` it
|
|
969
|
+
* carries, else every path that makes it up, joined.
|
|
970
|
+
* @param {{ d?: string, els: any[] }} target
|
|
971
|
+
* @returns {string}
|
|
972
|
+
*/
|
|
973
|
+
_markD(target) {
|
|
974
|
+
return target.d || target.els.map(
|
|
975
|
+
(p) => p.getAttribute("pathTo") || p.getAttribute("d")
|
|
976
|
+
).filter(Boolean).join(" ");
|
|
977
|
+
}
|
|
982
978
|
/**
|
|
983
979
|
* Stagger and start a piece run. Delays sweep the (already spatially
|
|
984
980
|
* sorted) list front to back, and the last piece still lands within the
|
|
@@ -998,6 +994,8 @@ class MorphTypeChange {
|
|
|
998
994
|
pieces,
|
|
999
995
|
duration: flight,
|
|
1000
996
|
onPieceDone,
|
|
997
|
+
// destroy() mid-flight: stop writing to the detached pieces.
|
|
998
|
+
alive: () => !this.w.globals.isDestroyed,
|
|
1001
999
|
onAllDone: () => {
|
|
1002
1000
|
this._pieceCancel = null;
|
|
1003
1001
|
this._cancelPieces();
|
|
@@ -1006,12 +1004,12 @@ class MorphTypeChange {
|
|
|
1006
1004
|
}
|
|
1007
1005
|
/**
|
|
1008
1006
|
* The incoming chart's marks, read live: every `path[pathTo]` grouped into
|
|
1009
|
-
* one mark per (realIndex, j)
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1007
|
+
* one mark per (realIndex, j); _markD reads its final geometry. Bar marks
|
|
1008
|
+
* are one path each; summary marks (boxPlot, violin) may be several,
|
|
1009
|
+
* walked exactly like the capture branch walks the outgoing ones.
|
|
1012
1010
|
*
|
|
1013
1011
|
* @param {string} toType
|
|
1014
|
-
* @returns {Map<string, { realIndex: number,
|
|
1012
|
+
* @returns {Map<string, { realIndex: number, fill: string|null, els: any[], d?: string }>}
|
|
1015
1013
|
*/
|
|
1016
1014
|
_collectTargetMarks(toType) {
|
|
1017
1015
|
var _a;
|
|
@@ -1022,22 +1020,9 @@ class MorphTypeChange {
|
|
|
1022
1020
|
if (fam === "radial") {
|
|
1023
1021
|
baseEl.querySelectorAll(".apexcharts-pie-series .apexcharts-pie-area").forEach((p, i) => {
|
|
1024
1022
|
const d = p.getAttribute("data:pathFinal") || p.getAttribute("d");
|
|
1025
|
-
if (
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
out.set(`${i}:0`, {
|
|
1029
|
-
realIndex: i,
|
|
1030
|
-
j: 0,
|
|
1031
|
-
d,
|
|
1032
|
-
bbox: {
|
|
1033
|
-
x: box.minX,
|
|
1034
|
-
y: box.minY,
|
|
1035
|
-
width: box.maxX - box.minX,
|
|
1036
|
-
height: box.maxY - box.minY
|
|
1037
|
-
},
|
|
1038
|
-
fill: p.getAttribute("fill"),
|
|
1039
|
-
els: [p]
|
|
1040
|
-
});
|
|
1023
|
+
if (d && d.trim()) {
|
|
1024
|
+
out.set(`${i}:0`, { realIndex: i, d, fill: p.getAttribute("fill"), els: [p] });
|
|
1025
|
+
}
|
|
1041
1026
|
});
|
|
1042
1027
|
return out;
|
|
1043
1028
|
}
|
|
@@ -1052,32 +1037,10 @@ class MorphTypeChange {
|
|
|
1052
1037
|
if (!d || !d.trim()) return;
|
|
1053
1038
|
const jAttr = parseInt((_a3 = p.getAttribute("j")) != null ? _a3 : "", 10);
|
|
1054
1039
|
const j = isNaN(jAttr) ? order++ : jAttr;
|
|
1055
|
-
const box = this._pathBBox(d);
|
|
1056
|
-
if (!box) return;
|
|
1057
1040
|
const key = `${realIndex}:${j}`;
|
|
1058
1041
|
const prev = out.get(key);
|
|
1059
|
-
if (prev)
|
|
1060
|
-
|
|
1061
|
-
prev.bbox = {
|
|
1062
|
-
x: Math.min(prev.bbox.x, box.minX),
|
|
1063
|
-
y: Math.min(prev.bbox.y, box.minY),
|
|
1064
|
-
width: Math.max(prev.bbox.x + prev.bbox.width, box.maxX) - Math.min(prev.bbox.x, box.minX),
|
|
1065
|
-
height: Math.max(prev.bbox.y + prev.bbox.height, box.maxY) - Math.min(prev.bbox.y, box.minY)
|
|
1066
|
-
};
|
|
1067
|
-
} else {
|
|
1068
|
-
out.set(key, {
|
|
1069
|
-
realIndex,
|
|
1070
|
-
j,
|
|
1071
|
-
bbox: {
|
|
1072
|
-
x: box.minX,
|
|
1073
|
-
y: box.minY,
|
|
1074
|
-
width: box.maxX - box.minX,
|
|
1075
|
-
height: box.maxY - box.minY
|
|
1076
|
-
},
|
|
1077
|
-
fill: p.getAttribute("fill"),
|
|
1078
|
-
els: [p]
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1042
|
+
if (prev) prev.els.push(p);
|
|
1043
|
+
else out.set(key, { realIndex, fill: p.getAttribute("fill"), els: [p] });
|
|
1081
1044
|
});
|
|
1082
1045
|
});
|
|
1083
1046
|
return out;
|
|
@@ -1112,7 +1075,7 @@ class MorphTypeChange {
|
|
|
1112
1075
|
"path[pathTo]:not(.apexcharts-highlight-part)"
|
|
1113
1076
|
);
|
|
1114
1077
|
paths.forEach((p, j) => {
|
|
1115
|
-
const d = p.getAttribute("
|
|
1078
|
+
const d = p.getAttribute("d") || p.getAttribute("pathTo");
|
|
1116
1079
|
if (!d) return;
|
|
1117
1080
|
captured.push({
|
|
1118
1081
|
realIndex,
|
|
@@ -1128,7 +1091,7 @@ class MorphTypeChange {
|
|
|
1128
1091
|
var _a2, _b;
|
|
1129
1092
|
const j = parseInt((_a2 = p.getAttribute("j")) != null ? _a2 : "", 10);
|
|
1130
1093
|
if (isNaN(j)) return;
|
|
1131
|
-
const d = p.getAttribute("
|
|
1094
|
+
const d = p.getAttribute("d") || p.getAttribute("pathTo");
|
|
1132
1095
|
if (!d || !d.trim()) return;
|
|
1133
1096
|
const group = typeof p.closest === "function" ? p.closest(".apexcharts-series") : null;
|
|
1134
1097
|
const realIndex = parseInt((_b = group == null ? void 0 : group.getAttribute("data:realIndex")) != null ? _b : "0", 10) || 0;
|
|
@@ -1198,71 +1161,31 @@ class MorphTypeChange {
|
|
|
1198
1161
|
});
|
|
1199
1162
|
}
|
|
1200
1163
|
} else if (fam === "unit") {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
if (isNaN(i)) return;
|
|
1207
|
-
const cxAttr = dot.getAttribute("cx");
|
|
1208
|
-
let x;
|
|
1209
|
-
let y;
|
|
1210
|
-
let r = 3;
|
|
1211
|
-
if (cxAttr != null) {
|
|
1212
|
-
x = parseFloat(cxAttr);
|
|
1213
|
-
y = parseFloat((_b = dot.getAttribute("cy")) != null ? _b : "");
|
|
1214
|
-
r = parseFloat((_c = dot.getAttribute("r")) != null ? _c : "3") || 3;
|
|
1215
|
-
} else {
|
|
1216
|
-
const wAttr = parseFloat((_d = dot.getAttribute("width")) != null ? _d : "0") || 0;
|
|
1217
|
-
const hAttr = parseFloat((_e = dot.getAttribute("height")) != null ? _e : "0") || 0;
|
|
1218
|
-
x = parseFloat((_f = dot.getAttribute("x")) != null ? _f : "") + wAttr / 2;
|
|
1219
|
-
y = parseFloat((_g = dot.getAttribute("y")) != null ? _g : "") + hAttr / 2;
|
|
1220
|
-
r = Math.max(wAttr, hAttr) / 2 || 3;
|
|
1221
|
-
}
|
|
1222
|
-
if (!isFinite(x) || !isFinite(y)) return;
|
|
1223
|
-
let list = unitDots.get(i);
|
|
1224
|
-
if (!list) {
|
|
1225
|
-
list = [];
|
|
1226
|
-
unitDots.set(i, list);
|
|
1227
|
-
}
|
|
1228
|
-
list.push({ x, y, r, fill: dot.getAttribute("fill") });
|
|
1229
|
-
const box = boxes.get(i);
|
|
1230
|
-
if (!box) {
|
|
1231
|
-
boxes.set(i, {
|
|
1232
|
-
minX: x,
|
|
1233
|
-
minY: y,
|
|
1234
|
-
maxX: x,
|
|
1235
|
-
maxY: y,
|
|
1236
|
-
fill: dot.getAttribute("fill")
|
|
1237
|
-
});
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
if (x < box.minX) box.minX = x;
|
|
1241
|
-
if (x > box.maxX) box.maxX = x;
|
|
1242
|
-
if (y < box.minY) box.minY = y;
|
|
1243
|
-
if (y > box.maxY) box.maxY = y;
|
|
1244
|
-
});
|
|
1245
|
-
Array.from(boxes.keys()).sort((a, b) => a - b).forEach((i) => {
|
|
1246
|
-
const b = (
|
|
1247
|
-
/** @type {any} */
|
|
1248
|
-
boxes.get(i)
|
|
1164
|
+
this._readUnitDots(baseEl, unitDots);
|
|
1165
|
+
Array.from(unitDots.keys()).sort((a, b) => a - b).forEach((i) => {
|
|
1166
|
+
const list = (
|
|
1167
|
+
/** @type {any[]} */
|
|
1168
|
+
unitDots.get(i)
|
|
1249
1169
|
);
|
|
1170
|
+
const xs = list.map((d) => d.x);
|
|
1171
|
+
const ys = list.map((d) => d.y);
|
|
1250
1172
|
const pad = 2;
|
|
1251
|
-
const x1 =
|
|
1252
|
-
const y1 =
|
|
1253
|
-
const x2 =
|
|
1254
|
-
const y2 =
|
|
1173
|
+
const x1 = Math.min(...xs) - pad;
|
|
1174
|
+
const y1 = Math.min(...ys) - pad;
|
|
1175
|
+
const x2 = Math.max(...xs) + pad;
|
|
1176
|
+
const y2 = Math.max(...ys) + pad;
|
|
1255
1177
|
captured.push({
|
|
1256
1178
|
realIndex: i,
|
|
1257
1179
|
j: 0,
|
|
1258
1180
|
d: `M ${x1} ${y1} L ${x2} ${y1} L ${x2} ${y2} L ${x1} ${y2} Z`,
|
|
1259
|
-
fill:
|
|
1181
|
+
fill: list[0].fill
|
|
1260
1182
|
});
|
|
1261
1183
|
});
|
|
1262
1184
|
} else if (fam === "radial") {
|
|
1263
1185
|
if (fromType === "radialBar" || fromType === "gauge") {
|
|
1264
|
-
const
|
|
1265
|
-
const
|
|
1186
|
+
const cg = this.w.globals.circleGeometry;
|
|
1187
|
+
const centerX = cg ? cg.cx : this.w.layout.gridWidth / 2;
|
|
1188
|
+
const centerY = cg ? cg.cy : this.w.layout.gridHeight / 2;
|
|
1266
1189
|
const rings = baseEl.querySelectorAll(
|
|
1267
1190
|
".apexcharts-radial-series .apexcharts-radialbar-area"
|
|
1268
1191
|
);
|
|
@@ -1445,31 +1368,48 @@ class MorphTypeChange {
|
|
|
1445
1368
|
});
|
|
1446
1369
|
}
|
|
1447
1370
|
}
|
|
1371
|
+
const fromUnit = familyOf(_fromType) === "unit";
|
|
1448
1372
|
if (tf === "radial" || tf === "unit" || tf === "partition") {
|
|
1449
1373
|
flat.forEach((c, i) => {
|
|
1450
|
-
map.set(`${i}:0`, { d: c.d, fill: c.fill });
|
|
1374
|
+
map.set(`${fromUnit ? c.realIndex : i}:0`, { d: c.d, fill: c.fill });
|
|
1451
1375
|
});
|
|
1452
1376
|
return map;
|
|
1453
1377
|
}
|
|
1454
1378
|
if (tf === "bar" || tf === "summary") {
|
|
1455
|
-
const
|
|
1456
|
-
const series = Array.isArray(newSeries) ? newSeries : [];
|
|
1457
|
-
series.forEach((s, seriesIdx) => {
|
|
1458
|
-
const data = s && Array.isArray(s.data) ? s.data : [];
|
|
1459
|
-
for (let j = 0; j < data.length; j++) {
|
|
1460
|
-
positions.push({ realIndex: seriesIdx, j });
|
|
1461
|
-
}
|
|
1462
|
-
});
|
|
1379
|
+
const keys = this._targetKeys(tf, newSeries);
|
|
1463
1380
|
flat.forEach((c, i) => {
|
|
1464
|
-
const
|
|
1465
|
-
if (
|
|
1466
|
-
map.set(`${pos.realIndex}:${pos.j}`, { d: c.d, fill: c.fill });
|
|
1467
|
-
}
|
|
1381
|
+
const key = keys[fromUnit ? c.realIndex : i];
|
|
1382
|
+
if (key) map.set(key, { d: c.d, fill: c.fill });
|
|
1468
1383
|
});
|
|
1469
|
-
return map;
|
|
1470
1384
|
}
|
|
1471
1385
|
return map;
|
|
1472
1386
|
}
|
|
1387
|
+
/**
|
|
1388
|
+
* The incoming chart's mark keys `${realIndex}:${j}`, in draw order. A
|
|
1389
|
+
* radial chart draws one slice per value, and the single-series object
|
|
1390
|
+
* form `[{ data: [...] }]` expands to one slice per datum. A bar chart
|
|
1391
|
+
* (boxPlot and violin render through it) draws one mark per datum of each
|
|
1392
|
+
* series.
|
|
1393
|
+
*
|
|
1394
|
+
* @param {string|null} tf - the incoming family
|
|
1395
|
+
* @param {any} newSeries
|
|
1396
|
+
* @returns {string[]}
|
|
1397
|
+
*/
|
|
1398
|
+
_targetKeys(tf, newSeries) {
|
|
1399
|
+
var _a;
|
|
1400
|
+
const keys = [];
|
|
1401
|
+
const series = Array.isArray(newSeries) ? newSeries : [];
|
|
1402
|
+
if (tf === "radial") {
|
|
1403
|
+
const n = series.length === 1 && Array.isArray((_a = series[0]) == null ? void 0 : _a.data) ? series[0].data.length : series.length;
|
|
1404
|
+
for (let i = 0; i < n; i++) keys.push(`${i}:0`);
|
|
1405
|
+
} else {
|
|
1406
|
+
series.forEach((s, si) => {
|
|
1407
|
+
const data = s && Array.isArray(s.data) ? s.data : [];
|
|
1408
|
+
for (let j = 0; j < data.length; j++) keys.push(`${si}:${j}`);
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
return keys;
|
|
1412
|
+
}
|
|
1473
1413
|
isActive() {
|
|
1474
1414
|
return this._snapshot !== null;
|
|
1475
1415
|
}
|
|
@@ -1659,46 +1599,64 @@ class MorphTypeChange {
|
|
|
1659
1599
|
* @returns {{ minX:number, minY:number, maxX:number, maxY:number } | null}
|
|
1660
1600
|
*/
|
|
1661
1601
|
_pathBBox(d) {
|
|
1662
|
-
const commands = parsePath(d);
|
|
1663
1602
|
let minX = Infinity;
|
|
1664
1603
|
let minY = Infinity;
|
|
1665
1604
|
let maxX = -Infinity;
|
|
1666
1605
|
let maxY = -Infinity;
|
|
1667
|
-
let
|
|
1668
|
-
|
|
1606
|
+
let px = 0;
|
|
1607
|
+
let py = 0;
|
|
1608
|
+
let sx = 0;
|
|
1609
|
+
let sy = 0;
|
|
1610
|
+
const add = (x, y) => {
|
|
1611
|
+
if (!isFinite(x) || !isFinite(y)) return;
|
|
1612
|
+
if (x < minX) minX = x;
|
|
1613
|
+
if (x > maxX) maxX = x;
|
|
1614
|
+
if (y < minY) minY = y;
|
|
1615
|
+
if (y > maxY) maxY = y;
|
|
1616
|
+
};
|
|
1617
|
+
parsePath(d).forEach(
|
|
1669
1618
|
/** @param {any[]} c */
|
|
1670
1619
|
(c) => {
|
|
1671
1620
|
const cmd = c[0];
|
|
1672
|
-
if (cmd === "Z")
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1621
|
+
if (cmd === "Z") {
|
|
1622
|
+
px = sx;
|
|
1623
|
+
py = sy;
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
const n = c.length;
|
|
1627
|
+
const x = cmd === "H" ? c[1] : cmd === "V" ? px : c[n - 2];
|
|
1628
|
+
const y = cmd === "H" ? py : cmd === "V" ? c[1] : c[n - 1];
|
|
1629
|
+
if (cmd === "A") {
|
|
1630
|
+
if (c[1]) {
|
|
1631
|
+
const hx = (px - x) / 2;
|
|
1632
|
+
const hy = (py - y) / 2;
|
|
1633
|
+
const f = (c[4] === c[5] ? -1 : 1) * Math.sqrt(Math.max(0, c[1] * c[1] / (hx * hx + hy * hy) - 1));
|
|
1634
|
+
const cx = px - hx + f * hy;
|
|
1635
|
+
const cy = py - hy - f * hx;
|
|
1636
|
+
const r = Math.hypot(px - cx, py - cy);
|
|
1637
|
+
const a0 = Math.atan2(py - cy, px - cx);
|
|
1638
|
+
const TAU = 2 * Math.PI;
|
|
1639
|
+
let sweep = Math.atan2(y - cy, x - cx) - a0;
|
|
1640
|
+
if (c[5] && sweep < 0) sweep += TAU;
|
|
1641
|
+
else if (!c[5] && sweep > 0) sweep -= TAU;
|
|
1642
|
+
for (let a = 0; a < TAU; a += Math.PI / 2) {
|
|
1643
|
+
const t = ((sweep > 0 ? a - a0 : a0 - a) % TAU + TAU) % TAU;
|
|
1644
|
+
if (t <= Math.abs(sweep)) add(cx + r * Math.cos(a), cy + r * Math.sin(a));
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
} else if (cmd !== "H" && cmd !== "V") {
|
|
1648
|
+
for (let k = 1; k + 1 < n; k += 2) add(c[k], c[k + 1]);
|
|
1649
|
+
}
|
|
1650
|
+
add(x, y);
|
|
1651
|
+
px = x;
|
|
1652
|
+
py = y;
|
|
1653
|
+
if (cmd === "M") {
|
|
1654
|
+
sx = x;
|
|
1655
|
+
sy = y;
|
|
1679
1656
|
}
|
|
1680
|
-
pairs.forEach(([x, y]) => {
|
|
1681
|
-
if (!isFinite(x) || !isFinite(y)) return;
|
|
1682
|
-
seen = true;
|
|
1683
|
-
if (x < minX) minX = x;
|
|
1684
|
-
if (x > maxX) maxX = x;
|
|
1685
|
-
if (y < minY) minY = y;
|
|
1686
|
-
if (y > maxY) maxY = y;
|
|
1687
|
-
});
|
|
1688
1657
|
}
|
|
1689
1658
|
);
|
|
1690
|
-
|
|
1691
|
-
return { minX, minY, maxX, maxY };
|
|
1692
|
-
}
|
|
1693
|
-
/**
|
|
1694
|
-
* @param {number} realIndex
|
|
1695
|
-
* @param {number} j
|
|
1696
|
-
* @returns {string | null}
|
|
1697
|
-
*/
|
|
1698
|
-
getInitialFillFor(realIndex, j) {
|
|
1699
|
-
if (!this._snapshot) return null;
|
|
1700
|
-
const entry = this._snapshot.mapping.get(`${realIndex}:${j}`);
|
|
1701
|
-
return entry ? entry.fill : null;
|
|
1659
|
+
return minX > maxX ? null : { minX, minY, maxX, maxY };
|
|
1702
1660
|
}
|
|
1703
1661
|
/** @returns {number} */
|
|
1704
1662
|
getSpeed() {
|
|
@@ -1716,55 +1674,78 @@ class MorphTypeChange {
|
|
|
1716
1674
|
if (!this._snapshot || !Environment.isBrowser()) return;
|
|
1717
1675
|
this._shown = true;
|
|
1718
1676
|
const baseEl = (_a = this.w.globals.dom) == null ? void 0 : _a.baseEl;
|
|
1719
|
-
if (!baseEl) return;
|
|
1677
|
+
if (!baseEl || this._snapshot.resume) return;
|
|
1720
1678
|
if (this._snapshot.pieceOut) this._separatePieces();
|
|
1721
1679
|
else if (this._snapshot.pieceIn) this._combinePieces();
|
|
1722
1680
|
else this._mountGhost();
|
|
1723
1681
|
const speed = this.getSpeed();
|
|
1724
|
-
const
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
".apexcharts-subtitle-text"
|
|
1733
|
-
];
|
|
1734
|
-
chromeSelectors.forEach((sel) => {
|
|
1735
|
-
baseEl.querySelectorAll(sel).forEach((el) => {
|
|
1736
|
-
if (!el.style) return;
|
|
1737
|
-
el.style.opacity = "0";
|
|
1738
|
-
el.style.transition = `opacity ${speed}ms ease-out`;
|
|
1739
|
-
BrowserAPIs.requestAnimationFrame(() => {
|
|
1740
|
-
el.style.opacity = "1";
|
|
1741
|
-
});
|
|
1742
|
-
setTimeout(() => {
|
|
1743
|
-
el.style.transition = "";
|
|
1744
|
-
el.style.opacity = "";
|
|
1745
|
-
}, speed + 80);
|
|
1746
|
-
});
|
|
1682
|
+
const chrome = Array.from(
|
|
1683
|
+
baseEl.querySelectorAll(
|
|
1684
|
+
".apexcharts-xaxis,.apexcharts-yaxis,.apexcharts-grid,.apexcharts-legend,.apexcharts-title-text,.apexcharts-subtitle-text"
|
|
1685
|
+
)
|
|
1686
|
+
).filter((el) => el.style);
|
|
1687
|
+
const set = (opacity, transition) => chrome.forEach((el) => {
|
|
1688
|
+
el.style.opacity = opacity;
|
|
1689
|
+
if (transition != null) el.style.transition = transition;
|
|
1747
1690
|
});
|
|
1691
|
+
set("0", `opacity ${speed}ms ease-out`);
|
|
1692
|
+
const dead = () => this.w.globals.isDestroyed;
|
|
1693
|
+
BrowserAPIs.requestAnimationFrame(() => dead() || set("1"));
|
|
1694
|
+
setTimeout(() => dead() || set("", ""), speed + 80);
|
|
1748
1695
|
const snap = this._snapshot;
|
|
1749
1696
|
setTimeout(() => {
|
|
1750
|
-
if (!this._snapshot || this._snapshot === snap) this.cleanup();
|
|
1697
|
+
if (!dead() && (!this._snapshot || this._snapshot === snap)) this.cleanup();
|
|
1751
1698
|
}, speed + 100);
|
|
1752
1699
|
}
|
|
1753
1700
|
/**
|
|
1754
1701
|
* A render after the one a morph was captured for (an update while the
|
|
1755
1702
|
* morph is still finishing, or just after) must not start its marks from
|
|
1756
1703
|
* the old chart's shapes again: it starts from the screen, as any update
|
|
1757
|
-
* does. The morph's
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1704
|
+
* does. The morph's pieces go with it, as the new render replaces what
|
|
1705
|
+
* they were leaving over, but where they are is handed on first: a piece
|
|
1706
|
+
* flying to a dot becomes that dot's previous slot, so the unit chart's
|
|
1707
|
+
* own keyed update carries it on, and the tiles of a mosaic still
|
|
1708
|
+
* assembling become its mark's start shape, their bounding box, through
|
|
1709
|
+
* the morph's snapshot, kept for that one render. A ghost already fading
|
|
1710
|
+
* is left to finish its own fade (its timer removes it) rather than vanish
|
|
1711
|
+
* mid-way. A no-op until that render has mounted, so a second update in
|
|
1712
|
+
* the same tick still morphs.
|
|
1760
1713
|
*/
|
|
1761
1714
|
retire() {
|
|
1762
|
-
|
|
1715
|
+
const snap = this._snapshot;
|
|
1716
|
+
if (!snap || !this._shown) return;
|
|
1717
|
+
const layer = this._pieceLayer;
|
|
1718
|
+
this.ctx._unitPieces = snap.pieceOut && layer;
|
|
1719
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
1720
|
+
layer == null ? void 0 : layer.querySelectorAll("g").forEach((g) => {
|
|
1721
|
+
const r = g.firstChild && g.getBBox();
|
|
1722
|
+
if (r) {
|
|
1723
|
+
mapping.set(g.firstChild.getAttribute("data-key"), {
|
|
1724
|
+
d: `M${r.x} ${r.y}H${r.x + r.width}V${r.y + r.height}H${r.x}Z`
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
this.cleanup(true);
|
|
1729
|
+
if (!mapping.size) return;
|
|
1730
|
+
this._collectTargetMarks(snap.toType).forEach((t, k) => {
|
|
1731
|
+
if (!mapping.has(k)) mapping.set(k, { d: this._markD(t) });
|
|
1732
|
+
});
|
|
1733
|
+
this.w.globals.previousPaths = [];
|
|
1734
|
+
this._snapshot = Object.assign(snap, {
|
|
1735
|
+
mapping,
|
|
1736
|
+
pieceIn: false,
|
|
1737
|
+
resume: true,
|
|
1738
|
+
oldLayout: __spreadValues({}, this.w.layout)
|
|
1739
|
+
});
|
|
1740
|
+
BrowserAPIs.requestAnimationFrame(() => {
|
|
1741
|
+
if (this._snapshot === snap) this._shown = true;
|
|
1742
|
+
});
|
|
1763
1743
|
}
|
|
1764
|
-
|
|
1744
|
+
/** @param {boolean} [keepGhost] leave a mounted ghost to its own timer */
|
|
1745
|
+
cleanup(keepGhost) {
|
|
1765
1746
|
this._snapshot = null;
|
|
1766
1747
|
this._shown = false;
|
|
1767
|
-
this._removeGhost();
|
|
1748
|
+
if (!keepGhost) this._removeGhost();
|
|
1768
1749
|
this._cancelPieces();
|
|
1769
1750
|
}
|
|
1770
1751
|
}
|