apexcharts 7.2.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.
- package/LICENSE +30 -11
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +545 -463
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.esm.js +1149 -801
- package/dist/apexcharts.js +684 -254
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +684 -254
- package/dist/area.common.js +1 -1
- package/dist/area.esm.js +1 -1
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +20 -10
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +20 -10
- package/dist/bubble.common.js +1 -1
- package/dist/bubble.esm.js +1 -1
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +20 -10
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +20 -10
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +545 -463
- package/dist/donut.common.js +1 -1
- package/dist/donut.esm.js +1 -1
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +20 -10
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +364 -26
- package/dist/features/annotations.common.js +1 -1
- package/dist/features/annotations.esm.js +1 -1
- package/dist/features/annotations.js +1 -1
- 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 +1 -1
- package/dist/features/drilldown.esm.js +1 -1
- package/dist/features/drilldown.js +1 -1
- 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 +12 -14
- 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/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 +14 -1
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +1 -1
- package/dist/features/legend.esm.js +1 -1
- package/dist/features/legend.js +1 -1
- package/dist/features/link.common.js +1 -1
- package/dist/features/link.esm.js +38 -38
- 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 +1 -1
- package/dist/features/morph.esm.js +1 -1
- package/dist/features/morph.js +1 -1
- package/dist/features/perspectives.common.js +1 -1
- package/dist/features/perspectives.esm.js +11 -11
- package/dist/features/perspectives.js +1 -1
- package/dist/features/raincloud.common.js +1 -1
- package/dist/features/raincloud.esm.js +1 -1
- package/dist/features/raincloud.js +1 -1
- 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 +1 -1
- package/dist/features/stats.esm.js +1 -1
- package/dist/features/stats.js +1 -1
- package/dist/features/storyboard.common.js +1 -1
- package/dist/features/storyboard.esm.js +11 -11
- package/dist/features/storyboard.js +1 -1
- package/dist/features/streamgraph.common.js +1 -1
- package/dist/features/streamgraph.esm.js +1 -1
- package/dist/features/streamgraph.js +1 -1
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +172 -25
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +1 -1
- package/dist/features/trellis.esm.js +1 -1
- package/dist/features/trellis.js +1 -1
- 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 +180 -2
- package/dist/features/weave.js +2 -2
- package/dist/heatmap.common.js +1 -1
- package/dist/heatmap.esm.js +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +20 -10
- package/dist/line.common.js +1 -1
- package/dist/line.esm.js +1 -1
- package/dist/line.js +1 -1
- 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 +1 -1
- package/dist/pie.esm.js +1 -1
- package/dist/pie.js +1 -1
- package/dist/polarArea.common.js +1 -1
- package/dist/polarArea.esm.js +1 -1
- package/dist/radar.common.js +1 -1
- package/dist/radar.esm.js +1 -1
- package/dist/radar.js +1 -1
- package/dist/radialBar.common.js +1 -1
- package/dist/radialBar.esm.js +1 -1
- package/dist/radialBar.js +1 -1
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +20 -10
- package/dist/rangeArea.common.js +1 -1
- package/dist/rangeArea.esm.js +1 -1
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +20 -10
- package/dist/scatter.common.js +1 -1
- package/dist/scatter.esm.js +1 -1
- package/dist/streamgraph.common.js +1 -1
- package/dist/streamgraph.esm.js +1 -1
- package/dist/sunburst.common.js +1 -1
- package/dist/sunburst.esm.js +1 -1
- package/dist/sunburst.js +1 -1
- package/dist/treemap.common.js +1 -1
- package/dist/treemap.esm.js +1 -1
- package/dist/treemap.js +1 -1
- 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 +1 -1
- package/dist/unit.esm.js +79 -79
- package/dist/unit.js +1 -1
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +20 -10
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +20 -10
- package/package.json +2 -2
- package/src/apexcharts.js +39 -15
- package/src/charts/common/bar/Helpers.js +31 -12
- package/src/modules/Data.js +8 -2
- package/src/modules/Exports.js +14 -12
- package/src/modules/Formatters.js +24 -1
- package/src/modules/Range.js +28 -1
- package/src/modules/Toolbar.js +112 -2
- package/src/modules/ZoomPanSelection.js +85 -7
- package/src/modules/accessibility/KeyboardNavigation.js +14 -0
- package/src/modules/axes/YAxis.js +12 -15
- package/src/modules/helpers/UpdateHelpers.js +25 -8
- package/src/modules/settings/Globals.js +5 -10
- package/src/modules/settings/Options.js +15 -0
- package/src/modules/weave/PluginAPI.js +57 -1
- package/src/modules/weave/WeaveHost.js +148 -0
- package/src/ssr/DOMShim.js +50 -0
- package/src/types/internal.d.ts +1 -1
- package/src/utils/Utils.js +6 -9
- package/types/apexcharts.d.ts +17 -0
|
@@ -16,7 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18
18
|
/*!
|
|
19
|
-
* ApexCharts v7.
|
|
19
|
+
* ApexCharts v7.4.0
|
|
20
20
|
* (c) 2018-2026 ApexCharts
|
|
21
21
|
*/
|
|
22
22
|
import ApexCharts from "apexcharts/core";
|
|
@@ -33,7 +33,7 @@ function getRegistry() {
|
|
|
33
33
|
function getPlugin(name) {
|
|
34
34
|
return getRegistry()[name] || null;
|
|
35
35
|
}
|
|
36
|
-
const WEAVE_API_VERSION =
|
|
36
|
+
const WEAVE_API_VERSION = 5;
|
|
37
37
|
const PLUGIN_CHART_METHODS = [
|
|
38
38
|
"updateOptions",
|
|
39
39
|
"updateSeries",
|
|
@@ -264,6 +264,19 @@ function buildPluginAPI(host, record) {
|
|
|
264
264
|
enabledOnSeries: Array.isArray(
|
|
265
265
|
w.config.dataLabels && w.config.dataLabels.enabledOnSeries
|
|
266
266
|
) ? w.config.dataLabels.enabledOnSeries.slice() : null
|
|
267
|
+
}),
|
|
268
|
+
// The caller's own dashing, reported for the same reason and against
|
|
269
|
+
// the same trap (v5). `stroke.dashArray` is indexed by series position
|
|
270
|
+
// with no per-series escape hatch, so a plugin that wants ITS OWN
|
|
271
|
+
// computed series dashed has to write the whole array, and writing one
|
|
272
|
+
// without knowing what was there discards the caller's dashed lines
|
|
273
|
+
// with nothing to restore them from.
|
|
274
|
+
//
|
|
275
|
+
// A scalar applies to every series and an array is per series. There is
|
|
276
|
+
// no "unset" to report: the option defaults to 0, and 0 already means
|
|
277
|
+
// no dashing, so restoring it restores exactly what was there.
|
|
278
|
+
stroke: Object.freeze({
|
|
279
|
+
dashArray: Array.isArray(w.config.stroke && w.config.stroke.dashArray) ? w.config.stroke.dashArray.slice() : w.config.stroke && w.config.stroke.dashArray || 0
|
|
267
280
|
})
|
|
268
281
|
});
|
|
269
282
|
},
|
|
@@ -331,6 +344,36 @@ function buildPluginAPI(host, record) {
|
|
|
331
344
|
host._reserve(record.def.name, box);
|
|
332
345
|
return api;
|
|
333
346
|
},
|
|
347
|
+
/**
|
|
348
|
+
* Subscribe to the data point a viewer is pointing at.
|
|
349
|
+
*
|
|
350
|
+
* The chart already knows this: it resolves the series and point under the
|
|
351
|
+
* pointer for its own tooltip and fires `dataPointMouseEnter`,
|
|
352
|
+
* `dataPointMouseLeave` and `dataPointSelection` for the caller. This
|
|
353
|
+
* forwards the same three, so a plugin gets the host's answer rather than
|
|
354
|
+
* hit-testing the SVG itself and disagreeing with the tooltip.
|
|
355
|
+
*
|
|
356
|
+
* The payload is normalised rather than the chart's own argument list,
|
|
357
|
+
* which passes `w`. A plugin must not receive `w`, and the three things a
|
|
358
|
+
* plugin actually wants (which series, which point, what the point is
|
|
359
|
+
* called) are exactly what the chart has already resolved.
|
|
360
|
+
*
|
|
361
|
+
* `category` is the resolved display label, the same string `api.categories`
|
|
362
|
+
* carries, because a plugin coordinating two charts keys on the label
|
|
363
|
+
* rather than on an index that means something different on each chart.
|
|
364
|
+
*
|
|
365
|
+
* Nothing here gives a plugin the ability to intercept or cancel: the
|
|
366
|
+
* chart's own tooltip, selection state and caller events are unaffected,
|
|
367
|
+
* and a handler that throws is contained rather than allowed to break the
|
|
368
|
+
* interaction it was watching.
|
|
369
|
+
*
|
|
370
|
+
* @param {(e: {type: 'enter'|'leave'|'select', seriesIndex: number, dataPointIndex: number, category: string|undefined, seriesName: string|undefined, selected: boolean|undefined}) => void} fn
|
|
371
|
+
* @returns {() => void} unsubscribe
|
|
372
|
+
* @since Weave v4
|
|
373
|
+
*/
|
|
374
|
+
pointer(fn) {
|
|
375
|
+
return host._onPointer(record.def.name, fn);
|
|
376
|
+
},
|
|
334
377
|
// ── custom events out to the host app ──
|
|
335
378
|
/**
|
|
336
379
|
* Fires as `plugin:<pluginName>:<name>` on the chart's event bus. The
|
|
@@ -368,6 +411,8 @@ const _WeaveHost = class _WeaveHost {
|
|
|
368
411
|
this._derived = null;
|
|
369
412
|
this._reserved = null;
|
|
370
413
|
this._reserveTimer = null;
|
|
414
|
+
this._pointerSubs = null;
|
|
415
|
+
this._pointerWired = null;
|
|
371
416
|
this._onUpdated = this._onUpdated.bind(this);
|
|
372
417
|
this._init();
|
|
373
418
|
}
|
|
@@ -610,6 +655,132 @@ const _WeaveHost = class _WeaveHost {
|
|
|
610
655
|
}
|
|
611
656
|
this._repairInitialSeries();
|
|
612
657
|
}
|
|
658
|
+
/**
|
|
659
|
+
* Subscribe a plugin to the data point the viewer is pointing at.
|
|
660
|
+
*
|
|
661
|
+
* Wired lazily: a chart whose plugins never ask pays nothing, and the chart
|
|
662
|
+
* fires these three events whether or not anyone is listening, so there is no
|
|
663
|
+
* cost to the chart either way.
|
|
664
|
+
*
|
|
665
|
+
* The chart's own handler signature is `(e, ctx, {seriesIndex,
|
|
666
|
+
* dataPointIndex, w})`. `w` stops here: what reaches a plugin is the
|
|
667
|
+
* normalised payload documented on `api.pointer`.
|
|
668
|
+
*
|
|
669
|
+
* @param {string} pluginName
|
|
670
|
+
* @param {Function} fn
|
|
671
|
+
* @returns {() => void} unsubscribe
|
|
672
|
+
*/
|
|
673
|
+
_onPointer(pluginName, fn) {
|
|
674
|
+
if (typeof fn !== "function") return () => {
|
|
675
|
+
};
|
|
676
|
+
if (!this._pointerSubs) this._pointerSubs = /* @__PURE__ */ new Map();
|
|
677
|
+
const list = this._pointerSubs.get(pluginName) || [];
|
|
678
|
+
list.push(fn);
|
|
679
|
+
this._pointerSubs.set(pluginName, list);
|
|
680
|
+
this._wirePointer();
|
|
681
|
+
return () => {
|
|
682
|
+
const current = this._pointerSubs && this._pointerSubs.get(pluginName);
|
|
683
|
+
if (!current) return;
|
|
684
|
+
const i = current.indexOf(fn);
|
|
685
|
+
if (i > -1) current.splice(i, 1);
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
/** Attach to the chart's own data point events, once. */
|
|
689
|
+
_wirePointer() {
|
|
690
|
+
if (this._pointerWired) return;
|
|
691
|
+
if (!this.ctx || typeof this.ctx.addEventListener !== "function") return;
|
|
692
|
+
const map = [
|
|
693
|
+
["enter", "dataPointMouseEnter"],
|
|
694
|
+
["leave", "dataPointMouseLeave"],
|
|
695
|
+
["select", "dataPointSelection"]
|
|
696
|
+
];
|
|
697
|
+
this._pointerWired = [];
|
|
698
|
+
for (const [type, name] of map) {
|
|
699
|
+
const handler = (_e, _ctx, opts) => {
|
|
700
|
+
this._emitPointer(type, opts);
|
|
701
|
+
};
|
|
702
|
+
this.ctx.addEventListener(name, handler);
|
|
703
|
+
this._pointerWired.push([name, handler]);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Hand one pointer event to every subscribed plugin.
|
|
708
|
+
*
|
|
709
|
+
* A handler that throws is contained per plugin, on the same terms as every
|
|
710
|
+
* other plugin callback here: this runs inside the viewer's own hover, and a
|
|
711
|
+
* plugin breaking the chart's interaction would be the worst failure mode
|
|
712
|
+
* this facade has.
|
|
713
|
+
*
|
|
714
|
+
* @param {'enter'|'leave'|'select'} type
|
|
715
|
+
* @param {any} opts
|
|
716
|
+
*/
|
|
717
|
+
_emitPointer(type, opts) {
|
|
718
|
+
if (!this._pointerSubs || !this._pointerSubs.size) return;
|
|
719
|
+
const seriesIndex = opts && typeof opts.seriesIndex === "number" ? opts.seriesIndex : -1;
|
|
720
|
+
const dataPointIndex = opts && typeof opts.dataPointIndex === "number" ? opts.dataPointIndex : -1;
|
|
721
|
+
const labels = this._categories() || [];
|
|
722
|
+
const w = this.w;
|
|
723
|
+
const config = w && w.config && w.config.series || [];
|
|
724
|
+
const payload = {
|
|
725
|
+
type,
|
|
726
|
+
seriesIndex,
|
|
727
|
+
dataPointIndex,
|
|
728
|
+
category: dataPointIndex > -1 ? labels[dataPointIndex] : void 0,
|
|
729
|
+
// A pie/donut carries bare numbers in `series`, so there is no name to
|
|
730
|
+
// read: undefined rather than a guess, on the same terms as `category`.
|
|
731
|
+
seriesName: _WeaveHost._seriesName(config, seriesIndex),
|
|
732
|
+
// Only meaningful on a select: the chart hands back its whole selection
|
|
733
|
+
// set, and what a plugin wants to know is whether THIS point is now in
|
|
734
|
+
// it, so a second click reads as a deselect rather than another select.
|
|
735
|
+
selected: type === "select" ? _WeaveHost._isSelected(opts, seriesIndex, dataPointIndex) : void 0
|
|
736
|
+
};
|
|
737
|
+
for (const [name, handlers] of this._pointerSubs) {
|
|
738
|
+
for (const fn of handlers.slice()) {
|
|
739
|
+
try {
|
|
740
|
+
fn(payload);
|
|
741
|
+
} catch (e) {
|
|
742
|
+
console.warn(
|
|
743
|
+
'[apexcharts] plugin "' + name + '" threw in a pointer handler',
|
|
744
|
+
e
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* The configured name of series `i`, where there is one.
|
|
752
|
+
*
|
|
753
|
+
* @param {any[]} config
|
|
754
|
+
* @param {number} i
|
|
755
|
+
* @returns {string|undefined}
|
|
756
|
+
*/
|
|
757
|
+
static _seriesName(config, i) {
|
|
758
|
+
if (i < 0) return void 0;
|
|
759
|
+
const entry = config[i];
|
|
760
|
+
if (!entry || typeof entry !== "object") return void 0;
|
|
761
|
+
return typeof entry.name === "string" ? entry.name : void 0;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Whether the chart now counts this point as selected.
|
|
765
|
+
*
|
|
766
|
+
* `selectedDataPoints` is an array per series of the indexes selected in it.
|
|
767
|
+
* Absent on a chart type that does not carry point selection, in which case
|
|
768
|
+
* the answer is undefined rather than false: "not selected" and "selection
|
|
769
|
+
* does not apply here" are different, and a plugin keying on it should be
|
|
770
|
+
* able to tell.
|
|
771
|
+
*
|
|
772
|
+
* @param {any} opts
|
|
773
|
+
* @param {number} seriesIndex
|
|
774
|
+
* @param {number} dataPointIndex
|
|
775
|
+
* @returns {boolean|undefined}
|
|
776
|
+
*/
|
|
777
|
+
static _isSelected(opts, seriesIndex, dataPointIndex) {
|
|
778
|
+
const all = opts && opts.selectedDataPoints;
|
|
779
|
+
if (!Array.isArray(all) || seriesIndex < 0) return void 0;
|
|
780
|
+
const mine = all[seriesIndex];
|
|
781
|
+
if (!Array.isArray(mine)) return false;
|
|
782
|
+
return mine.indexOf(dataPointIndex) > -1;
|
|
783
|
+
}
|
|
613
784
|
/**
|
|
614
785
|
* Record a plugin's container reservation and re-render if it changed.
|
|
615
786
|
*
|
|
@@ -834,6 +1005,13 @@ const _WeaveHost = class _WeaveHost {
|
|
|
834
1005
|
this.active = [];
|
|
835
1006
|
this._derived = null;
|
|
836
1007
|
this._reserved = null;
|
|
1008
|
+
this._pointerSubs = null;
|
|
1009
|
+
if (this._pointerWired) {
|
|
1010
|
+
for (const [name, handler] of this._pointerWired) {
|
|
1011
|
+
this.ctx.removeEventListener && this.ctx.removeEventListener(name, handler);
|
|
1012
|
+
}
|
|
1013
|
+
this._pointerWired = null;
|
|
1014
|
+
}
|
|
837
1015
|
if (this._reserveTimer != null) {
|
|
838
1016
|
clearTimeout(this._reserveTimer);
|
|
839
1017
|
this._reserveTimer = null;
|
package/dist/features/weave.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexWeave={})}(this,function(e){"use strict";var t=Object.defineProperty,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(e,r,s)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,o=(e,t)=>{for(var o in t||(t={}))s.call(t,o)&&a(e,o,t[o]);if(r)for(var o of r(t))i.call(t,o)&&a(e,o,t[o]);return e};const n=globalThis.ApexCharts,l="__apexcharts_plugins__";function d(e){return function(){const e=globalThis;return e[l]||(e[l]={}),e[l]}()[e]||null}const c=["updateOptions","updateSeries","appendData","appendSeries","toggleSeries","showSeries","hideSeries","highlightSeries","isSeriesHidden","zoomX","addXaxisAnnotation","addYaxisAnnotation","addPointAnnotation","clearAnnotations","removeAnnotation","dataURI","exportToCSV"];function h(e){const t={};return c.forEach(r=>{"function"==typeof e[r]&&(t[r]=e[r].bind(e))}),Object.freeze(t)}const u=class e{constructor(e,t){this.w=e,this.ctx=t,this.active=[],this._layers=new Map,this._currentScales=null,this._lastPluginsRef=null,this._lastData=null,this._updatedWired=!1,this._derived=null,this._reserved=null,this._reserveTimer=null,this._onUpdated=this._onUpdated.bind(this),this._init()}_init(){(this.w.config.plugins||[]).map((e,t)=>({entry:e,order:null!=e.order?e.order:t})).sort((e,t)=>e.order-t.order).forEach(e=>this._activate(e.entry)),this._lastPluginsRef=this.w.config.plugins,this._wireUpdated()}_wireUpdated(){this._updatedWired||(this.ctx.addEventListener("updated",this._onUpdated),this._updatedWired=!0)}_onUpdated(){this._repairInitialSeries(),this.dispatch("afterUpdate",{pass:"update"})}_activate(e){const t=d(e.name);if(!t)return void console.error(`[apexcharts] plugin "${e.name}" is not registered.`);const r=null!=t.apiVersion?Math.trunc(t.apiVersion):1;if(!(r>=1)||r>3)return void console.error(`[apexcharts] plugin "${t.name}" targets Weave API v${t.apiVersion}, host is v3; skipped.`);const s={def:t,options:Object.freeze(o({},e.options||{})),handlers:new Map,disabled:!1,failures:0,api:null};s.api=function(e,t){const r=e.ctx,s=e.w,i={name:t.def.name,version:3,get options(){return t.options},on(e,r){const s=t.handlers;return s.has(e)||s.set(e,[]),s.get(e).push(r),i},off(e,r){const s=t.handlers.get(e);if(s){const e=s.indexOf(r);e>-1&&s.splice(e,1)}return i},store:{},layer:r=>e._layer(t.def.name,r||{}),get scales(){return e._currentScales},get data(){return e._lastData||(e._lastData=e._dataSnapshot())},theme:Object.freeze({get mode(){return s.config.theme.mode},get foreColor(){return s.config.chart.foreColor},seriesColor:e=>s.globals.colors[e],token:t=>e._token(t)}),chart:h(r),get info(){return Object.freeze({type:String(s.config.chart&&(s.config.chart.requestedType||s.config.chart.type)||"line"),axisChart:!0===s.globals.axisCharts,datetimeX:!(!s.config.xaxis||"datetime"!==s.config.xaxis.type),horizontalBars:!!(s.config.plotOptions&&s.config.plotOptions.bar&&s.config.plotOptions.bar.horizontal),dataLabels:Object.freeze({enabled:!(!s.config.dataLabels||!s.config.dataLabels.enabled),enabledOnSeries:Array.isArray(s.config.dataLabels&&s.config.dataLabels.enabledOnSeries)?s.config.dataLabels.enabledOnSeries.slice():null})})},get categories(){return e._categories()},markDerived:r=>(e._markDerived(t.def.name,r),i),reserve:r=>(e._reserve(t.def.name,r),i),emit(e,s){r.events.fireEvent(`plugin:${t.def.name}:${e}`,[r,s])},get el(){return s.dom.baseEl}};return Object.freeze(i)}(this,s),this.active.push(s),this._guard(s,"setup",()=>t.setup(s.api))}dispatch(e,t){if("draw"===e&&(this._reconcile(),this._resetLayers()),this._lastData=null,!this.active.length)return;"afterParse"===e?this._currentScales=null:t&&"xyRatios"in t&&this._setScales(t.xyRatios);const r=t&&t.pass||"full";let s=null;for(const t of this.active){if(t.disabled)continue;const i=t.handlers.get(e);if(!i||!i.length)continue;null===s&&(s=this._dataSnapshot(),this._lastData=s);const a={api:t.api,scales:this._currentScales,data:s,pass:r,hook:e};for(const r of i.slice())this._guard(t,e,()=>r(a))}}_guard(e,t,r){if(!e.disabled)try{r()}catch(r){console.error(`[apexcharts] plugin "${e.def.name}" threw in "${t}":`,r),e.failures=(e.failures||0)+1,e.failures>=3&&(e.disabled=!0,console.error(`[apexcharts] plugin "${e.def.name}" disabled after repeated errors.`))}}_setScales(e){const t=this.w,r=t.globals,s=t.layout;if(!e||!r.axisCharts)return void(this._currentScales=null);const i=e.xRatio,a=e.yRatio||[],o=e=>null!=r.maxYArr[e]?r.maxYArr[e]:r.maxY,n=e=>null!=r.minYArr[e]?r.minYArr[e]:r.minY,l=!t.axisFlags.isXNumeric&&!r.isBarHorizontal&&r.dataPoints>0,d=l?s.gridWidth/r.dataPoints:0;this._currentScales={x:l?e=>d*(e+.5):e=>(e-r.minX)/i,y:(e,t=0)=>(o(t)-e)/(e=>null!=a[e]?a[e]:a[0])(t),domainX:l?[-.5,r.dataPoints-.5]:[r.minX,r.maxX],domainY:(e=0)=>[n(e),o(e)],gridWidth:s.gridWidth,gridHeight:s.gridHeight,ratios:e}}_dataSnapshot(){const e=this.w,t=e.globals,r=e.seriesData.series||[],s=e.seriesData.seriesX||[],i=Array.isArray(e.config.series)?e.config.series:[];return r.map((e,r)=>{const a=Array.isArray(e)?e:[e],o=s[r]||[],n=a.map((e,t)=>({x:null!=o[t]?o[t]:t,y:e})),l=i[r],d=l&&"object"==typeof l&&Array.isArray(l.data)?l.data:[];return{name:t.seriesNames?t.seriesNames[r]:void 0,hidden:(t.collapsedSeriesIndices||[]).includes(r),color:t.colors?t.colors[r]:void 0,points:n,raw:d}})}_categories(){const e=this.w,t=e.globals,r=e.config.xaxis&&Array.isArray(e.config.xaxis.categories)?e.config.xaxis.categories:[],s=Array.isArray(t.categoryLabels)?t.categoryLabels:[],i=Array.isArray(t.labels)?t.labels:[],a=r.length?r:s.length?s:i,o=e.seriesData.series||[];let n=0;for(let e=0;e<o.length;e++){const t=o[e];Array.isArray(t)&&t.length>n&&(n=t.length)}n||(n=a.length);const l=[];for(let e=0;e<n;e++){const t=a[e];l.push(String(null==t?e+1:t))}return l}_markDerived(e,t){this._derived||(this._derived=new Map);const r=Array.isArray(t)?t.map(e=>String(e)):[];r.length?this._derived.set(e,r):this._derived.delete(e),this._repairInitialSeries()}_reserve(t,r){const s=e._normaliseBox(r),i=this._reserved?this._reserved.get(t):void 0;if(s){if(i&&i.left===s.left&&i.right===s.right&&i.top===s.top&&i.bottom===s.bottom)return;this._reserved||(this._reserved=new Map),this._reserved.set(t,s)}else{if(!i||!this._reserved)return;this._reserved.delete(t)}this._resizeForReservation()}static _normaliseBox(e){if(!e||"object"!=typeof e)return null;const t=e=>Number.isFinite(e)&&e>0?Math.round(e):0,r={left:t(e.left),right:t(e.right),top:t(e.top),bottom:t(e.bottom)};return r.left||r.right||r.top||r.bottom?r:null}reservedBox(){if(!this._reserved||0===this._reserved.size)return e.NO_RESERVATION;const t={left:0,right:0,top:0,bottom:0};for(const e of this._reserved.values())t.left+=e.left,t.right+=e.right,t.top+=e.top,t.bottom+=e.bottom;return t}_resizeForReservation(){null==this._reserveTimer&&(this._reserveTimer=setTimeout(()=>{this._reserveTimer=null;const e=this.w.globals;if(!e.isDestroyed){e.resized=!0,e.dataChanged=!1;try{this.ctx.update()}catch(e){}}},0))}_derivedNames(){const e=new Set;if(!this._derived)return e;for(const t of this._derived.values())for(const r of t)e.add(r);return e}_repairInitialSeries(){const e=this._derivedNames();if(!e.size)return;const t=this.w,r=(Array.isArray(t.config.series)?t.config.series:[]).filter(t=>!e.has(String(t&&t.name)));if(r.length)try{t.globals.initialSeries=r,t.globals.initialConfig&&Array.isArray(t.globals.initialConfig.series)&&(t.globals.initialConfig.series=r)}catch(e){}}_token(e){const t=this.w,r=t.globals;switch(e){case"foreColor":return t.config.chart.foreColor;case"background":return t.config.chart.background;case"accent":case"primary":return r.colors?r.colors[0]:void 0;default:return/^series-\d+$/.test(e)&&r.colors?r.colors[Number(e.split("-")[1])]:void 0}}_layer(e,{z:t="front",className:r=""}={}){let s=this._layers.get(e);if(!s){s=this.ctx.graphics.group({class:`apexcharts-plugin-${e} ${r}`.trim()});const i=this.w.dom.elGraphical.node;"behind"===t?i.insertBefore(s.node,i.firstChild):i.appendChild(s.node),s.node.setAttribute("aria-hidden","true"),this._layers.set(e,s)}return function(e,t){const r=t=>(t&&e.add(t),t),s={get node(){return e.node},path(e={}){const{d:s="",stroke:i="#000",width:a=1,fill:o="none",opacity:n=1,dash:l=0,className:d=""}=e;return r(t.drawPath({d:s,stroke:i,strokeWidth:a,fill:o,fillOpacity:"none"===o?0:n,strokeOpacity:n,strokeDashArray:l,classes:d}))},line(e={}){const{x1:s,y1:i,x2:a,y2:o,stroke:n="#000",width:l=1,dash:d=0}=e;return r(t.drawLine(s,i,a,o,n,d,l))},rect(e={}){const{x:s=0,y:i=0,w:a=0,h:o=0,r:n=0,fill:l="#000",stroke:d=null,opacity:c=1}=e;return r(t.drawRect(s,i,a,o,n,l,c,null!=d?1:null,d))},circle(e={}){const{cx:s=0,cy:i=0,r:a=0,fill:o="#000",stroke:n=null}=e;return r(t.drawCircle(a,{cx:s,cy:i,fill:o,stroke:n||"none"}))},text(e={}){const{x:s=0,y:i=0,text:a="",color:o,size:n,anchor:l="start",weight:d}=e;return r(t.drawText({x:s,y:i,text:a,textAnchor:l,fontSize:n,foreColor:o,fontWeight:d}))},clear(){const t=e.node;for(;t.firstChild;)t.removeChild(t.firstChild);return s}};return s}(s,this.ctx.graphics)}_resetLayers(){const e=this.w.dom.elGraphical,t=e&&e.node;if(t){const e=t.querySelectorAll('g[class*="apexcharts-plugin-"]');Array.prototype.forEach.call(e,e=>e.remove())}this._layers.clear()}_reconcile(){const e=this.w.config.plugins||[];if(e===this._lastPluginsRef)return;this._lastPluginsRef=e;const t=new Map(e.map((e,t)=>[e.name,{entry:e,order:null!=e.order?e.order:t}]));for(let e=this.active.length-1;e>=0;e--){const r=this.active[e],s=t.get(r.def.name);s?r.options=Object.freeze(o({},s.entry.options||{})):(this._guard(r,"destroy",()=>r.def.destroy&&r.def.destroy(r.api)),this.active.splice(e,1),this._reserve(r.def.name,null))}const r=new Set(this.active.map(e=>e.def.name)),s=[];t.forEach((e,t)=>{r.has(t)||s.push(e)}),s.sort((e,t)=>e.order-t.order).forEach(e=>this._activate(e.entry))}teardown(e){if(!e){this.dispatch("destroy");for(const e of this.active)this._guard(e,"destroy",()=>e.def.destroy&&e.def.destroy(e.api));this.active=[],this._derived=null,this._reserved=null,null!=this._reserveTimer&&(clearTimeout(this._reserveTimer),this._reserveTimer=null),this._updatedWired&&(this.ctx.removeEventListener&&this.ctx.removeEventListener("updated",this._onUpdated),this._updatedWired=!1)}this._layers.clear()}};var f,p,g;f=u,p="NO_RESERVATION",g=Object.freeze({left:0,right:0,top:0,bottom:0}),a(f,"symbol"!=typeof p?p+"":p,g);let _=u;n.registerFeatures({weave:_}),e.default=n,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
5
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexWeave={})}(this,function(e){"use strict";var t=Object.defineProperty,r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,n=(e,r,i)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,o=(e,t)=>{for(var o in t||(t={}))i.call(t,o)&&n(e,o,t[o]);if(r)for(var o of r(t))s.call(t,o)&&n(e,o,t[o]);return e};const a=globalThis.ApexCharts,l="__apexcharts_plugins__";function c(e){return function(){const e=globalThis;return e[l]||(e[l]={}),e[l]}()[e]||null}const d=["updateOptions","updateSeries","appendData","appendSeries","toggleSeries","showSeries","hideSeries","highlightSeries","isSeriesHidden","zoomX","addXaxisAnnotation","addYaxisAnnotation","addPointAnnotation","clearAnnotations","removeAnnotation","dataURI","exportToCSV"];function h(e){const t={};return d.forEach(r=>{"function"==typeof e[r]&&(t[r]=e[r].bind(e))}),Object.freeze(t)}const f=class e{constructor(e,t){this.w=e,this.ctx=t,this.active=[],this._layers=new Map,this._currentScales=null,this._lastPluginsRef=null,this._lastData=null,this._updatedWired=!1,this._derived=null,this._reserved=null,this._reserveTimer=null,this._pointerSubs=null,this._pointerWired=null,this._onUpdated=this._onUpdated.bind(this),this._init()}_init(){(this.w.config.plugins||[]).map((e,t)=>({entry:e,order:null!=e.order?e.order:t})).sort((e,t)=>e.order-t.order).forEach(e=>this._activate(e.entry)),this._lastPluginsRef=this.w.config.plugins,this._wireUpdated()}_wireUpdated(){this._updatedWired||(this.ctx.addEventListener("updated",this._onUpdated),this._updatedWired=!0)}_onUpdated(){this._repairInitialSeries(),this.dispatch("afterUpdate",{pass:"update"})}_activate(e){const t=c(e.name);if(!t)return void console.error(`[apexcharts] plugin "${e.name}" is not registered.`);const r=null!=t.apiVersion?Math.trunc(t.apiVersion):1;if(!(r>=1)||r>5)return void console.error(`[apexcharts] plugin "${t.name}" targets Weave API v${t.apiVersion}, host is v5; skipped.`);const i={def:t,options:Object.freeze(o({},e.options||{})),handlers:new Map,disabled:!1,failures:0,api:null};i.api=function(e,t){const r=e.ctx,i=e.w,s={name:t.def.name,version:5,get options(){return t.options},on(e,r){const i=t.handlers;return i.has(e)||i.set(e,[]),i.get(e).push(r),s},off(e,r){const i=t.handlers.get(e);if(i){const e=i.indexOf(r);e>-1&&i.splice(e,1)}return s},store:{},layer:r=>e._layer(t.def.name,r||{}),get scales(){return e._currentScales},get data(){return e._lastData||(e._lastData=e._dataSnapshot())},theme:Object.freeze({get mode(){return i.config.theme.mode},get foreColor(){return i.config.chart.foreColor},seriesColor:e=>i.globals.colors[e],token:t=>e._token(t)}),chart:h(r),get info(){return Object.freeze({type:String(i.config.chart&&(i.config.chart.requestedType||i.config.chart.type)||"line"),axisChart:!0===i.globals.axisCharts,datetimeX:!(!i.config.xaxis||"datetime"!==i.config.xaxis.type),horizontalBars:!!(i.config.plotOptions&&i.config.plotOptions.bar&&i.config.plotOptions.bar.horizontal),dataLabels:Object.freeze({enabled:!(!i.config.dataLabels||!i.config.dataLabels.enabled),enabledOnSeries:Array.isArray(i.config.dataLabels&&i.config.dataLabels.enabledOnSeries)?i.config.dataLabels.enabledOnSeries.slice():null}),stroke:Object.freeze({dashArray:Array.isArray(i.config.stroke&&i.config.stroke.dashArray)?i.config.stroke.dashArray.slice():i.config.stroke&&i.config.stroke.dashArray||0})})},get categories(){return e._categories()},markDerived:r=>(e._markDerived(t.def.name,r),s),reserve:r=>(e._reserve(t.def.name,r),s),pointer:r=>e._onPointer(t.def.name,r),emit(e,i){r.events.fireEvent(`plugin:${t.def.name}:${e}`,[r,i])},get el(){return i.dom.baseEl}};return Object.freeze(s)}(this,i),this.active.push(i),this._guard(i,"setup",()=>t.setup(i.api))}dispatch(e,t){if("draw"===e&&(this._reconcile(),this._resetLayers()),this._lastData=null,!this.active.length)return;"afterParse"===e?this._currentScales=null:t&&"xyRatios"in t&&this._setScales(t.xyRatios);const r=t&&t.pass||"full";let i=null;for(const t of this.active){if(t.disabled)continue;const s=t.handlers.get(e);if(!s||!s.length)continue;null===i&&(i=this._dataSnapshot(),this._lastData=i);const n={api:t.api,scales:this._currentScales,data:i,pass:r,hook:e};for(const r of s.slice())this._guard(t,e,()=>r(n))}}_guard(e,t,r){if(!e.disabled)try{r()}catch(r){console.error(`[apexcharts] plugin "${e.def.name}" threw in "${t}":`,r),e.failures=(e.failures||0)+1,e.failures>=3&&(e.disabled=!0,console.error(`[apexcharts] plugin "${e.def.name}" disabled after repeated errors.`))}}_setScales(e){const t=this.w,r=t.globals,i=t.layout;if(!e||!r.axisCharts)return void(this._currentScales=null);const s=e.xRatio,n=e.yRatio||[],o=e=>null!=r.maxYArr[e]?r.maxYArr[e]:r.maxY,a=e=>null!=r.minYArr[e]?r.minYArr[e]:r.minY,l=!t.axisFlags.isXNumeric&&!r.isBarHorizontal&&r.dataPoints>0,c=l?i.gridWidth/r.dataPoints:0;this._currentScales={x:l?e=>c*(e+.5):e=>(e-r.minX)/s,y:(e,t=0)=>(o(t)-e)/(e=>null!=n[e]?n[e]:n[0])(t),domainX:l?[-.5,r.dataPoints-.5]:[r.minX,r.maxX],domainY:(e=0)=>[a(e),o(e)],gridWidth:i.gridWidth,gridHeight:i.gridHeight,ratios:e}}_dataSnapshot(){const e=this.w,t=e.globals,r=e.seriesData.series||[],i=e.seriesData.seriesX||[],s=Array.isArray(e.config.series)?e.config.series:[];return r.map((e,r)=>{const n=Array.isArray(e)?e:[e],o=i[r]||[],a=n.map((e,t)=>({x:null!=o[t]?o[t]:t,y:e})),l=s[r],c=l&&"object"==typeof l&&Array.isArray(l.data)?l.data:[];return{name:t.seriesNames?t.seriesNames[r]:void 0,hidden:(t.collapsedSeriesIndices||[]).includes(r),color:t.colors?t.colors[r]:void 0,points:a,raw:c}})}_categories(){const e=this.w,t=e.globals,r=e.config.xaxis&&Array.isArray(e.config.xaxis.categories)?e.config.xaxis.categories:[],i=Array.isArray(t.categoryLabels)?t.categoryLabels:[],s=Array.isArray(t.labels)?t.labels:[],n=r.length?r:i.length?i:s,o=e.seriesData.series||[];let a=0;for(let e=0;e<o.length;e++){const t=o[e];Array.isArray(t)&&t.length>a&&(a=t.length)}a||(a=n.length);const l=[];for(let e=0;e<a;e++){const t=n[e];l.push(String(null==t?e+1:t))}return l}_markDerived(e,t){this._derived||(this._derived=new Map);const r=Array.isArray(t)?t.map(e=>String(e)):[];r.length?this._derived.set(e,r):this._derived.delete(e),this._repairInitialSeries()}_onPointer(e,t){if("function"!=typeof t)return()=>{};this._pointerSubs||(this._pointerSubs=new Map);const r=this._pointerSubs.get(e)||[];return r.push(t),this._pointerSubs.set(e,r),this._wirePointer(),()=>{const r=this._pointerSubs&&this._pointerSubs.get(e);if(!r)return;const i=r.indexOf(t);i>-1&&r.splice(i,1)}}_wirePointer(){if(this._pointerWired)return;if(!this.ctx||"function"!=typeof this.ctx.addEventListener)return;const e=[["enter","dataPointMouseEnter"],["leave","dataPointMouseLeave"],["select","dataPointSelection"]];this._pointerWired=[];for(const[t,r]of e){const e=(e,r,i)=>{this._emitPointer(t,i)};this.ctx.addEventListener(r,e),this._pointerWired.push([r,e])}}_emitPointer(t,r){if(!this._pointerSubs||!this._pointerSubs.size)return;const i=r&&"number"==typeof r.seriesIndex?r.seriesIndex:-1,s=r&&"number"==typeof r.dataPointIndex?r.dataPointIndex:-1,n=this._categories()||[],o=this.w,a=o&&o.config&&o.config.series||[],l={type:t,seriesIndex:i,dataPointIndex:s,category:s>-1?n[s]:void 0,seriesName:e._seriesName(a,i),selected:"select"===t?e._isSelected(r,i,s):void 0};for(const[e,t]of this._pointerSubs)for(const r of t.slice())try{r(l)}catch(t){console.warn('[apexcharts] plugin "'+e+'" threw in a pointer handler',t)}}static _seriesName(e,t){if(t<0)return;const r=e[t];return r&&"object"==typeof r&&"string"==typeof r.name?r.name:void 0}static _isSelected(e,t,r){const i=e&&e.selectedDataPoints;if(!Array.isArray(i)||t<0)return;const s=i[t];return!!Array.isArray(s)&&s.indexOf(r)>-1}_reserve(t,r){const i=e._normaliseBox(r),s=this._reserved?this._reserved.get(t):void 0;if(i){if(s&&s.left===i.left&&s.right===i.right&&s.top===i.top&&s.bottom===i.bottom)return;this._reserved||(this._reserved=new Map),this._reserved.set(t,i)}else{if(!s||!this._reserved)return;this._reserved.delete(t)}this._resizeForReservation()}static _normaliseBox(e){if(!e||"object"!=typeof e)return null;const t=e=>Number.isFinite(e)&&e>0?Math.round(e):0,r={left:t(e.left),right:t(e.right),top:t(e.top),bottom:t(e.bottom)};return r.left||r.right||r.top||r.bottom?r:null}reservedBox(){if(!this._reserved||0===this._reserved.size)return e.NO_RESERVATION;const t={left:0,right:0,top:0,bottom:0};for(const e of this._reserved.values())t.left+=e.left,t.right+=e.right,t.top+=e.top,t.bottom+=e.bottom;return t}_resizeForReservation(){null==this._reserveTimer&&(this._reserveTimer=setTimeout(()=>{this._reserveTimer=null;const e=this.w.globals;if(!e.isDestroyed){e.resized=!0,e.dataChanged=!1;try{this.ctx.update()}catch(e){}}},0))}_derivedNames(){const e=new Set;if(!this._derived)return e;for(const t of this._derived.values())for(const r of t)e.add(r);return e}_repairInitialSeries(){const e=this._derivedNames();if(!e.size)return;const t=this.w,r=(Array.isArray(t.config.series)?t.config.series:[]).filter(t=>!e.has(String(t&&t.name)));if(r.length)try{t.globals.initialSeries=r,t.globals.initialConfig&&Array.isArray(t.globals.initialConfig.series)&&(t.globals.initialConfig.series=r)}catch(e){}}_token(e){const t=this.w,r=t.globals;switch(e){case"foreColor":return t.config.chart.foreColor;case"background":return t.config.chart.background;case"accent":case"primary":return r.colors?r.colors[0]:void 0;default:return/^series-\d+$/.test(e)&&r.colors?r.colors[Number(e.split("-")[1])]:void 0}}_layer(e,{z:t="front",className:r=""}={}){let i=this._layers.get(e);if(!i){i=this.ctx.graphics.group({class:`apexcharts-plugin-${e} ${r}`.trim()});const s=this.w.dom.elGraphical.node;"behind"===t?s.insertBefore(i.node,s.firstChild):s.appendChild(i.node),i.node.setAttribute("aria-hidden","true"),this._layers.set(e,i)}return function(e,t){const r=t=>(t&&e.add(t),t),i={get node(){return e.node},path(e={}){const{d:i="",stroke:s="#000",width:n=1,fill:o="none",opacity:a=1,dash:l=0,className:c=""}=e;return r(t.drawPath({d:i,stroke:s,strokeWidth:n,fill:o,fillOpacity:"none"===o?0:a,strokeOpacity:a,strokeDashArray:l,classes:c}))},line(e={}){const{x1:i,y1:s,x2:n,y2:o,stroke:a="#000",width:l=1,dash:c=0}=e;return r(t.drawLine(i,s,n,o,a,c,l))},rect(e={}){const{x:i=0,y:s=0,w:n=0,h:o=0,r:a=0,fill:l="#000",stroke:c=null,opacity:d=1}=e;return r(t.drawRect(i,s,n,o,a,l,d,null!=c?1:null,c))},circle(e={}){const{cx:i=0,cy:s=0,r:n=0,fill:o="#000",stroke:a=null}=e;return r(t.drawCircle(n,{cx:i,cy:s,fill:o,stroke:a||"none"}))},text(e={}){const{x:i=0,y:s=0,text:n="",color:o,size:a,anchor:l="start",weight:c}=e;return r(t.drawText({x:i,y:s,text:n,textAnchor:l,fontSize:a,foreColor:o,fontWeight:c}))},clear(){const t=e.node;for(;t.firstChild;)t.removeChild(t.firstChild);return i}};return i}(i,this.ctx.graphics)}_resetLayers(){const e=this.w.dom.elGraphical,t=e&&e.node;if(t){const e=t.querySelectorAll('g[class*="apexcharts-plugin-"]');Array.prototype.forEach.call(e,e=>e.remove())}this._layers.clear()}_reconcile(){const e=this.w.config.plugins||[];if(e===this._lastPluginsRef)return;this._lastPluginsRef=e;const t=new Map(e.map((e,t)=>[e.name,{entry:e,order:null!=e.order?e.order:t}]));for(let e=this.active.length-1;e>=0;e--){const r=this.active[e],i=t.get(r.def.name);i?r.options=Object.freeze(o({},i.entry.options||{})):(this._guard(r,"destroy",()=>r.def.destroy&&r.def.destroy(r.api)),this.active.splice(e,1),this._reserve(r.def.name,null))}const r=new Set(this.active.map(e=>e.def.name)),i=[];t.forEach((e,t)=>{r.has(t)||i.push(e)}),i.sort((e,t)=>e.order-t.order).forEach(e=>this._activate(e.entry))}teardown(e){if(!e){this.dispatch("destroy");for(const e of this.active)this._guard(e,"destroy",()=>e.def.destroy&&e.def.destroy(e.api));if(this.active=[],this._derived=null,this._reserved=null,this._pointerSubs=null,this._pointerWired){for(const[e,t]of this._pointerWired)this.ctx.removeEventListener&&this.ctx.removeEventListener(e,t);this._pointerWired=null}null!=this._reserveTimer&&(clearTimeout(this._reserveTimer),this._reserveTimer=null),this._updatedWired&&(this.ctx.removeEventListener&&this.ctx.removeEventListener("updated",this._onUpdated),this._updatedWired=!1)}this._layers.clear()}};var u,p,g;u=f,p="NO_RESERVATION",g=Object.freeze({left:0,right:0,top:0,bottom:0}),n(u,"symbol"!=typeof p?p+"":p,g);let _=f;a.registerFeatures({weave:_}),e.default=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/heatmap.common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function e(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const a in e)if("default"!==a){const i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>e[a]})}return t.default=e,Object.freeze(t)}const t=e(require("apexcharts/core")),a=t.__apex_Animations,i=t.__apex_Animations_computeStagger,s=t.__apex_Graphics,o=t.__apex_Fill,l=t.__apex_Series,r=t.__apex_Utils,n=t.__apex_DataLabels,c=(e,t,a,i)=>{if("function"!=typeof e)return e;const s=e({series:t.seriesData.series,seriesIndex:a,dataPointIndex:i,w:t});return Number.isFinite(s)?s:0};class h{constructor(e,t){this.ctx=t,this.w=e}checkColorRange(){const e=this.w;let t=!1;const a=e.config.plotOptions[e.config.chart.type];return a.colorScale.ranges.length>0&&a.colorScale.ranges.map(e=>{e.from<=0&&(t=!0)}),t}getShadeColor(e,t,a,i){const s=this.w;let o=1;const l=s.config.plotOptions[e].shadeIntensity,n=this.determineColor(e,t,a);s.globals.hasNegs||i?o=s.config.plotOptions[e].reverseNegativeShade?n.percent<0?n.percent/100*(1.25*l):(1-n.percent/100)*(1.25*l):n.percent<=0?1-(1+n.percent/100)*l:(1-n.percent/100)*l:(o=1-n.percent/100,"treemap"===e&&(o=(1-n.percent/100)*(1.25*l)));let c=n.color;const h=new r;if(s.config.plotOptions[e].enableShades)if("dark"===this.w.config.theme.mode){const e=h.shadeColor(-1*o,n.color);c=r.hexToRgba(r.isColorHex(e)?e:r.rgb2hex(e),s.config.fill.opacity)}else{const e=h.shadeColor(o,n.color);c=r.hexToRgba(r.isColorHex(e)?e:r.rgb2hex(e),s.config.fill.opacity)}return{color:c,colorProps:n}}determineColor(e,t,a){const i=this.w,s=i.seriesData.series[t][a],o=i.config.plotOptions[e];let l=o.colorScale.inverse?a:t;o.distributed&&"treemap"===i.config.chart.type&&(l=a);let r,n,c=i.globals.colors[l],h=null;if(o.distributed||"heatmap"!==e){const e=i.seriesData.series[t];r=e.length?e[0]:0,n=r;for(let t=1;t<e.length;t++)e[t]<r&&(r=e[t]),e[t]>n&&(n=e[t])}else r=i.globals.minY,n=i.globals.maxY;const d=o.colorScale.min,g=o.colorScale.max;void 0!==d&&void 0!==g&&g>d?(r=d,n=g):void 0!==d&&(r=d<i.globals.minY?d:i.globals.minY,n=g>i.globals.maxY?g:i.globals.maxY);const p=Math.abs(n)+Math.abs(r),f=Math.min(Math.max(s,r),n);let m=0===p?0:100*f/p;if(o.colorScale.ranges.length>0){o.colorScale.ranges.map(e=>{if(s>=e.from&&s<=e.to){c=e.color,h=e.foreColor?e.foreColor:null,r=e.from,n=e.to;const t=Math.abs(n)+Math.abs(r);m=0===t?0:100*s/t}})}return{color:c,foreColor:h,percent:m}}calculateDataLabels({text:e,x:t,y:a,i:i,j:o,colorProps:l,fontSize:r}){const h=this.w,d=h.config.dataLabels,g=new s(this.w),p=new n(this.w,this.ctx);let f=null;if(d.enabled){f=g.group({class:"apexcharts-data-labels"});const s=c(d.offsetX,h,i,o),n=c(d.offsetY,h,i,o),m=t+s,u=a+parseFloat(d.style.fontSize)/3+n;p.plotDataLabelsText({x:m,y:u,text:e,i:i,j:o,color:l.foreColor,parent:f,fontSize:r,dataLabelsConfig:d})}return f}}const d=t.__apex_Filters;const g=t.__apex_BrowserAPIs_BrowserAPIs,p=t.__apex_math_SVGNS;t.default.use({heatmap:class{constructor(e,t,a){this.ctx=t,this.w=e,this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new h(e,t),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.shape=this.w.config.plotOptions.heatmap.shape||"rect",this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}draw(e){var t,i;const n=this.w,c=new s(this.w,this.ctx),h=c.group({class:"apexcharts-heatmap"}),g=n.layout.gridWidth/n.globals.dataPoints,p=n.layout.gridHeight/n.seriesData.series.length,f=("numeric"===n.config.xaxis.type||"datetime"===n.config.xaxis.type)&&n.axisFlags.isXNumeric&&this.xRatio>0;let m=g;if(f){const e=n.globals.minXDiff;m=Number.isFinite(e)&&e>0?e/this.xRatio:g}let u=this.shape;f&&"hexagon"===u&&(u="rect");const x=function(e,t){const a=e&&e.renderer;return a&&a.kind&&"svg"!==a.kind?a:t}(this.ctx,c),b="rect"===u&&x!==c&&"function"==typeof x.drawRectCell;"hexagon"===u?this.applyHexagonClipPath(h,c,g,p):h.attr("clip-path",`url(#gridRectMask${n.globals.cuid})`);const y=Array.isArray(n.config.fill.opacity)?null!=(t=n.config.fill.opacity[0])?t:1:null!=(i=n.config.fill.opacity)?i:1;let w=0,S=!1;this.negRange=this.helpers.checkColorRange();const _=e.slice();n.config.yaxis[0].reversed&&(S=!0,_.reverse());for(let t=S?0:_.length-1;S?t<_.length:t>=0;S?t++:t--){const i=c.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:r.escapeString(n.seriesData.seriesNames[t]),rel:t+1,"data:realIndex":t});if(l.addCollapsedClassToSeries(this.w,i,t),b||c.setupEventDelegation(i,".apexcharts-heatmap-rect"),n.config.chart.dropShadow.enabled){const e=n.config.chart.dropShadow;new d(this.w).dropShadow(i,e,t)}let s=0;const S=n.config.plotOptions.heatmap.shadeIntensity,C=Math.round(w/p),$="hexagon"===u?(C%2==0?-1:1)*g/4:0;let P=0;for(let l=0;l<n.globals.dataPoints;l++){if(!f&&n.seriesData.seriesX.length&&!n.globals.allSeriesHasEqualX&&n.globals.minX+n.globals.minXDiff*l<n.seriesData.seriesX[t][P]){s+=g;continue}if(P>=_[t].length)break;const h=f?m:g;if(f){const e=n.seriesData.seriesX[t]?n.seriesData.seriesX[t][P]:null;if(null==e||e!=e){P++;continue}s=(e-n.globals.minX)/this.xRatio-m/2}const d=this.helpers.getShadeColor(n.config.chart.type,t,P,this.negRange);let C=d.color;const D=d.colorProps;if("image"===n.config.fill.type){C=new o(this.w).fillPath({seriesNumber:t,dataPointIndex:P,opacity:n.globals.hasNegs?D.percent<0?1-(1+D.percent/100):S+D.percent/100:D.percent/100,patternID:r.randomId(),width:n.config.fill.image.width?n.config.fill.image.width:h,height:n.config.fill.image.height?n.config.fill.image.height:p})}const k=this.rectRadius,v=n.config.plotOptions.heatmap.useFillColorAsStroke?C:n.globals.stroke.colors[0];if(b)x.drawRectCell(s,w,h,p,{fill:C,fillOpacity:y,stroke:v,strokeWidth:this.strokeWidth,radius:k,seriesIndex:t,dataPointIndex:P});else{const o="rect"===u,l=o?c.drawRect(s,w,h,p,k):c.drawPath({d:this.cellShapePath(u,s+$,w,h,p),stroke:v,strokeWidth:this.strokeWidth,fill:C,fillOpacity:1});if(l.attr({cx:s+$,cy:w}),l.node.classList.add("apexcharts-heatmap-rect"),i.add(l),l.attr({fill:C,i:t,index:t,j:P,val:e[t][P],"stroke-width":this.strokeWidth,stroke:v,color:C}),o||l.attr({width:h,height:p}),n.config.chart.animations.enabled&&!n.globals.dataChanged){let e=1;if(n.globals.resized||(e=n.config.chart.animations.speed),o)this.animateHeatMap(l,s,w,h,p,e,t,P);else{const i=new a(this.w);i.animatePop(l,{speed:e,delay:this.enterStaggerDelay(e,t,P),onComplete:()=>{i.animationCompleted(l)}})}}if(n.globals.dataChanged){let e=1;if(this.dynamicAnim.enabled&&n.globals.shouldAnimate){e=this.dynamicAnim.speed;let a=n.globals.previousPaths[t]&&n.globals.previousPaths[t][P]&&n.globals.previousPaths[t][P].color;a||(a="rgba(255, 255, 255, 0)"),this.animateHeatColor(l,r.isColorHex(a)?a:r.rgb2hex(a),r.isColorHex(C)?C:r.rgb2hex(C),e)}}}const M=(0,n.config.dataLabels.formatter)(n.seriesData.series[t][P],{value:n.seriesData.series[t][P],seriesIndex:t,dataPointIndex:P,w:n}),R=this.helpers.calculateDataLabels({text:M,x:s+$+h/2,y:w+p/2,i:t,j:P,colorProps:D,series:_});null!==R&&i.add(R),f||(s+=g),P++}w+=p,h.add(i)}const C=n.globals.yAxisScale[0].result.slice();return n.config.yaxis[0].reversed?C.unshift(""):C.push(""),n.globals.yAxisScale[0].result=C,h}animateHeatMap(e,t,i,s,o,l,r=0,n=0){const c=new a(this.w),h=this.enterStaggerDelay(l,r,n);c.animateRect(e,{x:t+s/2,y:i+o/2,width:0,height:0},{x:t,y:i,width:s,height:o},l,()=>{c.animationCompleted(e)},h)}enterStaggerDelay(e,t,a){const s=this.w,o=s.config.chart.animations.animateGradually;if(!o||!1===o.enabled)return 0;const l=((s.seriesData.series||[]).length||1)+(s.globals.dataPoints||1)-2,r=Math.min(o.delay||0,.5*e/Math.max(1,l));return i({style:"diagonal",index:a,row:t,col:a,baseDelay:r})}cellShapePath(e,t,a,i,s){const o=t+i/2,l=a+s/2;if("circle"===e){const e=Math.min(i,s)/2;return`M ${o-e} ${l} a ${e} ${e} 0 1 0 ${2*e} 0 a ${e} ${e} 0 1 0 ${2*-e} 0 Z`}if("diamond"===e)return`M ${o} ${a} L ${t+i} ${l} L ${o} ${a+s} L ${t} ${l} Z`;const r=t+i;return`M ${o} ${a-s/6} L ${r} ${a+s/6} L ${r} ${a+5*s/6} L ${o} ${a+7*s/6} L ${t} ${a+5*s/6} L ${t} ${a+s/6} Z`}applyHexagonClipPath(e,t,a,i){const s=this.w,o=this.strokeWidth/2+2,l=`heatmapHexMask${s.globals.cuid}`,r=s.dom.elDefs.node,n=r.querySelector(`clipPath[id="${l}"]`);n&&n.parentNode&&n.parentNode.removeChild(n);const c=g.createElementNS(p,"clipPath");c.setAttribute("id",l),c.appendChild(t.drawRect(-a/4-o,-i/6-o,s.layout.gridWidth+a/2+2*o,s.layout.gridHeight+i/3+2*o,0,"#fff").node),r.appendChild(c),e.attr("clip-path",`url(#${l})`)}animateHeatColor(e,t,a,i){e.attr({fill:t}).animate(i).attr({fill:a})}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
package/dist/heatmap.esm.js
CHANGED
package/dist/heatmap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexHeatmap={})}(this,function(e){"use strict";const t=globalThis.ApexCharts,a=globalThis.ApexCharts.__internals,i=a.__apex_Animations,s=a.__apex_Animations_computeStagger;a.__apex_Animations_applyAnimationPolicy,a.__apex_Animations_prefersReducedMotion,a.__apex_Animations_applyProgressiveReveal;const o=globalThis.ApexCharts.__internals.__apex_Graphics,l=globalThis.ApexCharts.__internals.__apex_Fill,n=globalThis.ApexCharts.__internals.__apex_Series,r=globalThis.ApexCharts.__internals.__apex_Utils,c=globalThis.ApexCharts.__internals.__apex_DataLabels,h=(e,t,a,i)=>{if("function"!=typeof e)return e;const s=e({series:t.seriesData.series,seriesIndex:a,dataPointIndex:i,w:t});return Number.isFinite(s)?s:0};class p{constructor(e,t){this.ctx=t,this.w=e}checkColorRange(){const e=this.w;let t=!1;const a=e.config.plotOptions[e.config.chart.type];return a.colorScale.ranges.length>0&&a.colorScale.ranges.map(e=>{e.from<=0&&(t=!0)}),t}getShadeColor(e,t,a,i){const s=this.w;let o=1;const l=s.config.plotOptions[e].shadeIntensity,n=this.determineColor(e,t,a);s.globals.hasNegs||i?o=s.config.plotOptions[e].reverseNegativeShade?n.percent<0?n.percent/100*(1.25*l):(1-n.percent/100)*(1.25*l):n.percent<=0?1-(1+n.percent/100)*l:(1-n.percent/100)*l:(o=1-n.percent/100,"treemap"===e&&(o=(1-n.percent/100)*(1.25*l)));let c=n.color;const h=new r;if(s.config.plotOptions[e].enableShades)if("dark"===this.w.config.theme.mode){const e=h.shadeColor(-1*o,n.color);c=r.hexToRgba(r.isColorHex(e)?e:r.rgb2hex(e),s.config.fill.opacity)}else{const e=h.shadeColor(o,n.color);c=r.hexToRgba(r.isColorHex(e)?e:r.rgb2hex(e),s.config.fill.opacity)}return{color:c,colorProps:n}}determineColor(e,t,a){const i=this.w,s=i.seriesData.series[t][a],o=i.config.plotOptions[e];let l=o.colorScale.inverse?a:t;o.distributed&&"treemap"===i.config.chart.type&&(l=a);let n,r,c=i.globals.colors[l],h=null;if(o.distributed||"heatmap"!==e){const e=i.seriesData.series[t];n=e.length?e[0]:0,r=n;for(let t=1;t<e.length;t++)e[t]<n&&(n=e[t]),e[t]>r&&(r=e[t])}else n=i.globals.minY,r=i.globals.maxY;const p=o.colorScale.min,d=o.colorScale.max;void 0!==p&&void 0!==d&&d>p?(n=p,r=d):void 0!==p&&(n=p<i.globals.minY?p:i.globals.minY,r=d>i.globals.maxY?d:i.globals.maxY);const g=Math.abs(r)+Math.abs(n),f=Math.min(Math.max(s,n),r);let m=0===g?0:100*f/g;if(o.colorScale.ranges.length>0){o.colorScale.ranges.map(e=>{if(s>=e.from&&s<=e.to){c=e.color,h=e.foreColor?e.foreColor:null,n=e.from,r=e.to;const t=Math.abs(r)+Math.abs(n);m=0===t?0:100*s/t}})}return{color:c,foreColor:h,percent:m}}calculateDataLabels({text:e,x:t,y:a,i:i,j:s,colorProps:l,fontSize:n}){const r=this.w,p=r.config.dataLabels,d=new o(this.w),g=new c(this.w,this.ctx);let f=null;if(p.enabled){f=d.group({class:"apexcharts-data-labels"});const o=h(p.offsetX,r,i,s),c=h(p.offsetY,r,i,s),m=t+o,x=a+parseFloat(p.style.fontSize)/3+c;g.plotDataLabelsText({x:m,y:x,text:e,i:i,j:s,color:l.foreColor,parent:f,fontSize:n,dataLabelsConfig:p})}return f}}const d=globalThis.ApexCharts.__internals.__apex_Filters;const g=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,f=globalThis.ApexCharts.__internals,m=f.__apex_math_SVGNS;f.__apex_math_Point,f.__apex_math_Matrix,f.__apex_math_Box;t.use({heatmap:class{constructor(e,t,a){this.ctx=t,this.w=e,this.xRatio=a.xRatio,this.yRatio=a.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new p(e,t),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.shape=this.w.config.plotOptions.heatmap.shape||"rect",this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}draw(e){var t,a;const s=this.w,c=new o(this.w,this.ctx),h=c.group({class:"apexcharts-heatmap"}),p=s.layout.gridWidth/s.globals.dataPoints,g=s.layout.gridHeight/s.seriesData.series.length,f=("numeric"===s.config.xaxis.type||"datetime"===s.config.xaxis.type)&&s.axisFlags.isXNumeric&&this.xRatio>0;let m=p;if(f){const e=s.globals.minXDiff;m=Number.isFinite(e)&&e>0?e/this.xRatio:p}let x=this.shape;f&&"hexagon"===x&&(x="rect");const u=function(e,t){const a=e&&e.renderer;return a&&a.kind&&"svg"!==a.kind?a:t}(this.ctx,c),b="rect"===x&&u!==c&&"function"==typeof u.drawRectCell;"hexagon"===x?this.applyHexagonClipPath(h,c,p,g):h.attr("clip-path",`url(#gridRectMask${s.globals.cuid})`);const _=Array.isArray(s.config.fill.opacity)?null!=(t=s.config.fill.opacity[0])?t:1:null!=(a=s.config.fill.opacity)?a:1;let y=0,w=!1;this.negRange=this.helpers.checkColorRange();const C=e.slice();s.config.yaxis[0].reversed&&(w=!0,C.reverse());for(let t=w?0:C.length-1;w?t<C.length:t>=0;w?t++:t--){const a=c.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:r.escapeString(s.seriesData.seriesNames[t]),rel:t+1,"data:realIndex":t});if(n.addCollapsedClassToSeries(this.w,a,t),b||c.setupEventDelegation(a,".apexcharts-heatmap-rect"),s.config.chart.dropShadow.enabled){const e=s.config.chart.dropShadow;new d(this.w).dropShadow(a,e,t)}let o=0;const w=s.config.plotOptions.heatmap.shadeIntensity,S=Math.round(y/g),$="hexagon"===x?(S%2==0?-1:1)*p/4:0;let A=0;for(let n=0;n<s.globals.dataPoints;n++){if(!f&&s.seriesData.seriesX.length&&!s.globals.allSeriesHasEqualX&&s.globals.minX+s.globals.minXDiff*n<s.seriesData.seriesX[t][A]){o+=p;continue}if(A>=C[t].length)break;const h=f?m:p;if(f){const e=s.seriesData.seriesX[t]?s.seriesData.seriesX[t][A]:null;if(null==e||e!=e){A++;continue}o=(e-s.globals.minX)/this.xRatio-m/2}const d=this.helpers.getShadeColor(s.config.chart.type,t,A,this.negRange);let S=d.color;const P=d.colorProps;if("image"===s.config.fill.type){S=new l(this.w).fillPath({seriesNumber:t,dataPointIndex:A,opacity:s.globals.hasNegs?P.percent<0?1-(1+P.percent/100):w+P.percent/100:P.percent/100,patternID:r.randomId(),width:s.config.fill.image.width?s.config.fill.image.width:h,height:s.config.fill.image.height?s.config.fill.image.height:g})}const D=this.rectRadius,k=s.config.plotOptions.heatmap.useFillColorAsStroke?S:s.globals.stroke.colors[0];if(b)u.drawRectCell(o,y,h,g,{fill:S,fillOpacity:_,stroke:k,strokeWidth:this.strokeWidth,radius:D,seriesIndex:t,dataPointIndex:A});else{const l="rect"===x,n=l?c.drawRect(o,y,h,g,D):c.drawPath({d:this.cellShapePath(x,o+$,y,h,g),stroke:k,strokeWidth:this.strokeWidth,fill:S,fillOpacity:1});if(n.attr({cx:o+$,cy:y}),n.node.classList.add("apexcharts-heatmap-rect"),a.add(n),n.attr({fill:S,i:t,index:t,j:A,val:e[t][A],"stroke-width":this.strokeWidth,stroke:k,color:S}),l||n.attr({width:h,height:g}),s.config.chart.animations.enabled&&!s.globals.dataChanged){let e=1;if(s.globals.resized||(e=s.config.chart.animations.speed),l)this.animateHeatMap(n,o,y,h,g,e,t,A);else{const a=new i(this.w);a.animatePop(n,{speed:e,delay:this.enterStaggerDelay(e,t,A),onComplete:()=>{a.animationCompleted(n)}})}}if(s.globals.dataChanged){let e=1;if(this.dynamicAnim.enabled&&s.globals.shouldAnimate){e=this.dynamicAnim.speed;let a=s.globals.previousPaths[t]&&s.globals.previousPaths[t][A]&&s.globals.previousPaths[t][A].color;a||(a="rgba(255, 255, 255, 0)"),this.animateHeatColor(n,r.isColorHex(a)?a:r.rgb2hex(a),r.isColorHex(S)?S:r.rgb2hex(S),e)}}}const R=(0,s.config.dataLabels.formatter)(s.seriesData.series[t][A],{value:s.seriesData.series[t][A],seriesIndex:t,dataPointIndex:A,w:s}),v=this.helpers.calculateDataLabels({text:R,x:o+$+h/2,y:y+g/2,i:t,j:A,colorProps:P,series:C});null!==v&&a.add(v),f||(o+=p),A++}y+=g,h.add(a)}const S=s.globals.yAxisScale[0].result.slice();return s.config.yaxis[0].reversed?S.unshift(""):S.push(""),s.globals.yAxisScale[0].result=S,h}animateHeatMap(e,t,a,s,o,l,n=0,r=0){const c=new i(this.w),h=this.enterStaggerDelay(l,n,r);c.animateRect(e,{x:t+s/2,y:a+o/2,width:0,height:0},{x:t,y:a,width:s,height:o},l,()=>{c.animationCompleted(e)},h)}enterStaggerDelay(e,t,a){const i=this.w,o=i.config.chart.animations.animateGradually;if(!o||!1===o.enabled)return 0;const l=((i.seriesData.series||[]).length||1)+(i.globals.dataPoints||1)-2,n=Math.min(o.delay||0,.5*e/Math.max(1,l));return s({style:"diagonal",index:a,row:t,col:a,baseDelay:n})}cellShapePath(e,t,a,i,s){const o=t+i/2,l=a+s/2;if("circle"===e){const e=Math.min(i,s)/2;return`M ${o-e} ${l} a ${e} ${e} 0 1 0 ${2*e} 0 a ${e} ${e} 0 1 0 ${2*-e} 0 Z`}if("diamond"===e)return`M ${o} ${a} L ${t+i} ${l} L ${o} ${a+s} L ${t} ${l} Z`;const n=t+i;return`M ${o} ${a-s/6} L ${n} ${a+s/6} L ${n} ${a+5*s/6} L ${o} ${a+7*s/6} L ${t} ${a+5*s/6} L ${t} ${a+s/6} Z`}applyHexagonClipPath(e,t,a,i){const s=this.w,o=this.strokeWidth/2+2,l=`heatmapHexMask${s.globals.cuid}`,n=s.dom.elDefs.node,r=n.querySelector(`clipPath[id="${l}"]`);r&&r.parentNode&&r.parentNode.removeChild(r);const c=g.createElementNS(m,"clipPath");c.setAttribute("id",l),c.appendChild(t.drawRect(-a/4-o,-i/6-o,s.layout.gridWidth+a/2+2*o,s.layout.gridHeight+i/3+2*o,0,"#fff").node),n.appendChild(c),e.attr("clip-path",`url(#${l})`)}animateHeatColor(e,t,a,i){e.attr({fill:t}).animate(i).attr({fill:a})}}}),e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|