apexcharts 8.3.0 → 8.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/README.md +7 -7
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +20039 -19931
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +3 -8
- package/dist/apexcharts.esm.js +950 -574
- package/dist/apexcharts.full.js +23401 -22504
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +21723 -21287
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +21758 -21242
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +118 -65
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +404 -218
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +379 -205
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +118 -65
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +379 -205
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +404 -218
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +20034 -19926
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +106 -11
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +404 -218
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +282 -184
- package/dist/features/annotations.common.js +2 -2
- package/dist/features/annotations.esm.js +65 -48
- package/dist/features/annotations.js +2 -2
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +2 -2
- package/dist/features/drilldown.esm.js +137 -124
- package/dist/features/drilldown.js +2 -2
- package/dist/features/dumbbell.common.js +1 -1
- package/dist/features/dumbbell.esm.js +1 -1
- package/dist/features/dumbbell.js +1 -1
- package/dist/features/exports.common.js +2 -2
- package/dist/features/exports.esm.js +31 -15
- 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 +206 -119
- package/dist/features/highlight-filter.js +2 -2
- package/dist/features/history.common.js +1 -1
- package/dist/features/history.esm.js +1 -1
- package/dist/features/history.js +1 -1
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +1 -1
- package/dist/features/keyboard.esm.js +1 -1
- package/dist/features/keyboard.js +1 -1
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +52 -28
- package/dist/features/legend.js +2 -2
- package/dist/features/link.common.js +1 -1
- package/dist/features/link.esm.js +1 -1
- package/dist/features/link.js +1 -1
- package/dist/features/marks.common.js +1 -1
- package/dist/features/marks.esm.js +1 -1
- package/dist/features/marks.js +1 -1
- package/dist/features/measure.common.js +1 -1
- package/dist/features/measure.esm.js +1 -1
- package/dist/features/measure.js +1 -1
- package/dist/features/morph.common.js +2 -2
- package/dist/features/morph.esm.js +27 -14
- package/dist/features/morph.js +2 -2
- package/dist/features/perspectives.common.js +2 -2
- package/dist/features/perspectives.esm.js +4 -1
- package/dist/features/perspectives.js +2 -2
- package/dist/features/raincloud.common.js +2 -2
- package/dist/features/raincloud.esm.js +26 -27
- package/dist/features/raincloud.js +2 -2
- package/dist/features/renderer-canvas.common.js +2 -2
- package/dist/features/renderer-canvas.esm.js +35 -21
- package/dist/features/renderer-canvas.js +2 -2
- package/dist/features/stats.common.js +2 -2
- package/dist/features/stats.esm.js +52 -59
- package/dist/features/stats.js +2 -2
- package/dist/features/storyboard.common.js +2 -2
- package/dist/features/storyboard.esm.js +4 -1
- package/dist/features/storyboard.js +2 -2
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +160 -55
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +78 -28
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +876 -543
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +2 -2
- package/dist/features/waterfall.esm.js +14 -25
- package/dist/features/waterfall.js +2 -2
- package/dist/features/weave.common.js +2 -2
- package/dist/features/weave.esm.js +13 -12
- package/dist/features/weave.js +2 -2
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +1893 -1342
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +38 -54
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +455 -276
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +156 -91
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +118 -65
- package/dist/line.js +2 -2
- package/dist/pictograms.common.js +2 -2
- package/dist/pictograms.esm.js +2 -2
- package/dist/pictograms.js +2 -2
- package/dist/pie.common.js +2 -2
- package/dist/pie.esm.js +106 -11
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +106 -11
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +23 -9
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +2 -2
- package/dist/radialBar.esm.js +108 -14
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +39 -31
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +118 -65
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +404 -218
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +118 -65
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +276 -118
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +333 -116
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +155 -124
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +2 -2
- package/dist/unit-shapes.esm.js +2 -2
- package/dist/unit-shapes.js +2 -2
- package/dist/unit.common.js +2 -2
- package/dist/unit.esm.js +29 -27
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +14 -5
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +417 -242
- package/package.json +1 -1
- package/src/apexcharts.js +37 -60
- package/src/assets/apexcharts.css +3 -8
- package/src/charts/Bar.js +30 -12
- package/src/charts/BarStacked.js +10 -4
- package/src/charts/BoxCandleStick.js +8 -2
- package/src/charts/Icicle.js +60 -76
- package/src/charts/Line.js +58 -22
- package/src/charts/Pie.js +136 -14
- package/src/charts/Radar.js +6 -9
- package/src/charts/Radial.js +2 -6
- package/src/charts/RangeBar.js +13 -13
- package/src/charts/Scatter.js +5 -7
- package/src/charts/Sunburst.js +157 -135
- package/src/charts/Treemap.js +100 -56
- package/src/charts/common/Breadcrumb.js +37 -16
- package/src/charts/common/PreviousPaths.js +45 -0
- package/src/charts/common/Stats.js +30 -23
- package/src/charts/common/bar/DataLabels.js +85 -77
- package/src/charts/common/bar/Helpers.js +144 -56
- package/src/charts/common/line/Helpers.js +8 -11
- package/src/charts/common/partition/NodeTooltip.js +62 -22
- package/src/charts/common/partition/Partition.js +64 -19
- package/src/charts/common/partition/Tint.js +6 -3
- package/src/charts/common/partition/Transitions.js +108 -0
- package/src/charts/common/treemap/ColorScale.js +30 -14
- package/src/charts/common/treemap/Helpers.js +47 -68
- package/src/charts/common/treemap/Nested.js +2 -3
- package/src/features/raincloud.js +16 -10
- package/src/features/stats.js +67 -62
- package/src/modules/Animations.js +102 -95
- package/src/modules/AxisMapping.js +47 -12
- package/src/modules/Base.js +12 -14
- package/src/modules/CoreUtils.js +26 -46
- package/src/modules/Data.js +82 -55
- package/src/modules/DataLabels.js +14 -13
- package/src/modules/Exports.js +44 -19
- package/src/modules/Fill.js +17 -8
- package/src/modules/Filters.js +50 -50
- package/src/modules/Graphics.js +65 -84
- package/src/modules/Markers.js +57 -58
- package/src/modules/MorphPieces.js +16 -10
- package/src/modules/MorphTypeChange.js +21 -9
- package/src/modules/Range.js +32 -55
- package/src/modules/RendererController.js +4 -4
- package/src/modules/Responsive.js +5 -1
- package/src/modules/Scales.js +24 -15
- package/src/modules/Series.js +85 -73
- package/src/modules/Toolbar.js +3 -2
- package/src/modules/UnitLayoutRegistry.js +8 -5
- package/src/modules/UnitMarkRegistry.js +7 -10
- package/src/modules/ZoomPanSelection.js +4 -0
- package/src/modules/animations/AxisTransition.js +11 -4
- package/src/modules/animations/DataLabelTransition.js +30 -15
- package/src/modules/animations/Easing.js +2 -1
- package/src/modules/animations/LayoutTransition.js +43 -32
- package/src/modules/animations/LengthTransition.js +176 -84
- package/src/modules/annotations/Helpers.js +68 -52
- package/src/modules/axes/AxesUtils.js +14 -12
- package/src/modules/axes/Grid.js +21 -7
- package/src/modules/axes/XAxis.js +4 -4
- package/src/modules/axes/YAxis.js +12 -13
- package/src/modules/dimensions/Dimensions.js +9 -3
- package/src/modules/dimensions/Grid.js +2 -2
- package/src/modules/dimensions/XAxis.js +2 -5
- package/src/modules/drilldown/Breadcrumb.js +11 -53
- package/src/modules/drilldown/Drilldown.js +151 -95
- package/src/modules/helpers/InitCtxVariables.js +2 -1
- package/src/modules/helpers/UpdateHelpers.js +165 -15
- package/src/modules/helpers/XKey.js +56 -0
- package/src/modules/highlightFilter/HighlightFilter.js +98 -49
- package/src/modules/highlightFilter/PiePart.js +6 -3
- package/src/modules/highlightFilter/RadialPart.js +41 -7
- package/src/modules/highlightFilter/TreemapPart.js +71 -44
- package/src/modules/highlightFilter/util.js +23 -7
- package/src/modules/legend/Helpers.js +6 -1
- package/src/modules/legend/Legend.js +39 -13
- package/src/modules/license/LicenseEnforcer.js +5 -0
- package/src/modules/settings/Defaults.js +62 -106
- package/src/modules/settings/Globals.js +5 -0
- package/src/modules/settings/Options.js +0 -7
- package/src/modules/settings/TypeAliases.js +33 -16
- package/src/modules/streamgraph/StreamData.js +81 -35
- package/src/modules/streamgraph/StreamLabels.js +44 -17
- package/src/modules/tooltip/Labels.js +80 -80
- package/src/modules/tooltip/Marker.js +25 -21
- package/src/modules/tooltip/Position.js +88 -51
- package/src/modules/tooltip/Tooltip.js +229 -253
- package/src/modules/tooltip/Utils.js +64 -131
- package/src/modules/tooltip/constants.js +5 -5
- package/src/modules/trellis/Trellis.js +402 -248
- package/src/modules/trellis/TrellisChrome.js +110 -44
- package/src/modules/trellis/TrellisExports.js +48 -13
- package/src/modules/trellis/TrellisFrames.js +11 -15
- package/src/modules/trellis/TrellisScales.js +201 -115
- package/src/modules/trellis/TrellisSplit.js +72 -36
- package/src/modules/trellis/TrellisSync.js +41 -13
- package/src/modules/trellis/TrellisTooltip.js +101 -78
- package/src/modules/trellis/pivotRows.js +20 -6
- package/src/modules/waterfall/WaterfallData.js +14 -30
- package/src/modules/weave/WeaveHost.js +18 -12
- package/src/pictograms/registry.js +2 -1
- package/src/renderers/Renderer.js +41 -37
- package/src/renderers/canvas/CanvasCompositor.js +4 -1
- package/src/renderers/canvas/CanvasGraphics.js +56 -24
- package/src/ssr/RenderShim.js +129 -20
- package/src/svg/SVGContainer.js +3 -2
- package/src/svg/SVGFilter.js +26 -17
- package/src/types/internal.d.ts +8 -6
- package/src/unit-shapes/registry.js +3 -1
- package/src/utils/DateTime.js +5 -20
- package/src/utils/Utils.js +0 -14
- package/src/utils/nameAsHtml.js +16 -0
- package/types/apexcharts.d.ts +72 -13
package/dist/features/legend.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
!function(e){var t="undefined"!=typeof globalThis?globalThis:self,s=t.ApexCharts;if(s&&s.__internals)return e.call(t);if(s)throw new Error("ApexCharts: dist/features/legend.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return e.call(t);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/legend.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var i={file:"dist/features/legend.js",run:e,done:!1},n=t.__apexcharts_pending_addons__||(t.__apexcharts_pending_addons__=[]);n.push(i),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!i.done){var s=t.ApexCharts;if(s)if(s.__internals){i.done=!0;var r=n.indexOf(i);-1!==r&&n.splice(r,1);try{e.call(t),s.__drainsAddons||t.console.warn("ApexCharts: dist/features/legend.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(e){t.console.error("ApexCharts: dist/features/legend.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/legend.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else t.console.warn("ApexCharts: dist/features/legend.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var e,t;e=this,t=function(e){"use strict";var t=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i,o=(e,t)=>{for(var s in t||(t={}))r.call(t,s)&&a(e,s,t[s]);if(n)for(var s of n(t))l.call(t,s)&&a(e,s,t[s]);return e},c=(e,t)=>s(e,i(t));const d=globalThis.ApexCharts,h=globalThis.ApexCharts.__internals.__apex_CoreUtils,g=globalThis.ApexCharts.__internals.__apex_dimensions_Dimensions,p=globalThis.ApexCharts.__internals.__apex_Graphics,u=globalThis.ApexCharts.__internals.__apex_Series,f=globalThis.ApexCharts.__internals.__apex_Utils,m=globalThis.ApexCharts.__internals.__apex_Environment_Environment;class x{constructor(e){this.w=e.w,this.lgCtx=e}getLegendStyles(){if(m.isSSR())return null;const e=document.createElement("style");e.setAttribute("type","text/css");const t=this.w.config.chart.nonce;t&&e.setAttribute("nonce",t);const s=document.createTextNode(".apexcharts-flip-y{transform:scaleY(-1) translateY(-100%);transform-origin:top;transform-box:fill-box}.apexcharts-flip-x{transform:scaleX(-1);transform-origin:center;transform-box:fill-box}.apexcharts-legend{display:flex;overflow:auto;padding:0 10px}.apexcharts-legend.apexcharts-legend-group-horizontal{flex-direction:column}.apexcharts-legend-group{display:flex}.apexcharts-legend-group-vertical{flex-direction:column-reverse}.apexcharts-legend.apx-legend-position-bottom,.apexcharts-legend.apx-legend-position-top{flex-wrap:wrap}.apexcharts-legend.apx-legend-position-right,.apexcharts-legend.apx-legend-position-left{flex-direction:column;bottom:0}.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left,.apexcharts-legend.apx-legend-position-top.apexcharts-align-left,.apexcharts-legend.apx-legend-position-right,.apexcharts-legend.apx-legend-position-left{justify-content:flex-start;align-items:flex-start}.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center,.apexcharts-legend.apx-legend-position-top.apexcharts-align-center{justify-content:center;align-items:center}.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right,.apexcharts-legend.apx-legend-position-top.apexcharts-align-right{justify-content:flex-end;align-items:flex-end}.apexcharts-legend-series{cursor:pointer;line-height:normal;display:flex;align-items:center}.apexcharts-legend-text{position:relative;font-size:14px}.apexcharts-legend-text *,.apexcharts-legend-marker *{pointer-events:none}.apexcharts-legend-marker{position:relative;display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:1px}.apexcharts-legend-series.apexcharts-no-click{cursor:auto}.apexcharts-legend .apexcharts-hidden-zero-series,.apexcharts-legend .apexcharts-hidden-null-series{display:none!important}.apexcharts-inactive-legend{opacity:.45}");return e.appendChild(s),e}getLegendDimensions(){const e=this.w.dom.baseEl.querySelector(".apexcharts-legend");if(!e)return{clwh:0,clww:0};const{width:t,height:s}=e.getBoundingClientRect();return{clwh:s,clww:t}}appendToForeignObject(){var e;const t=this.getLegendStyles();!1!==this.w.config.chart.injectStyleSheet&&t&&(null==(e=this.w.dom.elLegendForeign)||e.appendChild(t))}toggleDataSeries(e,t){var s,i,n;const r=this.w;if(r.dom.baseEl)if(r.globals.axisCharts||"radialBar"===r.config.chart.type){r.globals.resized=!0;let l=null,a=null;if(r.globals.risingSeries=[],r.globals.axisCharts){if(l=null!=(s=Array.prototype.find.call(r.dom.baseEl.querySelectorAll(".apexcharts-series"),t=>t.getAttribute("data:realIndex")===String(e)))?s:null,!l)return;a=parseInt(null!=(i=l.getAttribute("data:realIndex"))?i:"",10)}else{if(l=r.dom.baseEl.querySelector(`.apexcharts-series[rel='${e+1}']`),!l)return;a=parseInt(null!=(n=l.getAttribute("rel"))?n:"",10)-1}if(t?[{cs:r.globals.collapsedSeries,csi:r.globals.collapsedSeriesIndices},{cs:r.globals.ancillaryCollapsedSeries,csi:r.globals.ancillaryCollapsedSeriesIndices}].forEach(e=>{const t=e.cs,s=e.csi;this.riseCollapsedSeries(t,s,a)}):this.hideSeries({seriesEl:l,realIndex:a}),r.config.chart.accessibility.enabled){const t=r.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${e+1}"]`);if(t){const s=r.globals.collapsedSeriesIndices.includes(a)||r.globals.ancillaryCollapsedSeriesIndices.includes(a);t.setAttribute("aria-pressed",s?"true":"false");const i=t.querySelector(".apexcharts-legend-text"),n=i?i.textContent:r.seriesData.seriesNames[e],l=s?"hidden":"visible";t.setAttribute("aria-label",`${n}, ${l}. Press Enter or Space to toggle.`)}}}else{if(r.globals.resized=!0,r.globals.risingSeries=[],t)this.riseCollapsedSeries(r.globals.collapsedSeries,r.globals.collapsedSeriesIndices,e);else{const t=this.getSeriesAfterCollapsing({realIndex:e});this.lgCtx.updateSeries(t,r.config.chart.animations.dynamicAnimation.enabled)}if(r.config.chart.accessibility.enabled){const t=r.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${e+1}"]`);if(t){const s=r.globals.collapsedSeriesIndices.includes(e);t.setAttribute("aria-pressed",s?"true":"false");const i=t.querySelector(".apexcharts-legend-text"),n=i?i.textContent:r.seriesData.seriesNames[e],l=s?"hidden":"visible";t.setAttribute("aria-label",`${n}, ${l}. Press Enter or Space to toggle.`)}}}}_nonAxisSliceContainer(e){const t=this.w.config.chart.type;return("pie"===t||"donut"===t||"polarArea"===t||"sunburst"===t||"icicle"===t)&&1===e.length&&e[0]&&"object"==typeof e[0]&&Array.isArray(e[0].data)?e[0].data:e}_readSliceValue(e){return"unit"===this.w.config.chart.type&&e&&Array.isArray(e.data)?e.data:e&&"object"==typeof e?e.y:e}_writeSliceValue(e,t,s){const i=e[t];"unit"===this.w.config.chart.type&&i&&Array.isArray(i.data)?i.data=Array.isArray(s)?s:[]:i&&"object"==typeof i?i.y=s:e[t]=s}getSeriesAfterCollapsing({realIndex:e}){var t,s;const i=this.w,n=i.globals,r=f.clone(i.config.series);if(n.axisCharts){const t=i.config.yaxis[n.seriesYAxisReverseMap[e]],s={index:e,data:r[e].data.slice(),type:r[e].type||i.config.chart.type,name:(n.seriesNames||[])[e]};if(t&&t.show&&t.showAlways)n.ancillaryCollapsedSeriesIndices.indexOf(e)<0&&(n.ancillaryCollapsedSeries.push(s),n.ancillaryCollapsedSeriesIndices.push(e));else if(n.collapsedSeriesIndices.indexOf(e)<0){n.collapsedSeries.push(s),n.collapsedSeriesIndices.push(e);const t=n.risingSeries.indexOf(e);n.risingSeries.splice(t,1)}}else if(n.collapsedSeriesIndices.indexOf(e)<0){const l=this._nonAxisSliceContainer(r);n.collapsedSeries.push({index:e,data:this._readSliceValue(l[e]),type:null!=(s=null==(t=i.config.series[e])?void 0:t.type)?s:"line",name:(n.seriesNames||[])[e]}),n.collapsedSeriesIndices.push(e)}const l=n.axisCharts?i.config.series.length:this._nonAxisSliceContainer(r).length;return n.allSeriesCollapsed=n.collapsedSeries.length+n.ancillaryCollapsedSeries.length===l,this._getSeriesBasedOnCollapsedState(r)}hideSeries({seriesEl:e,realIndex:t}){const s=this.w,i=this.getSeriesAfterCollapsing({realIndex:t}),n=e.childNodes;for(let e=0;e<n.length;e++)n[e].classList.contains("apexcharts-series-markers-wrap")&&(n[e].classList.contains("apexcharts-hide")?n[e].classList.remove("apexcharts-hide"):n[e].classList.add("apexcharts-hide"));const r=s.config.chart.animations.dynamicAnimation.enabled;r&&(s.globals.collapsingSeriesIndices=[t]);const l=()=>{s.globals.collapsingSeriesIndices=[]},a=this.lgCtx.updateSeries(i,r);l(),a&&"function"==typeof a.then&&a.then(l,l)}riseCollapsedSeries(e,t,s){const i=this.w;let n=f.clone(i.config.series);if(e.length>0){for(let r=0;r<e.length;r++)if(e[r].index===s){if(i.globals.axisCharts)n[s].data=e[r].data.slice(),n[s].hidden=!1;else{const t=this._nonAxisSliceContainer(n);this._writeSliceValue(t,s,e[r].data)}e.splice(r,1),t.splice(r,1),i.globals.risingSeries.push(s),r--}n=this._getSeriesBasedOnCollapsedState(n);const r=this.lgCtx.updateSeries(n,i.config.chart.animations.dynamicAnimation.enabled),l=()=>{i.globals.risingSeries=[]};r&&"function"==typeof r.then?r.then(l,l):l()}}_getSeriesBasedOnCollapsedState(e){const t=this.w;let s=0;if(t.globals.axisCharts)e.forEach((i,n)=>{t.globals.collapsedSeriesIndices.indexOf(n)<0&&t.globals.ancillaryCollapsedSeriesIndices.indexOf(n)<0||(e[n].data=[],s++)});else{const i=this._nonAxisSliceContainer(e);i.forEach((e,n)=>{t.globals.collapsedSeriesIndices.indexOf(n)<0||(this._writeSliceValue(i,n,0),s++)})}const i=t.globals.axisCharts?e.length:this._nonAxisSliceContainer(e).length;return t.globals.allSeriesCollapsed=s===i,e}}const b=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,y=["#cf4d3f","#8f9499","#26a75b"],v=(e,t,s)=>e+(t-e)*s;function S(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function w(e,t,s){const i=f.parseHex(_(e)),n=f.parseHex(_(t));return i&&n?"#"+S(v(i[0],n[0],s))+S(v(i[1],n[1],s))+S(v(i[2],n[2],s)):e}function _(e){return"string"!=typeof e?"#000000":f.isColorHex(e)?e:f.rgb2hex(e)||"#000000"}function A(e,t,s,i){var n,r,l;if(!t||"object"!=typeof t)return null;const a=null==(l=null==(r=null==(n=e.config.plotOptions)?void 0:n.treemap)?void 0:r.colorScale)?void 0:l.colorValue;let o;if(o="function"==typeof a?a(t,{seriesIndex:s,dataPointIndex:i,w:e}):"string"==typeof a?t[a]:t.colorValue,null==o)return null;const c=Number(o);return Number.isFinite(c)?c:null}function C(e){var t,s,i;const n=null==(i=null==(s=null==(t=e.config)?void 0:t.plotOptions)?void 0:s.treemap)?void 0:i.colorScale,r=n&&n.gradient;if(!r)return null;if(!1===r.enabled)return null;const l=e.config.series||[];let a=1/0,o=-1/0,c=!1;for(let t=0;t<l.length;t++){const s=l[t]&&l[t].data;if(Array.isArray(s))for(let i=0;i<s.length;i++){const n=A(e,s[i],t,i);null!=n&&(c=!0,n<a&&(a=n),n>o&&(o=n))}}if(!c&&!0!==r.enabled)return null;Number.isFinite(a)||(a=0,o=0);let d=Number.isFinite(Number(r.min))?Number(r.min):a,h=Number.isFinite(Number(r.max))?Number(r.max):o,g=null;if(null===r.midpoint?g=null:Number.isFinite(Number(r.midpoint))?g=Number(r.midpoint):d<0&&h>0&&(g=0),null!=g&&!1!==r.symmetric&&!Number.isFinite(Number(r.min))&&!Number.isFinite(Number(r.max))){const e=Math.max(Math.abs(d-g),Math.abs(h-g));d=g-e,h=g+e}h===d&&(d-=.5,h+=.5);const p=function(e,t,s,i){if(Array.isArray(e.stops)&&e.stops.length>=2)return e.stops.filter(e=>e&&Number.isFinite(Number(e.value))).map(e=>({value:Number(e.value),color:_(e.color)})).sort((e,t)=>e.value-t.value);const n=(Array.isArray(e.colors)&&e.colors.length>=2?e.colors:y).map(_),r=n.length;if(null!=i&&r>=3){const e=Math.floor((r-1)/2),l=[];for(let s=0;s<=e;s++)l.push({value:v(t,i,s/e),color:n[s]});for(let t=e+1;t<r;t++)l.push({value:v(i,s,(t-e)/(r-1-e)),color:n[t]});return l}return n.map((e,i)=>({value:v(t,s,i/(r-1)),color:e}))}(r,d,h,g);if(p.length<2)return null;const u=h-d,f=p.map(e=>({percent:0===u?0:(e.value-d)/u,color:e.color}));return{min:d,max:h,midpoint:g,stops:p,at:e=>{if(!Number.isFinite(e))return p[Math.floor(p.length/2)].color;if(e<=p[0].value)return p[0].color;const t=p[p.length-1];if(e>=t.value)return t.color;for(let t=1;t<p.length;t++){const s=p[t];if(e<=s.value){const i=p[t-1],n=s.value-i.value,r=0===n?0:(e-i.value)/n;return w(i.color,s.color,r)}}return t.color},legendStops:f}}const L=globalThis.ApexCharts.__internals.__apex_tooltip_Utils,E="http://www.w3.org/2000/svg";class k{constructor(e,t){this.w=e,this.ctx=t,this.svgEl=null,this.arrowEl=null,this.hoverValueEl=null,this._min=0,this._max=0,this._geom=null,this._grad=null,this._bandHitEls=[],this._activeBandIndex=-1,this._targetEl=null,this.panelsW=null,this._onCellEnter=this._onCellEnter.bind(this),this._onCellLeave=this._onCellLeave.bind(this),this._onBandEnter=this._onBandEnter.bind(this),this._onBandLeave=this._onBandLeave.bind(this)}_getFormatter(){const e=this._cfg();return"function"==typeof e.formatter?e.formatter:e=>{if(!Number.isFinite(e))return String(e);const t=Math.abs(e);return t>=1e3?e.toFixed(0):t>=10?e.toFixed(1):e.toFixed(2)}}static colorScaleOf(e){var t,s,i,n,r;const l=null==(s=null==(t=null==e?void 0:e.config)?void 0:t.chart)?void 0:s.type;return l&&(null==(r=null==(n=null==(i=null==e?void 0:e.config)?void 0:i.plotOptions)?void 0:n[l])?void 0:r.colorScale)||null}static configFor(e){const t=k.colorScaleOf(e);return t&&t.gradientLegend||null}_cfg(){return k.configFor(this.w)||{}}static isEnabled(e){if(!k.supports(e))return!1;const t=k.configFor(e);return!(!t||!t.enabled)}static supports(e){var t,s;const i=null==(s=null==(t=null==e?void 0:e.config)?void 0:t.chart)?void 0:s.type;return"heatmap"===i||"treemap"===i}draw(e=null){var t,s,i,n,r,l,a,o;const c=this.w;this._targetEl=e;const d=e||c.dom.elLegendWrap;if(!d)return;const h=this._cfg(),g=c.config.legend.position,p="left"===g||"right"===g,u=null!=(s=null==(t=h.arrow)?void 0:t.size)?s:8,f=u+4,m=h.showLabels?28:4,x=h.showLabels?20:4,y=h.showLabels?44:0,v=this._resolveStripLength(p?h.height:h.width,p),S=h.thickness,w=p?Math.max(S+f+4,y):v+2*m,_=p?v+2*x:S+f+4,A=(w-(S+f))/2,C=p?"left"===g?A:A+f:m,L=p?x:"top"===g?f:4,k=b.createElementNS(E,"svg");k.setAttribute("class","apexcharts-heatmap-gradient-legend apexcharts-gradient-legend"),k.setAttribute("width",String(w)),k.setAttribute("height",String(_)),k.setAttribute("overflow","visible");const I=b.createElementNS(E,"defs"),F=`apexcharts-heatmap-gradient-${c.globals.cuid}`,H=b.createElementNS(E,"linearGradient");H.setAttribute("id",F),p?(H.setAttribute("x1","0"),H.setAttribute("y1","1"),H.setAttribute("x2","0"),H.setAttribute("y2","0")):(H.setAttribute("x1","0"),H.setAttribute("y1","0"),H.setAttribute("x2","1"),H.setAttribute("y2","0")),this._grad=H;const{min:N,max:M,bands:j}=this._paintStops();I.appendChild(H),k.appendChild(I);const T=b.createElementNS(E,"rect");if(T.setAttribute("x",String(C)),T.setAttribute("y",String(L)),T.setAttribute("width",String(p?S:v)),T.setAttribute("height",String(p?v:S)),T.setAttribute("rx","2"),T.setAttribute("fill",`url(#${F})`),k.appendChild(T),h.showLabels){const e=(null==(i=h.labelStyle)?void 0:i.colors)||(Array.isArray(c.config.legend.labels.colors)?c.config.legend.labels.colors[0]:c.config.legend.labels.colors)||c.config.chart.foreColor,t=(null==(n=h.labelStyle)?void 0:n.fontSize)||"11px",s=(null==(r=h.labelStyle)?void 0:r.fontFamily)||c.config.chart.fontFamily,l=this._getFormatter(),a=(i,n,r,l)=>{const a=b.createElementNS(E,"text");return a.setAttribute("x",String(n)),a.setAttribute("y",String(r)),a.setAttribute("text-anchor",l),a.setAttribute("dominant-baseline","middle"),a.setAttribute("fill",e),a.setAttribute("font-size",t),s&&a.setAttribute("font-family",s),a.textContent=String(i),a};if(p){const e=C+S/2;k.appendChild(a(l(N),e,L+v+10,"middle")),k.appendChild(a(l(M),e,L-10,"middle"))}else{const e=L+S/2;k.appendChild(a(l(N),C-6,e,"end")),k.appendChild(a(l(M),C+v+6,e,"start"))}}const O=(null==(l=h.arrow)?void 0:l.color)||c.config.chart.foreColor,B=this._buildArrow(u,O,g);if(k.appendChild(B),this.arrowEl=B,this._bandHitEls=[],c.config.legend.onItemHover.highlightDataSeries&&j.length>0&&j.forEach(e=>{const t=b.createElementNS(E,"rect");if(p){const s=L+v-e.p2*v,i=L+v-e.p1*v;t.setAttribute("x",String(C)),t.setAttribute("y",String(s)),t.setAttribute("width",String(S)),t.setAttribute("height",String(Math.max(0,i-s)))}else t.setAttribute("x",String(C+e.p1*v)),t.setAttribute("y",String(L)),t.setAttribute("width",String(Math.max(0,(e.p2-e.p1)*v))),t.setAttribute("height",String(S));t.setAttribute("fill","transparent"),t.setAttribute("class","apexcharts-heatmap-gradient-band"),t.setAttribute("data:range-index",String(e.index)),t.style.cursor="pointer",k.appendChild(t),this._bandHitEls.push(t)}),this._geom={isVertical:p,position:g,stripX:C,stripY:L,stripLength:v,stripThickness:S,arrowSize:u,svgWidth:w,svgHeight:_},h.showHoverValue){const e=b.createElement("div");e.classList.add("apexcharts-heatmap-gradient-legend-value"),e.style.position="absolute",e.style.fontSize=(null==(a=h.labelStyle)?void 0:a.fontSize)||"11px",e.style.fontFamily=(null==(o=h.labelStyle)?void 0:o.fontFamily)||c.config.chart.fontFamily||"",e.style.color=c.config.chart.foreColor,e.style.background="rgba(0,0,0,0.65)",e.style.color="#fff",e.style.padding="2px 6px",e.style.borderRadius="3px",e.style.pointerEvents="none",e.style.whiteSpace="nowrap",e.style.opacity="0",e.style.transition="opacity 120ms ease",this.hoverValueEl=e}d.classList.add("apexcharts-heatmap-gradient-legend-wrap"),d.classList.add("apx-legend-position-"+g),d.appendChild(k),this.hoverValueEl&&d.appendChild(this.hoverValueEl),this.svgEl=k,e?(d.style.width=w+"px",d.style.height=_+"px",d.style.position="relative",d.style.overflow="visible"):this._applyWrapAlignment(d,g,p,w,_),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(e,t){const s=this.w,i=t?s.globals.svgHeight||s.config.chart.height||300:s.globals.svgWidth||s.config.chart.width||600;if("string"==typeof e){const t=e.trim();if(t.endsWith("%")){const e=parseFloat(t)||0;return Math.max(20,i*e/100)}const s=parseFloat(t);return Number.isFinite(s)?s:200}return"number"==typeof e&&Number.isFinite(e)?e:200}_applyWrapAlignment(e,t,s,i,n){const r=this.w,l=this._cfg().align||"center",a=12,o=r.globals.svgWidth||r.config.chart.width||600,c=r.globals.svgHeight||r.config.chart.height||300,d=r.config.legend.offsetX||0,h=r.config.legend.offsetY||0;if(e.style.position="absolute",e.style.display="block",e.style.overflow="visible",e.style.padding="0",e.style.width=i+"px",e.style.height=n+"px",e.style.right="auto",e.style.bottom="auto",s){const s=c-n-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,s):a+Math.max(0,s)/2,e.style.top=r+h+"px",e.style.left="left"===t?a+d+"px":o-i-a+d+"px"}else{const s=o-i-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,s):a+Math.max(0,s)/2,e.style.left=r+d+"px",e.style.top="top"===t?a+h+"px":c-n-a+h+"px"}}repositionToPlot(){var e,t;if(this._grad&&this._paintStops(),!m.isBrowser())return;if(this._targetEl)return;const s=this.w,i=s.globals,n=s.dom.elLegendWrap;if(!n||!this._geom)return;if(!Number.isFinite(i.gridWidth)||!Number.isFinite(i.gridHeight))return;const{isVertical:r,position:l,svgWidth:a,svgHeight:o,stripX:c,stripY:d,stripThickness:h}=this._geom,g=this._cfg().align||"center",p=s.config.legend.offsetX||0,u=s.config.legend.offsetY||0,f=null==(t=null==(e=this.ctx)?void 0:e.dimensions)?void 0:t.dimHelpers,x=f?f.getTitleSubtitleCoords("title").height+f.getTitleSubtitleCoords("subtitle").height:0,y=s.layout.xAxisHeight||0,v=(e,t)=>{const s=Math.max(0,e-t);return"start"===g?0:"end"===g?s:s/2};if(r){n.style.top=i.translateY+v(i.gridHeight,o)+u+"px";const e=(("left"===l?0:i.translateX+i.gridWidth)+("left"===l?i.translateX:i.svgWidth))/2;n.style.left=e-c-h/2+p+"px"}else{n.style.left=i.translateX+v(i.gridWidth,a)+p+"px";const e=(("top"===l?x:i.translateY+i.gridHeight+y)+("top"===l?i.translateY:i.svgHeight))/2;n.style.top=e-d-h/2+u+"px"}b.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const e=this.w,t=e.dom.elLegendWrap,s=this.svgEl&&this.svgEl.querySelector("rect");if(!t||!s||!this._geom)return;if(!e.dom.baseEl||!e.dom.baseEl.querySelector(".apexcharts-svg"))return;const i=s.getBoundingClientRect(),n=L.plotRect(e);if(!(i.width&&i.height&&n.width&&n.height))return;const r=n.left,l=n.left+n.width,a=n.top,o=n.top+n.height,c=n.zoom,{isVertical:d,position:h}=this._geom;if(d){const e=("left"===h?r-i.right:i.left-l)/c;if(e<16){const s=parseFloat(t.style.left)||0,i=16-e;t.style.left=s+("left"===h?-i:i)+"px"}}else{const e=("top"===h?a-i.bottom:i.top-o)/c;if(e<16){const s=parseFloat(t.style.top)||0,i=16-e;t.style.top=s+("top"===h?-i:i)+"px"}}}destroy(){var e,t,s,i,n,r,l;for(let s=0;s<this._bandHitEls.length;s++){const i=this._bandHitEls[s];null==(e=i.removeEventListener)||e.call(i,"mousemove",this._onBandEnter),null==(t=i.removeEventListener)||t.call(i,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(s=this.ctx)?void 0:s.events)try{null==(n=(i=this.ctx.events).removeEventListener)||n.call(i,"dataPointMouseEnter",this._onCellEnter),null==(l=(r=this.ctx.events).removeEventListener)||l.call(r,"dataPointMouseLeave",this._onCellLeave)}catch(e){}}_attachBandHoverListeners(){if(m.isBrowser())for(let e=0;e<this._bandHitEls.length;e++){const t=this._bandHitEls[e];t.addEventListener("mousemove",this._onBandEnter),t.addEventListener("mouseout",this._onBandLeave)}}_onBandEnter(e){var t,s,i,n;const r=this.w,l=e.currentTarget,a=parseInt(null!=(t=l.getAttribute("data:range-index"))?t:"-1",10);a<0||a===this._activeBandIndex||(this._activeBandIndex=a,null==(n=null==(i=null==(s=this.ctx)?void 0:s.events)?void 0:i.fireEvent)||n.call(i,"legendHover",[this.ctx,a,r]),this._highlightRange(a,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const e=this._activeBandIndex;this._activeBandIndex=-1,this._highlightRange(e,"reset")}_highlightRange(e,t){var s;((null==(s=this.panelsW)?void 0:s.call(this))||[this.w]).forEach(s=>new u(s).highlightRangeInSeries(e,t))}_attachHoverListeners(){var e,t;m.isBrowser()&&(null==(t=null==(e=this.ctx)?void 0:e.events)?void 0:t.addEventListener)&&(this.ctx.events.addEventListener("dataPointMouseEnter",this._onCellEnter),this.ctx.events.addEventListener("dataPointMouseLeave",this._onCellLeave))}_onCellEnter(...e){var t,s,i;if(!this.arrowEl)return;const n=e[e.length-1];if(!n||"object"!=typeof n)return;const r=n.w||this.w,l=n.seriesIndex,a=n.dataPointIndex;if("number"!=typeof l||"number"!=typeof a)return;if(!k.supports(r))return;let o;o=this._continuous?function(e,t,s){const i=e.config.series[t];return A(e,i&&Array.isArray(i.data)?i.data[s]:null,t,s)}(r,l,a):null==(i=null==(s=null==(t=r.seriesData)?void 0:t.series)?void 0:s[l])?void 0:i[a],null==o||Number.isNaN(o)||this._positionArrow(o)}_onCellLeave(){this.arrowEl&&(this.arrowEl.setAttribute("opacity","0"),this.hoverValueEl&&(this.hoverValueEl.style.opacity="0"))}_positionArrow(e){if(!this.arrowEl||!this._geom)return;const{isVertical:t,position:s,stripX:i,stripY:n,stripLength:r,stripThickness:l,arrowSize:a}=this._geom,o=this._min,c=this._max-o;let d;if(d=0===c?.5:(e-o)/c,d<0&&(d=0),d>1&&(d=1),t){const e=n+r-d*r;let t,o;"left"===s?(t=i+l,o=t+a):(t=i,o=t-a);const c=[`${t},${e}`,`${o},${e-a/2}`,`${o},${e+a/2}`].join(" ");this.arrowEl.setAttribute("points",c)}else{const e=i+d*r;let t,o;"top"===s?(t=n+l,o=t+a):(t=n,o=t-a);const c=[`${e},${t}`,`${e-a/2},${o}`,`${e+a/2},${o}`].join(" ");this.arrowEl.setAttribute("points",c)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const o=this._getFormatter();if(this.hoverValueEl.textContent=o(e),t){const e=n+r-d*r;"left"===s?this.hoverValueEl.style.left=`${i+l+a+8}px`:(this.hoverValueEl.style.left=i-a-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=e-9+"px"}else{const e=i+d*r;this.hoverValueEl.style.left=`${e}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===s?`${n+l+a+8}px`:n-a-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(e,t,s){const i=b.createElementNS(E,"polygon");return i.setAttribute("fill",t),i.setAttribute("opacity","0"),i.setAttribute("class","apexcharts-heatmap-gradient-arrow"),i.setAttribute("points","0,0 0,0 0,0"),i.setAttribute("pointer-events","none"),i}_paintStops(){const e=this._computeStops(),t=this._grad;return this._min=e.min,this._max=e.max,t.innerHTML="",e.stops.forEach(e=>{const s=b.createElementNS(E,"stop");s.setAttribute("offset",`${(100*e.percent).toFixed(2)}%`),s.setAttribute("stop-color",e.color),t.appendChild(s)}),e}_computeStops(){var e,t;const s=this.w,i=k.colorScaleOf(s)||{},n=this._cfg(),r=C(s);if(r)return this._continuous=!0,{min:r.min,max:r.max,stops:r.legendStops,bands:[]};this._continuous=!1;let l=1/0,a=-1/0;const d=(null==(e=s.seriesData)?void 0:e.series)||[];for(let e=0;e<d.length;e++){const t=d[e];if(t)for(let e=0;e<t.length;e++){const s=t[e];null==s||Number.isNaN(s)||(s<l&&(l=s),s>a&&(a=s))}}Number.isFinite(l)||(l=0),Number.isFinite(a)||(a=0);let h=l,g=a;const p=void 0!==i.min&&void 0!==i.max&&i.max>i.min;p?(h=i.min,g=i.max):(void 0!==i.min&&(h=i.min<l?i.min:l),void 0!==i.max&&(g=i.max>a?i.max:a));const u=[],m=[];if(i.ranges&&i.ranges.length>0){const e=i.ranges.map((e,t)=>c(o({},e),{_originalIndex:t})).sort((e,t)=>e.from-t.from),t=e[0].from,s=e[e.length-1].to;h=t,g=s;const n=s-t||1;e.forEach(e=>{const s=(e.from-t)/n,i=(e.to-t)/n;u.push({percent:(s+i)/2,color:e.color}),m.push({index:e._originalIndex,p1:s,p2:i})})}else{const e=s.globals.colors[0]||"#008FFB",r=new f,l=s.config.chart.type,a=s.config.plotOptions[l]||{},o=null!=(t=a.shadeIntensity)?t:.5,c=s.globals,d=c.hasNegs,m="heatmap"===l&&!a.distributed&&!p&&c.maxY>=c.minY,x=m?c.maxY:g,b=Math.abs(x)+Math.abs(m?i.min<c.minY?i.min:c.minY:h),y=1.25*o,v=Math.max(2,n.stops||16);for(let t=0;t<v;t++){const i=t/(v-1),n=0===b?0:Math.min(h+i*(g-h),x)/b,c=Math.max(-1,Math.min(1,d?a.reverseNegativeShade?(n<0?n:1-n)*y:n<=0?1-(1+n)*o:(1-n)*o:(1-n)*("treemap"===l?y:1))),p=a.enableShades?r.shadeColor("dark"===s.config.theme.mode?-c:c,e):e;u.push({percent:i,color:p})}}return{min:h,max:g,stops:u,bands:m}}}const I=globalThis.ApexCharts.__internals.__apex_Markers;function F(e){return e.classList.contains("apexcharts-legend-series")||e.classList.contains("apexcharts-legend-text")||e.classList.contains("apexcharts-legend-marker")}d.registerFeatures({legend:class{constructor(e,t){this.w=e,this.ctx=t,this.updateSeries=(...e)=>t.updateHelpers._updateSeries(...e),this.onLegendClick=this.onLegendClick.bind(this),this.onLegendHovered=this.onLegendHovered.bind(this),this.onLegendClickEvent=this.onLegendClickEvent.bind(this),this.onLegendPointerDown=this.onLegendPointerDown.bind(this),this.onLegendPointerUp=this.onLegendPointerUp.bind(this),this.legendPress=null,this.recoveredRel=null,this.isBarsDistributed="bar"===this.w.config.chart.type&&this.w.config.plotOptions.bar.distributed&&1===this.w.config.series.length,this.legendHelpers=new x(this)}init(){var e;const t=this.w,s=t.globals,i=t.config;null==(e=this.heatmapGradientLegend)||e.destroy(),this.heatmapGradientLegend=null,this.isBarsDistributed="bar"===i.chart.type&&i.plotOptions.bar.distributed&&1===i.series.length;const n=i.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||"heatmap"===i.chart.type||k.isEnabled(t)||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(n||!s.axisCharts)&&i.legend.show){const e=t.dom.elLegendWrap;for(;e.firstChild;)e.removeChild(e.firstChild);k.isEnabled(t)?(this.heatmapGradientLegend=new k(t,this.ctx),this.heatmapGradientLegend.draw()):(this.drawLegends(),"bottom"===i.legend.position||"top"===i.legend.position?this.legendAlignHorizontal():"right"!==i.legend.position&&"left"!==i.legend.position||this.legendAlignVertical())}}createLegendMarker({i:e,fillcolor:t}){const s=this.w,i=b.createElement("span");i.classList.add("apexcharts-legend-marker");const n=s.config.legend.markers.shape||s.config.markers.shape;let r=n;Array.isArray(n)&&(r=n[e]);const l=Array.isArray(s.config.legend.markers.size)?parseFloat(s.config.legend.markers.size[e]):parseFloat(s.config.legend.markers.size),a=Array.isArray(s.config.legend.markers.offsetX)?parseFloat(s.config.legend.markers.offsetX[e]):parseFloat(s.config.legend.markers.offsetX),d=Array.isArray(s.config.legend.markers.offsetY)?parseFloat(s.config.legend.markers.offsetY[e]):parseFloat(s.config.legend.markers.offsetY),h=Array.isArray(s.config.legend.markers.strokeWidth)?parseFloat(s.config.legend.markers.strokeWidth[e]):parseFloat(s.config.legend.markers.strokeWidth),g=i.style;if(g.height=2*(l+h)+"px",g.width=2*(l+h)+"px",g.left=a+"px",g.top=d+"px",s.config.legend.markers.customHTML)g.background="transparent",g.color=t[e],Array.isArray(s.config.legend.markers.customHTML)?s.config.legend.markers.customHTML[e]&&(i.innerHTML=s.config.legend.markers.customHTML[e]()):i.innerHTML=s.config.legend.markers.customHTML();else{const s=new I(this.ctx.w,this.ctx).getMarkerConfig({cssClass:`apexcharts-legend-marker apexcharts-marker apexcharts-marker-${r}`,seriesIndex:e,strokeWidth:h,size:l}),n=(m.isBrowser()?window.SVG:global.SVG)().addTo(i).size("100%","100%"),a=new p(this.w).drawMarker(0,0,c(o({},s),{pointFillColor:Array.isArray(t)?t[e]:s.pointFillColor,shape:r}));a.node.style.transform="triangle"===r?"translate(50%, 45%)":"translate(50%, 50%)",n.add(a)}return i}drawLegends(){var e;const t=this,s=this.w,i=s.dom.elLegendWrap,n=s.config.legend.fontFamily;let r=s.seriesData.seriesNames,l=s.config.legend.markers.fillColors?s.config.legend.markers.fillColors.slice():s.globals.colors.slice();if("heatmap"===s.config.chart.type){const e=s.config.plotOptions.heatmap.colorScale.ranges;r=e.map(e=>e.name?e.name:e.from+" - "+e.to),l=e.map(e=>e.color)}else this.isBarsDistributed&&(r=s.labelData.labels.slice());s.config.legend.customLegendItems.length&&(r=s.config.legend.customLegendItems);const a=s.formatters.legendFormatter,o=s.config.legend.inverseOrder,c=[];s.labelData.seriesGroups.length>1&&s.config.legend.clusterGroupedSeries&&s.labelData.seriesGroups.forEach((e,t)=>{c[t]=b.createElement("div"),c[t].classList.add("apexcharts-legend-group",`apexcharts-legend-group-${t}`),"horizontal"===s.config.legend.clusterGroupedSeriesOrientation?i.classList.add("apexcharts-legend-group-horizontal"):c[t].classList.add("apexcharts-legend-group-vertical")});for(let t=o?r.length-1:0;o?t>=0:t<=r.length-1;o?t--:t++){const o=a(r[t],{seriesIndex:t,w:s});let d=!1,g=!1;if(s.globals.collapsedSeries.length>0)for(let e=0;e<s.globals.collapsedSeries.length;e++)s.globals.collapsedSeries[e].index===t&&(d=!0);if(s.globals.ancillaryCollapsedSeriesIndices.length>0)for(let e=0;e<s.globals.ancillaryCollapsedSeriesIndices.length;e++)s.globals.ancillaryCollapsedSeriesIndices[e]===t&&(g=!0);const u=this.createLegendMarker({i:t,fillcolor:l});p.setAttrs(u,{rel:t+1,"data:collapsed":d||g}),(d||g)&&u.classList.add("apexcharts-inactive-legend");const m=b.createElement("div");if(s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled){m.setAttribute("role","button"),m.setAttribute("tabindex","0");const e=Array.isArray(o)?o.join(" "):o,t=d||g,s=t?"hidden":"visible";m.setAttribute("aria-label",`${e}, ${s}. Press Enter or Space to toggle.`),m.setAttribute("aria-pressed",t?"true":"false")}const x=b.createElement("span");x.classList.add("apexcharts-legend-text"),x.innerHTML=Array.isArray(o)?o.join(" "):o;let y=s.config.legend.labels.useSeriesColors?s.globals.colors[t]:Array.isArray(s.config.legend.labels.colors)?null==(e=s.config.legend.labels.colors)?void 0:e[t]:s.config.legend.labels.colors;y||(y=s.config.chart.foreColor),x.style.color=y,x.style.fontSize=s.config.legend.fontSize,x.style.fontWeight=s.config.legend.fontWeight,x.style.fontFamily=n||s.config.chart.fontFamily,p.setAttrs(x,{rel:t+1,i:t,"data:default-text":encodeURIComponent(o),"data:collapsed":d||g}),m.appendChild(u),m.appendChild(x);const v=new h(this.w);s.config.legend.showForZeroSeries||0===v.getSeriesTotalByIndex(t)&&v.seriesHaveSameValues(t)&&!v.isSeriesNull(t)&&-1===s.globals.collapsedSeriesIndices.indexOf(t)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(t)&&m.classList.add("apexcharts-hidden-zero-series"),s.config.legend.showForNullSeries||v.isSeriesNull(t)&&-1===s.globals.collapsedSeriesIndices.indexOf(t)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(t)&&m.classList.add("apexcharts-hidden-null-series");const S=c[s.labelData.seriesGroupIndex[t]];S&&!S.parentNode&&i.appendChild(S),(S||i).appendChild(m),i.classList.add(`apexcharts-align-${s.config.legend.horizontalAlign}`),i.classList.add("apx-legend-position-"+s.config.legend.position),m.classList.add("apexcharts-legend-series"),m.style.margin=`${s.config.legend.itemMargin.vertical}px ${s.config.legend.itemMargin.horizontal}px`,i.style.width=s.config.legend.width?s.config.legend.width+"px":"",i.style.height=s.config.legend.height?s.config.legend.height+"px":"",p.setAttrs(m,{rel:t+1,seriesName:f.escapeString(r[t]),"data:collapsed":d||g}),(d||g)&&m.classList.add("apexcharts-inactive-legend"),s.config.legend.onItemClick.toggleDataSeries||m.classList.add("apexcharts-no-click")}s.dom.elWrap.addEventListener("click",t.onLegendClickEvent,!0),s.dom.elWrap.addEventListener("pointerdown",t.onLegendPointerDown,!0),s.dom.elWrap.addEventListener("pointerup",t.onLegendPointerUp,!0),s.config.legend.onItemHover.highlightDataSeries&&0===s.config.legend.customLegendItems.length&&(s.dom.elWrap.addEventListener("mousemove",t.onLegendHovered,!0),s.dom.elWrap.addEventListener("mouseout",t.onLegendHovered,!0)),s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled&&s.dom.elWrap.addEventListener("keydown",t.onLegendKeyDown.bind(t),!0)}setLegendWrapXY(e,t){const s=this.w,i=s.dom.elLegendWrap,n=i.clientHeight;let r=0,l=0;if("bottom"===s.config.legend.position)l=s.globals.svgHeight-Math.min(n,s.globals.svgHeight/2)-5;else if("top"===s.config.legend.position){const e=new g(this.w,this.ctx),t=e.dimHelpers.getTitleSubtitleCoords("title").height,s=e.dimHelpers.getTitleSubtitleCoords("subtitle").height;l=(t>0?t-10:0)+(s>0?s-10:0)}i.style.position="absolute",r=r+e+s.config.legend.offsetX,l=l+t+s.config.legend.offsetY,i.style.left=r+"px",i.style.top=l+"px","right"===s.config.legend.position&&(i.style.left="auto",i.style.right=25+s.config.legend.offsetX+"px"),["width","height"].forEach(e=>{i&&i.style[e]&&(i.style[e]=parseInt(String(s.config.legend[e]),10)+"px")})}legendAlignHorizontal(){const e=this.w;e.dom.elLegendWrap.style.right="0";const t=new g(this.w,this.ctx),s=t.dimHelpers.getTitleSubtitleCoords("title"),i=t.dimHelpers.getTitleSubtitleCoords("subtitle");let n=0;"top"===e.config.legend.position&&(n=s.height+i.height+e.config.title.margin+e.config.subtitle.margin-10),this.setLegendWrapXY(20,n)}legendAlignVertical(){this.setLegendWrapXY("left"===this.w.config.legend.position?20:0,20)}onLegendHovered(e){var t;const s=this.w,i=e.target,n=F(i);if("heatmap"===s.config.chart.type||this.isBarsDistributed){if(n){const s=parseInt(null!=(t=i.getAttribute("rel"))?t:"0",10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,s,this.w]);const n=new u(this.ctx.w);"mousemove"===e.type?n.highlightRangeInSeries(s,"highlight"):"mouseout"===e.type&&n.highlightRangeInSeries(s,"reset")}}else n&&!i.closest(".apexcharts-inactive-legend")&&new u(this.ctx.w).toggleSeriesOnHover(e,i)}onLegendKeyDown(e){const t=this,s=this.w,i=e.target;if(F(i)&&("Enter"===e.key||" "===e.key)){e.preventDefault();const n=i.getAttribute("rel");t.onLegendClick(e),null!==n&&s.config.legend.onItemClick.toggleDataSeries&&requestAnimationFrame(()=>{var e;const t=null==(e=s.dom.baseEl)?void 0:e.querySelector(`.apexcharts-legend-series[rel="${n}"]`);t&&t.focus()})}}onLegendPointerDown(e){const t=e.target;this.recoveredRel=null,this.legendPress=0===e.button&&F(t)?{el:t,rel:t.getAttribute("rel")}:null}onLegendPointerUp(e){const t=this.legendPress;this.legendPress=null;const s=e.target;t&&!t.el.isConnected&&F(s)&&s.getAttribute("rel")===t.rel&&(this.recoveredRel=t.rel,this.onLegendClick(e))}onLegendClickEvent(e){const t=this.recoveredRel;this.recoveredRel=null;const s=e.target;null!==t&&e.isTrusted&&s.getAttribute("rel")===t||this.onLegendClick(e)}onLegendClick(e){var t;const s=this.w,i=e.target;if(!s.config.legend.customLegendItems.length&&F(i)){const e=parseInt(null!=(t=i.getAttribute("rel"))?t:"0",10)-1,n="true"===i.getAttribute("data:collapsed"),r=this.w.config.chart.events.legendClick;"function"==typeof r&&r(this.ctx,e,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,e,this.w]);const l=this.w.config.legend.markers.onClick;"function"==typeof l&&i.classList.contains("apexcharts-legend-marker")&&(l(this.ctx,e,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,e,this.w])),"treemap"!==s.config.chart.type&&"heatmap"!==s.config.chart.type&&!this.isBarsDistributed&&s.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(e,n)}}}}),e.default=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexLegend={})});
|
|
5
|
+
!function(e){var t="undefined"!=typeof globalThis?globalThis:self,s=t.ApexCharts;if(s&&s.__internals)return e.call(t);if(s)throw new Error("ApexCharts: dist/features/legend.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return e.call(t);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/legend.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var i={file:"dist/features/legend.js",run:e,done:!1},n=t.__apexcharts_pending_addons__||(t.__apexcharts_pending_addons__=[]);n.push(i),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!i.done){var s=t.ApexCharts;if(s)if(s.__internals){i.done=!0;var r=n.indexOf(i);-1!==r&&n.splice(r,1);try{e.call(t),s.__drainsAddons||t.console.warn("ApexCharts: dist/features/legend.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(e){t.console.error("ApexCharts: dist/features/legend.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/legend.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else t.console.warn("ApexCharts: dist/features/legend.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var e,t;e=this,t=function(e){"use strict";var t=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i,o=(e,t)=>{for(var s in t||(t={}))r.call(t,s)&&a(e,s,t[s]);if(n)for(var s of n(t))l.call(t,s)&&a(e,s,t[s]);return e},c=(e,t)=>s(e,i(t));const d=globalThis.ApexCharts,h=globalThis.ApexCharts.__internals.__apex_CoreUtils,g=globalThis.ApexCharts.__internals.__apex_dimensions_Dimensions,p=globalThis.ApexCharts.__internals.__apex_Graphics,u=globalThis.ApexCharts.__internals.__apex_Series,f=globalThis.ApexCharts.__internals.__apex_Utils,x=globalThis.ApexCharts.__internals.__apex_Environment_Environment;class m{constructor(e){this.w=e.w,this.lgCtx=e}getLegendStyles(){if(x.isSSR())return null;const e=document.createElement("style");e.setAttribute("type","text/css");const t=this.w.config.chart.nonce;t&&e.setAttribute("nonce",t);const s=document.createTextNode(".apexcharts-flip-y{transform:scaleY(-1) translateY(-100%);transform-origin:top;transform-box:fill-box}.apexcharts-flip-x{transform:scaleX(-1);transform-origin:center;transform-box:fill-box}.apexcharts-legend{display:flex;overflow:auto;padding:0 10px}.apexcharts-legend.apexcharts-legend-group-horizontal{flex-direction:column}.apexcharts-legend-group{display:flex}.apexcharts-legend-group-vertical{flex-direction:column-reverse}.apexcharts-legend.apx-legend-position-bottom,.apexcharts-legend.apx-legend-position-top{flex-wrap:wrap}.apexcharts-legend.apx-legend-position-right,.apexcharts-legend.apx-legend-position-left{flex-direction:column;bottom:0}.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left,.apexcharts-legend.apx-legend-position-top.apexcharts-align-left,.apexcharts-legend.apx-legend-position-right,.apexcharts-legend.apx-legend-position-left{justify-content:flex-start;align-items:flex-start}.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center,.apexcharts-legend.apx-legend-position-top.apexcharts-align-center{justify-content:center;align-items:center}.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right,.apexcharts-legend.apx-legend-position-top.apexcharts-align-right{justify-content:flex-end;align-items:flex-end}.apexcharts-legend-series{cursor:pointer;line-height:normal;display:flex;align-items:center}.apexcharts-legend-text{position:relative;font-size:14px}.apexcharts-legend-text *,.apexcharts-legend-marker *{pointer-events:none}.apexcharts-legend-marker{position:relative;display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:1px}.apexcharts-legend-series.apexcharts-no-click{cursor:auto}.apexcharts-legend .apexcharts-hidden-zero-series,.apexcharts-legend .apexcharts-hidden-null-series{display:none!important}.apexcharts-inactive-legend{opacity:.45}");return e.appendChild(s),e}getLegendDimensions(){const e=this.w.dom.baseEl.querySelector(".apexcharts-legend");if(!e)return{clwh:0,clww:0};const{width:t,height:s}=e.getBoundingClientRect();return{clwh:s,clww:t}}appendToForeignObject(){var e;const t=this.getLegendStyles();!1!==this.w.config.chart.injectStyleSheet&&t&&(null==(e=this.w.dom.elLegendForeign)||e.appendChild(t))}toggleDataSeries(e,t){var s,i,n;const r=this.w;if(r.dom.baseEl)if(r.globals.axisCharts||"radialBar"===r.config.chart.type){r.globals.resized=!0;let l=null,a=null;if(r.globals.risingSeries=[],r.globals.axisCharts){if(l=null!=(s=Array.prototype.find.call(r.dom.baseEl.querySelectorAll(".apexcharts-series"),t=>t.getAttribute("data:realIndex")===String(e)))?s:null,!l)return;a=parseInt(null!=(i=l.getAttribute("data:realIndex"))?i:"",10)}else{if(l=r.dom.baseEl.querySelector(`.apexcharts-series[rel='${e+1}']`),!l)return;a=parseInt(null!=(n=l.getAttribute("rel"))?n:"",10)-1}if(t?[{cs:r.globals.collapsedSeries,csi:r.globals.collapsedSeriesIndices},{cs:r.globals.ancillaryCollapsedSeries,csi:r.globals.ancillaryCollapsedSeriesIndices}].forEach(e=>{const t=e.cs,s=e.csi;this.riseCollapsedSeries(t,s,a)}):this.hideSeries({seriesEl:l,realIndex:a}),r.config.chart.accessibility.enabled){const t=r.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${e+1}"]`);if(t){const s=r.globals.collapsedSeriesIndices.includes(a)||r.globals.ancillaryCollapsedSeriesIndices.includes(a);t.setAttribute("aria-pressed",s?"true":"false");const i=t.querySelector(".apexcharts-legend-text"),n=i?i.textContent:r.seriesData.seriesNames[e],l=s?"hidden":"visible";t.setAttribute("aria-label",`${n}, ${l}. Press Enter or Space to toggle.`)}}}else{if(r.globals.resized=!0,r.globals.risingSeries=[],t)this.riseCollapsedSeries(r.globals.collapsedSeries,r.globals.collapsedSeriesIndices,e);else{const t=this.getSeriesAfterCollapsing({realIndex:e});this.lgCtx.updateSeries(t,r.config.chart.animations.dynamicAnimation.enabled)}if(r.config.chart.accessibility.enabled){const t=r.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${e+1}"]`);if(t){const s=r.globals.collapsedSeriesIndices.includes(e);t.setAttribute("aria-pressed",s?"true":"false");const i=t.querySelector(".apexcharts-legend-text"),n=i?i.textContent:r.seriesData.seriesNames[e],l=s?"hidden":"visible";t.setAttribute("aria-label",`${n}, ${l}. Press Enter or Space to toggle.`)}}}}_nonAxisSliceContainer(e){const t=this.w.config.chart.type;return("pie"===t||"donut"===t||"polarArea"===t||"sunburst"===t||"icicle"===t)&&1===e.length&&e[0]&&"object"==typeof e[0]&&Array.isArray(e[0].data)?e[0].data:e}_readSliceValue(e){return"unit"===this.w.config.chart.type&&e&&Array.isArray(e.data)?e.data:e&&"object"==typeof e?e.y:e}_writeSliceValue(e,t,s){const i=e[t];"unit"===this.w.config.chart.type&&i&&Array.isArray(i.data)?i.data=Array.isArray(s)?s:[]:i&&"object"==typeof i?i.y=s:e[t]=s}getSeriesAfterCollapsing({realIndex:e}){var t,s;const i=this.w,n=i.globals,r=n.axisCharts?f.copySeriesShallow(i.config.series):f.clone(i.config.series);if(n.axisCharts){const t=i.config.yaxis[n.seriesYAxisReverseMap[e]],s={index:e,data:r[e].data.slice(),type:r[e].type||i.config.chart.type,name:(n.seriesNames||[])[e]};if(t&&t.show&&t.showAlways)n.ancillaryCollapsedSeriesIndices.indexOf(e)<0&&(n.ancillaryCollapsedSeries.push(s),n.ancillaryCollapsedSeriesIndices.push(e));else if(n.collapsedSeriesIndices.indexOf(e)<0){n.collapsedSeries.push(s),n.collapsedSeriesIndices.push(e);const t=n.risingSeries.indexOf(e);n.risingSeries.splice(t,1)}}else if(n.collapsedSeriesIndices.indexOf(e)<0){const l=this._nonAxisSliceContainer(r);n.collapsedSeries.push({index:e,data:this._readSliceValue(l[e]),type:null!=(s=null==(t=i.config.series[e])?void 0:t.type)?s:"line",name:(n.seriesNames||[])[e]}),n.collapsedSeriesIndices.push(e)}const l=n.axisCharts?i.config.series.length:this._nonAxisSliceContainer(r).length;return n.allSeriesCollapsed=n.collapsedSeries.length+n.ancillaryCollapsedSeries.length===l,this._getSeriesBasedOnCollapsedState(r)}hideSeries({seriesEl:e,realIndex:t}){const s=this.w,i=this.getSeriesAfterCollapsing({realIndex:t}),n=e.childNodes;for(let e=0;e<n.length;e++)n[e].classList.contains("apexcharts-series-markers-wrap")&&(n[e].classList.contains("apexcharts-hide")?n[e].classList.remove("apexcharts-hide"):n[e].classList.add("apexcharts-hide"));const r=s.config.chart.animations.dynamicAnimation.enabled;r&&(s.globals.collapsingSeriesIndices=[t]);const l=()=>{s.globals.collapsingSeriesIndices=[]},a=this.lgCtx.updateSeries(i,r);l(),a&&"function"==typeof a.then&&a.then(l,l)}riseCollapsedSeries(e,t,s){const i=this.w;let n=f.clone(i.config.series);if(e.length>0){for(let r=0;r<e.length;r++)if(e[r].index===s){if(i.globals.axisCharts)n[s].data=e[r].data.slice(),n[s].hidden=!1;else{const t=this._nonAxisSliceContainer(n);this._writeSliceValue(t,s,e[r].data)}e.splice(r,1),t.splice(r,1),i.globals.risingSeries.push(s),r--}n=this._getSeriesBasedOnCollapsedState(n);const r=this.lgCtx.updateSeries(n,i.config.chart.animations.dynamicAnimation.enabled),l=()=>{i.globals.risingSeries=[]};r&&"function"==typeof r.then?r.then(l,l):l()}}_getSeriesBasedOnCollapsedState(e){const t=this.w;let s=0;if(t.globals.axisCharts)e.forEach((i,n)=>{t.globals.collapsedSeriesIndices.indexOf(n)<0&&t.globals.ancillaryCollapsedSeriesIndices.indexOf(n)<0||(e[n].data=[],s++)});else{const i=this._nonAxisSliceContainer(e);i.forEach((e,n)=>{t.globals.collapsedSeriesIndices.indexOf(n)<0||(this._writeSliceValue(i,n,0),s++)})}const i=t.globals.axisCharts?e.length:this._nonAxisSliceContainer(e).length;return t.globals.allSeriesCollapsed=s===i,e}}const b=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,y=["#cf4d3f","#8f9499","#26a75b"],v=(e,t,s)=>e+(t-e)*s;function S(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function w(e,t,s){const i=f.parseHex(A(e)),n=f.parseHex(A(t));return i&&n?"#"+S(v(i[0],n[0],s))+S(v(i[1],n[1],s))+S(v(i[2],n[2],s)):e}function A(e){return"string"!=typeof e?"#000000":f.isColorHex(e)?e:f.rgb2hex(e)||"#000000"}function _(e,t,s,i){var n,r,l;if(!t||"object"!=typeof t)return null;const a=null==(l=null==(r=null==(n=e.config.plotOptions)?void 0:n.treemap)?void 0:r.colorScale)?void 0:l.colorValue;let o;if(o="function"==typeof a?a(t,{seriesIndex:s,dataPointIndex:i,w:e}):"string"==typeof a?t[a]:t.colorValue,null==o)return null;const c=Number(o);return Number.isFinite(c)?c:null}function C(e){var t,s,i;const n=null==(i=null==(s=null==(t=e.config)?void 0:t.plotOptions)?void 0:s.treemap)?void 0:i.colorScale,r=n&&n.gradient;if(!r)return null;if(!1===r.enabled)return null;const l=e.config.series||[];let a=1/0,o=-1/0,c=!1;for(let t=0;t<l.length;t++){const s=l[t]&&l[t].data;if(Array.isArray(s))for(let i=0;i<s.length;i++){const n=_(e,s[i],t,i);null!=n&&(c=!0,n<a&&(a=n),n>o&&(o=n))}}if(!c&&!0!==r.enabled)return null;Number.isFinite(a)||(a=0,o=0);const d=e=>Number.isFinite(Number(e))?Number(e):null,h=d(r.min),g=d(r.max);let p=null!=h?h:a,u=null!=g?g:o,f=null;if(null===r.midpoint?f=null:Number.isFinite(Number(r.midpoint))?f=Number(r.midpoint):p<0&&u>0&&(f=0),null!=f&&!1!==r.symmetric&&null==h&&null==g){const e=Math.max(Math.abs(p-f),Math.abs(u-f));p=f-e,u=f+e}u===p&&(p-=.5,u+=.5);const x=Array.isArray(r.stops)&&r.stops.length>=2,m=function(e,t,s,i,n){if(n)return e.stops.filter(e=>e&&Number.isFinite(Number(e.value))).map(e=>({value:Number(e.value),color:A(e.color)})).sort((e,t)=>e.value-t.value);const r=(Array.isArray(e.colors)&&e.colors.length>=2?e.colors:y).map(A),l=r.length;if(null!=i&&l>=3){const e=Math.floor((l-1)/2),n=[];for(let s=0;s<=e;s++)n.push({value:v(t,i,s/e),color:r[s]});for(let t=e+1;t<l;t++)n.push({value:v(i,s,(t-e)/(l-1-e)),color:r[t]});return n}return r.map((e,i)=>({value:v(t,s,i/(l-1)),color:e}))}(r,p,u,f,x);if(m.length<2)return null;x&&(null==h&&(p=Math.min(p,m[0].value)),null==g&&(u=Math.max(u,m[m.length-1].value)));const b=e=>{if(!Number.isFinite(e))return m[Math.floor(m.length/2)].color;if(e<=m[0].value)return m[0].color;const t=m[m.length-1];if(e>=t.value)return t.color;for(let t=1;t<m.length;t++){const s=m[t];if(e<=s.value){const i=m[t-1],n=s.value-i.value,r=0===n?0:(e-i.value)/n;return w(i.color,s.color,r)}}return t.color},S=u-p,C=m.map(e=>{const t=Math.min(u,Math.max(p,e.value));return{percent:S&&(t-p)/S,color:t===e.value?e.color:b(t)}});return{min:p,max:u,midpoint:f,stops:m,at:b,legendStops:C}}const L=globalThis.ApexCharts.__internals.__apex_tooltip_Utils,E="http://www.w3.org/2000/svg";class k{constructor(e,t){this.w=e,this.ctx=t,this.svgEl=null,this.arrowEl=null,this.hoverValueEl=null,this._min=0,this._max=0,this._geom=null,this._grad=null,this._bandHitEls=[],this._activeBandIndex=-1,this._targetEl=null,this.panelsW=null,this._onCellEnter=this._onCellEnter.bind(this),this._onCellLeave=this._onCellLeave.bind(this),this._onBandEnter=this._onBandEnter.bind(this),this._onBandLeave=this._onBandLeave.bind(this)}_getFormatter(){const e=this._cfg();return"function"==typeof e.formatter?e.formatter:e=>{if(!Number.isFinite(e))return String(e);const t=Math.abs(e);return t>=1e3?e.toFixed(0):t>=10?e.toFixed(1):e.toFixed(2)}}static colorScaleOf(e){var t,s,i,n,r;const l=null==(s=null==(t=null==e?void 0:e.config)?void 0:t.chart)?void 0:s.type;return l&&(null==(r=null==(n=null==(i=null==e?void 0:e.config)?void 0:i.plotOptions)?void 0:n[l])?void 0:r.colorScale)||null}static configFor(e){const t=k.colorScaleOf(e);return t&&t.gradientLegend||null}_cfg(){return k.configFor(this.w)||{}}static isEnabled(e){if(!k.supports(e))return!1;const t=k.configFor(e);return!(!t||!t.enabled)}static supports(e){var t,s;const i=null==(s=null==(t=null==e?void 0:e.config)?void 0:t.chart)?void 0:s.type;return"heatmap"===i||"treemap"===i}draw(e=null){var t,s,i,n,r,l,a,o;const c=this.w;this._targetEl=e;const d=e||c.dom.elLegendWrap;if(!d)return;const h=this._cfg(),g=c.config.legend.position,p="left"===g||"right"===g,u=null!=(s=null==(t=h.arrow)?void 0:t.size)?s:8,f=u+4,x=h.showLabels?28:4,m=h.showLabels?20:4,y=h.showLabels?44:0,v=this._resolveStripLength(p?h.height:h.width,p),S=h.thickness,w=p?Math.max(S+f+4,y):v+2*x,A=p?v+2*m:S+f+4,_=(w-(S+f))/2,C=p?"left"===g?_:_+f:x,L=p?m:"top"===g?f:4,k=b.createElementNS(E,"svg");k.setAttribute("class","apexcharts-heatmap-gradient-legend apexcharts-gradient-legend"),k.setAttribute("width",String(w)),k.setAttribute("height",String(A)),k.setAttribute("overflow","visible");const I=b.createElementNS(E,"defs"),H=`apexcharts-heatmap-gradient-${c.globals.cuid}`,F=b.createElementNS(E,"linearGradient");F.setAttribute("id",H),p?(F.setAttribute("x1","0"),F.setAttribute("y1","1"),F.setAttribute("x2","0"),F.setAttribute("y2","0")):(F.setAttribute("x1","0"),F.setAttribute("y1","0"),F.setAttribute("x2","1"),F.setAttribute("y2","0")),this._grad=F;const{min:M,max:N,bands:j}=this._paintStops();I.appendChild(F),k.appendChild(I);const T=b.createElementNS(E,"rect");if(T.setAttribute("x",String(C)),T.setAttribute("y",String(L)),T.setAttribute("width",String(p?S:v)),T.setAttribute("height",String(p?v:S)),T.setAttribute("rx","2"),T.setAttribute("fill",`url(#${H})`),k.appendChild(T),h.showLabels){const e=(null==(i=h.labelStyle)?void 0:i.colors)||(Array.isArray(c.config.legend.labels.colors)?c.config.legend.labels.colors[0]:c.config.legend.labels.colors)||c.config.chart.foreColor,t=(null==(n=h.labelStyle)?void 0:n.fontSize)||"11px",s=(null==(r=h.labelStyle)?void 0:r.fontFamily)||c.config.chart.fontFamily,l=this._getFormatter(),a=(i,n,r,l)=>{const a=b.createElementNS(E,"text");return a.setAttribute("x",String(n)),a.setAttribute("y",String(r)),a.setAttribute("text-anchor",l),a.setAttribute("dominant-baseline","middle"),a.setAttribute("fill",e),a.setAttribute("font-size",t),s&&a.setAttribute("font-family",s),a.textContent=String(i),a};if(p){const e=C+S/2;k.appendChild(a(l(M),e,L+v+10,"middle")),k.appendChild(a(l(N),e,L-10,"middle"))}else{const e=L+S/2;k.appendChild(a(l(M),C-6,e,"end")),k.appendChild(a(l(N),C+v+6,e,"start"))}}const O=(null==(l=h.arrow)?void 0:l.color)||c.config.chart.foreColor,B=this._buildArrow(u,O,g);if(k.appendChild(B),this.arrowEl=B,this._bandHitEls=[],c.config.legend.onItemHover.highlightDataSeries&&j.length>0&&j.forEach(e=>{const t=b.createElementNS(E,"rect");if(p){const s=L+v-e.p2*v,i=L+v-e.p1*v;t.setAttribute("x",String(C)),t.setAttribute("y",String(s)),t.setAttribute("width",String(S)),t.setAttribute("height",String(Math.max(0,i-s)))}else t.setAttribute("x",String(C+e.p1*v)),t.setAttribute("y",String(L)),t.setAttribute("width",String(Math.max(0,(e.p2-e.p1)*v))),t.setAttribute("height",String(S));t.setAttribute("fill","transparent"),t.setAttribute("class","apexcharts-heatmap-gradient-band"),t.setAttribute("data:range-index",String(e.index)),t.style.cursor="pointer",k.appendChild(t),this._bandHitEls.push(t)}),this._geom={isVertical:p,position:g,stripX:C,stripY:L,stripLength:v,stripThickness:S,arrowSize:u,svgWidth:w,svgHeight:A},h.showHoverValue){const e=b.createElement("div");e.classList.add("apexcharts-heatmap-gradient-legend-value"),e.style.position="absolute",e.style.fontSize=(null==(a=h.labelStyle)?void 0:a.fontSize)||"11px",e.style.fontFamily=(null==(o=h.labelStyle)?void 0:o.fontFamily)||c.config.chart.fontFamily||"",e.style.color=c.config.chart.foreColor,e.style.background="rgba(0,0,0,0.65)",e.style.color="#fff",e.style.padding="2px 6px",e.style.borderRadius="3px",e.style.pointerEvents="none",e.style.whiteSpace="nowrap",e.style.opacity="0",e.style.transition="opacity 120ms ease",this.hoverValueEl=e}d.classList.add("apexcharts-heatmap-gradient-legend-wrap"),d.classList.add("apx-legend-position-"+g),d.appendChild(k),this.hoverValueEl&&d.appendChild(this.hoverValueEl),this.svgEl=k,e?(d.style.width=w+"px",d.style.height=A+"px",d.style.position="relative",d.style.overflow="visible"):this._applyWrapAlignment(d,g,p,w,A),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(e,t){const s=this.w,i=t?s.globals.svgHeight||s.config.chart.height||300:s.globals.svgWidth||s.config.chart.width||600;if("string"==typeof e){const t=e.trim();if(t.endsWith("%")){const e=parseFloat(t)||0;return Math.max(20,i*e/100)}const s=parseFloat(t);return Number.isFinite(s)?s:200}return"number"==typeof e&&Number.isFinite(e)?e:200}_applyWrapAlignment(e,t,s,i,n){const r=this.w,l=this._cfg().align||"center",a=12,o=r.globals.svgWidth||r.config.chart.width||600,c=r.globals.svgHeight||r.config.chart.height||300,d=r.config.legend.offsetX||0,h=r.config.legend.offsetY||0;if(e.style.position="absolute",e.style.display="block",e.style.overflow="visible",e.style.padding="0",e.style.width=i+"px",e.style.height=n+"px",e.style.right="auto",e.style.bottom="auto",s){const s=c-n-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,s):a+Math.max(0,s)/2,e.style.top=r+h+"px",e.style.left="left"===t?a+d+"px":o-i-a+d+"px"}else{const s=o-i-24;let r;r="start"===l?a:"end"===l?a+Math.max(0,s):a+Math.max(0,s)/2,e.style.left=r+d+"px",e.style.top="top"===t?a+h+"px":c-n-a+h+"px"}}repositionToPlot(){var e,t;if(this._grad&&this._paintStops(),!x.isBrowser())return;if(this._targetEl)return;const s=this.w,i=s.globals,n=s.dom.elLegendWrap;if(!n||!this._geom)return;if(!Number.isFinite(i.gridWidth)||!Number.isFinite(i.gridHeight))return;const{isVertical:r,position:l,svgWidth:a,svgHeight:o,stripX:c,stripY:d,stripThickness:h}=this._geom,g=this._cfg().align||"center",p=s.config.legend.offsetX||0,u=s.config.legend.offsetY||0,f=null==(t=null==(e=this.ctx)?void 0:e.dimensions)?void 0:t.dimHelpers,m=f?f.getTitleSubtitleCoords("title").height+f.getTitleSubtitleCoords("subtitle").height:0,y=s.layout.xAxisHeight||0,v=(e,t)=>{const s=Math.max(0,e-t);return"start"===g?0:"end"===g?s:s/2};if(r){n.style.top=i.translateY+v(i.gridHeight,o)+u+"px";const e=(("left"===l?0:i.translateX+i.gridWidth)+("left"===l?i.translateX:i.svgWidth))/2;n.style.left=e-c-h/2+p+"px"}else{n.style.left=i.translateX+v(i.gridWidth,a)+p+"px";const e=(("top"===l?m:i.translateY+i.gridHeight+y)+("top"===l?i.translateY:i.svgHeight))/2;n.style.top=e-d-h/2+u+"px"}b.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const e=this.w,t=e.dom.elLegendWrap,s=this.svgEl&&this.svgEl.querySelector("rect");if(!t||!s||!this._geom)return;if(!e.dom.baseEl||!e.dom.baseEl.querySelector(".apexcharts-svg"))return;const i=s.getBoundingClientRect(),n=L.plotRect(e);if(!(i.width&&i.height&&n.width&&n.height))return;const r=n.left,l=n.left+n.width,a=n.top,o=n.top+n.height,c=n.zoom,{isVertical:d,position:h}=this._geom;if(d){const e=("left"===h?r-i.right:i.left-l)/c;if(e<16){const s=parseFloat(t.style.left)||0,i=16-e;t.style.left=s+("left"===h?-i:i)+"px"}}else{const e=("top"===h?a-i.bottom:i.top-o)/c;if(e<16){const s=parseFloat(t.style.top)||0,i=16-e;t.style.top=s+("top"===h?-i:i)+"px"}}}destroy(){var e,t,s,i,n,r,l;for(let s=0;s<this._bandHitEls.length;s++){const i=this._bandHitEls[s];null==(e=i.removeEventListener)||e.call(i,"mousemove",this._onBandEnter),null==(t=i.removeEventListener)||t.call(i,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(s=this.ctx)?void 0:s.events)try{null==(n=(i=this.ctx.events).removeEventListener)||n.call(i,"dataPointMouseEnter",this._onCellEnter),null==(l=(r=this.ctx.events).removeEventListener)||l.call(r,"dataPointMouseLeave",this._onCellLeave)}catch(e){}}_attachBandHoverListeners(){if(x.isBrowser())for(let e=0;e<this._bandHitEls.length;e++){const t=this._bandHitEls[e];t.addEventListener("mousemove",this._onBandEnter),t.addEventListener("mouseout",this._onBandLeave)}}_onBandEnter(e){var t,s,i,n;const r=this.w,l=e.currentTarget,a=parseInt(null!=(t=l.getAttribute("data:range-index"))?t:"-1",10);a<0||a===this._activeBandIndex||(this._activeBandIndex=a,null==(n=null==(i=null==(s=this.ctx)?void 0:s.events)?void 0:i.fireEvent)||n.call(i,"legendHover",[this.ctx,a,r]),this._highlightRange(a,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const e=this._activeBandIndex;this._activeBandIndex=-1,this._highlightRange(e,"reset")}_highlightRange(e,t){var s;((null==(s=this.panelsW)?void 0:s.call(this))||[this.w]).forEach(s=>new u(s).highlightRangeInSeries(e,t))}_attachHoverListeners(){var e,t;x.isBrowser()&&(null==(t=null==(e=this.ctx)?void 0:e.events)?void 0:t.addEventListener)&&(this.ctx.events.addEventListener("dataPointMouseEnter",this._onCellEnter),this.ctx.events.addEventListener("dataPointMouseLeave",this._onCellLeave))}_onCellEnter(...e){var t,s,i;if(!this.arrowEl)return;const n=e[e.length-1];if(!n||"object"!=typeof n)return;const r=n.w||this.w,l=n.seriesIndex,a=n.dataPointIndex;if("number"!=typeof l||"number"!=typeof a)return;if(!k.supports(r))return;let o;o=this._continuous?function(e,t,s){const i=e.config.series[t];return _(e,i&&Array.isArray(i.data)?i.data[s]:null,t,s)}(r,l,a):null==(i=null==(s=null==(t=r.seriesData)?void 0:t.series)?void 0:s[l])?void 0:i[a],null==o||Number.isNaN(o)||this._positionArrow(o)}_onCellLeave(){this.arrowEl&&(this.arrowEl.setAttribute("opacity","0"),this.hoverValueEl&&(this.hoverValueEl.style.opacity="0"))}_positionArrow(e){if(!this.arrowEl||!this._geom)return;const{isVertical:t,position:s,stripX:i,stripY:n,stripLength:r,stripThickness:l,arrowSize:a}=this._geom,o=this._min,c=this._max-o;let d;if(d=0===c?.5:(e-o)/c,d<0&&(d=0),d>1&&(d=1),t){const e=n+r-d*r;let t,o;"left"===s?(t=i+l,o=t+a):(t=i,o=t-a);const c=[`${t},${e}`,`${o},${e-a/2}`,`${o},${e+a/2}`].join(" ");this.arrowEl.setAttribute("points",c)}else{const e=i+d*r;let t,o;"top"===s?(t=n+l,o=t+a):(t=n,o=t-a);const c=[`${e},${t}`,`${e-a/2},${o}`,`${e+a/2},${o}`].join(" ");this.arrowEl.setAttribute("points",c)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const o=this._getFormatter();if(this.hoverValueEl.textContent=o(e),t){const e=n+r-d*r;"left"===s?this.hoverValueEl.style.left=`${i+l+a+8}px`:(this.hoverValueEl.style.left=i-a-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=e-9+"px"}else{const e=i+d*r;this.hoverValueEl.style.left=`${e}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===s?`${n+l+a+8}px`:n-a-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(e,t,s){const i=b.createElementNS(E,"polygon");return i.setAttribute("fill",t),i.setAttribute("opacity","0"),i.setAttribute("class","apexcharts-heatmap-gradient-arrow"),i.setAttribute("points","0,0 0,0 0,0"),i.setAttribute("pointer-events","none"),i}_paintStops(){const e=this._computeStops(),t=this._grad;return this._min=e.min,this._max=e.max,t.innerHTML="",e.stops.forEach(e=>{const s=b.createElementNS(E,"stop");s.setAttribute("offset",`${(100*e.percent).toFixed(2)}%`),s.setAttribute("stop-color",e.color),t.appendChild(s)}),e}_computeStops(){var e,t;const s=this.w,i=k.colorScaleOf(s)||{},n=this._cfg(),r=C(s);if(r)return this._continuous=!0,{min:r.min,max:r.max,stops:r.legendStops,bands:[]};this._continuous=!1;let l=1/0,a=-1/0;const d=(null==(e=s.seriesData)?void 0:e.series)||[];for(let e=0;e<d.length;e++){const t=d[e];if(t)for(let e=0;e<t.length;e++){const s=t[e];null==s||Number.isNaN(s)||(s<l&&(l=s),s>a&&(a=s))}}Number.isFinite(l)||(l=0),Number.isFinite(a)||(a=0);let h=l,g=a;const p=void 0!==i.min&&void 0!==i.max&&i.max>i.min;p?(h=i.min,g=i.max):(void 0!==i.min&&(h=i.min<l?i.min:l),void 0!==i.max&&(g=i.max>a?i.max:a));const u=[],x=[];if(i.ranges&&i.ranges.length>0){const e=i.ranges.map((e,t)=>c(o({},e),{_originalIndex:t})).sort((e,t)=>e.from-t.from),t=e[0].from,s=e[e.length-1].to;h=t,g=s;const n=s-t||1;e.forEach(e=>{const s=(e.from-t)/n,i=(e.to-t)/n;u.push({percent:(s+i)/2,color:e.color}),x.push({index:e._originalIndex,p1:s,p2:i})})}else{const e=s.globals.colors[0]||"#008FFB",r=new f,l=s.config.chart.type,a=s.config.plotOptions[l]||{},o=null!=(t=a.shadeIntensity)?t:.5,c=s.globals,d=c.hasNegs,x="heatmap"===l&&!a.distributed&&!p&&c.maxY>=c.minY,m=x?c.maxY:g,b=Math.abs(m)+Math.abs(x?i.min<c.minY?i.min:c.minY:h),y=1.25*o,v=Math.max(2,n.stops||16);for(let t=0;t<v;t++){const i=t/(v-1),n=0===b?0:Math.min(h+i*(g-h),m)/b,c=Math.max(-1,Math.min(1,d?a.reverseNegativeShade?(n<0?n:1-n)*y:n<=0?1-(1+n)*o:(1-n)*o:(1-n)*("treemap"===l?y:1))),p=a.enableShades?r.shadeColor("dark"===s.config.theme.mode?-c:c,e):e;u.push({percent:i,color:p})}}return{min:h,max:g,stops:u,bands:x}}}const I=globalThis.ApexCharts.__internals.__apex_Markers;function H(e){return e.classList.contains("apexcharts-legend-series")||e.classList.contains("apexcharts-legend-text")||e.classList.contains("apexcharts-legend-marker")}d.registerFeatures({legend:class{constructor(e,t){this.w=e,this.ctx=t,this.updateSeries=(...e)=>t.updateHelpers._updateSeries(...e),this.onLegendClick=this.onLegendClick.bind(this),this.onLegendHovered=this.onLegendHovered.bind(this),this.onLegendClickEvent=this.onLegendClickEvent.bind(this),this.onLegendPointerDown=this.onLegendPointerDown.bind(this),this.onLegendPointerUp=this.onLegendPointerUp.bind(this),this.legendPress=null,this.recoveredRel=null,this.isBarsDistributed="bar"===this.w.config.chart.type&&this.w.config.plotOptions.bar.distributed&&1===this.w.config.series.length,this.legendHelpers=new m(this)}init(){var e;const t=this.w,s=t.globals,i=t.config;null==(e=this.heatmapGradientLegend)||e.destroy(),this.heatmapGradientLegend=null,this.isBarsDistributed="bar"===i.chart.type&&i.plotOptions.bar.distributed&&1===i.series.length;const n=i.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||"heatmap"===i.chart.type||k.isEnabled(t)||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(n||!s.axisCharts)&&i.legend.show){const e=t.dom.elLegendWrap;for(;e.firstChild;)e.removeChild(e.firstChild);k.isEnabled(t)?(this.heatmapGradientLegend=new k(t,this.ctx),this.heatmapGradientLegend.draw()):(this.drawLegends(),"bottom"===i.legend.position||"top"===i.legend.position?this.legendAlignHorizontal():"right"!==i.legend.position&&"left"!==i.legend.position||this.legendAlignVertical())}}createLegendMarker({i:e,fillcolor:t}){const s=this.w,i=b.createElement("span");i.classList.add("apexcharts-legend-marker");const n=s.config.legend.markers.shape||s.config.markers.shape;let r=n;Array.isArray(n)&&(r=n[e]);const l=Array.isArray(s.config.legend.markers.size)?parseFloat(s.config.legend.markers.size[e]):parseFloat(s.config.legend.markers.size),a=Array.isArray(s.config.legend.markers.offsetX)?parseFloat(s.config.legend.markers.offsetX[e]):parseFloat(s.config.legend.markers.offsetX),d=Array.isArray(s.config.legend.markers.offsetY)?parseFloat(s.config.legend.markers.offsetY[e]):parseFloat(s.config.legend.markers.offsetY),h=Array.isArray(s.config.legend.markers.strokeWidth)?parseFloat(s.config.legend.markers.strokeWidth[e]):parseFloat(s.config.legend.markers.strokeWidth),g=i.style;if(g.height=2*(l+h)+"px",g.width=2*(l+h)+"px",g.left=a+"px",g.top=d+"px",s.config.legend.markers.customHTML)g.background="transparent",g.color=t[e],Array.isArray(s.config.legend.markers.customHTML)?s.config.legend.markers.customHTML[e]&&(i.innerHTML=s.config.legend.markers.customHTML[e]()):i.innerHTML=s.config.legend.markers.customHTML();else{const s=new I(this.ctx.w,this.ctx).getMarkerConfig({cssClass:`apexcharts-legend-marker apexcharts-marker apexcharts-marker-${r}`,seriesIndex:e,strokeWidth:h,size:l}),n=(x.isBrowser()?window.SVG:global.SVG)().addTo(i).size("100%","100%"),a=new p(this.w).drawMarker(0,0,c(o({},s),{pointFillColor:Array.isArray(t)?t[e]:s.pointFillColor,shape:r}));a.node.style.transform="triangle"===r?"translate(50%, 45%)":"translate(50%, 50%)",n.add(a)}return i}drawLegends(){var e;const t=this,s=this.w,i=s.dom.elLegendWrap,n=s.config.legend.fontFamily;let r=s.seriesData.seriesNames,l=s.config.legend.markers.fillColors?s.config.legend.markers.fillColors.slice():s.globals.colors.slice();if("heatmap"===s.config.chart.type){const e=s.config.plotOptions.heatmap.colorScale.ranges;r=e.map(e=>e.name?e.name:e.from+" - "+e.to),l=e.map(e=>e.color)}else this.isBarsDistributed&&(r=s.labelData.labels.slice());s.config.legend.customLegendItems.length&&(r=s.config.legend.customLegendItems);const a=s.formatters.legendFormatter,o=s.config.legend.inverseOrder,c=[];s.labelData.seriesGroups.length>1&&s.config.legend.clusterGroupedSeries&&s.labelData.seriesGroups.forEach((e,t)=>{c[t]=b.createElement("div"),c[t].classList.add("apexcharts-legend-group",`apexcharts-legend-group-${t}`),"horizontal"===s.config.legend.clusterGroupedSeriesOrientation?i.classList.add("apexcharts-legend-group-horizontal"):c[t].classList.add("apexcharts-legend-group-vertical")});for(let t=o?r.length-1:0;o?t>=0:t<=r.length-1;o?t--:t++){const o=a(r[t],{seriesIndex:t,w:s});let d=!1,g=!1;if(s.globals.collapsedSeries.length>0)for(let e=0;e<s.globals.collapsedSeries.length;e++)s.globals.collapsedSeries[e].index===t&&(d=!0);if(s.globals.ancillaryCollapsedSeriesIndices.length>0)for(let e=0;e<s.globals.ancillaryCollapsedSeriesIndices.length;e++)s.globals.ancillaryCollapsedSeriesIndices[e]===t&&(g=!0);const u=this.createLegendMarker({i:t,fillcolor:l});p.setAttrs(u,{rel:t+1,"data:collapsed":d||g}),(d||g)&&u.classList.add("apexcharts-inactive-legend");const x=b.createElement("div");if(s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled){x.setAttribute("role","button"),x.setAttribute("tabindex","0");const e=Array.isArray(o)?o.join(" "):o,t=d||g,s=t?"hidden":"visible";x.setAttribute("aria-label",`${e}, ${s}. Press Enter or Space to toggle.`),x.setAttribute("aria-pressed",t?"true":"false")}const m=b.createElement("span");m.classList.add("apexcharts-legend-text");const y=Array.isArray(o)?o.join(" "):o,v=r[t];String(y)===String(Array.isArray(v)?v.join(" "):v)?m.textContent=y:(m.innerHTML=y,m.setAttribute("data:html","1"));let S=s.config.legend.labels.useSeriesColors?s.globals.colors[t]:Array.isArray(s.config.legend.labels.colors)?null==(e=s.config.legend.labels.colors)?void 0:e[t]:s.config.legend.labels.colors;S||(S=s.config.chart.foreColor),m.style.color=S,m.style.fontSize=s.config.legend.fontSize,m.style.fontWeight=s.config.legend.fontWeight,m.style.fontFamily=n||s.config.chart.fontFamily,p.setAttrs(m,{rel:t+1,i:t,"data:default-text":encodeURIComponent(o),"data:collapsed":d||g}),x.appendChild(u),x.appendChild(m);const w=new h(this.w);s.config.legend.showForZeroSeries||0===w.getSeriesTotalByIndex(t)&&w.seriesHaveSameValues(t)&&!w.isSeriesNull(t)&&-1===s.globals.collapsedSeriesIndices.indexOf(t)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(t)&&x.classList.add("apexcharts-hidden-zero-series"),s.config.legend.showForNullSeries||w.isSeriesNull(t)&&-1===s.globals.collapsedSeriesIndices.indexOf(t)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(t)&&x.classList.add("apexcharts-hidden-null-series");const A=c[s.labelData.seriesGroupIndex[t]];A&&!A.parentNode&&i.appendChild(A),(A||i).appendChild(x),i.classList.add(`apexcharts-align-${s.config.legend.horizontalAlign}`),i.classList.add("apx-legend-position-"+s.config.legend.position),x.classList.add("apexcharts-legend-series"),x.style.margin=`${s.config.legend.itemMargin.vertical}px ${s.config.legend.itemMargin.horizontal}px`,i.style.width=s.config.legend.width?s.config.legend.width+"px":"",i.style.height=s.config.legend.height?s.config.legend.height+"px":"",p.setAttrs(x,{rel:t+1,seriesName:f.escapeString(r[t]),"data:collapsed":d||g}),(d||g)&&x.classList.add("apexcharts-inactive-legend"),s.config.legend.onItemClick.toggleDataSeries||x.classList.add("apexcharts-no-click")}s.dom.elWrap.addEventListener("click",t.onLegendClickEvent,!0),s.dom.elWrap.addEventListener("pointerdown",t.onLegendPointerDown,!0),s.dom.elWrap.addEventListener("pointerup",t.onLegendPointerUp,!0),s.config.legend.onItemHover.highlightDataSeries&&0===s.config.legend.customLegendItems.length&&(s.dom.elWrap.addEventListener("mousemove",t.onLegendHovered,!0),s.dom.elWrap.addEventListener("mouseout",t.onLegendHovered,!0)),s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled&&s.dom.elWrap.addEventListener("keydown",t.onLegendKeyDown.bind(t),!0)}setLegendWrapXY(e,t){const s=this.w,i=s.dom.elLegendWrap,n=i.clientHeight;let r=0,l=0;if("bottom"===s.config.legend.position)l=s.globals.svgHeight-Math.min(n,s.globals.svgHeight/2)-5;else if("top"===s.config.legend.position){const e=new g(this.w,this.ctx),t=e.dimHelpers.getTitleSubtitleCoords("title").height,s=e.dimHelpers.getTitleSubtitleCoords("subtitle").height;l=(t>0?t-10:0)+(s>0?s-10:0)}i.style.position="absolute",r=r+e+s.config.legend.offsetX,l=l+t+s.config.legend.offsetY,i.style.left=r+"px",i.style.top=l+"px","right"===s.config.legend.position&&(i.style.left="auto",i.style.right=25+s.config.legend.offsetX+"px"),["width","height"].forEach(e=>{i&&i.style[e]&&(i.style[e]=parseInt(String(s.config.legend[e]),10)+"px")})}legendAlignHorizontal(){const e=this.w;e.dom.elLegendWrap.style.right="0";const t=new g(this.w,this.ctx),s=t.dimHelpers.getTitleSubtitleCoords("title"),i=t.dimHelpers.getTitleSubtitleCoords("subtitle");let n=0;"top"===e.config.legend.position&&(n=s.height+i.height+e.config.title.margin+e.config.subtitle.margin-10),this.setLegendWrapXY(20,n)}legendAlignVertical(){this.setLegendWrapXY("left"===this.w.config.legend.position?20:0,20)}onLegendHovered(e){const t=this.w,s=e.target;if(!H(s))return;const i=s.getAttribute("rel"),n="mousemove"===e.type,r=e.relatedTarget,l=t.globals.cachedSelectors;if(n?l.legendRel===i:r&&H(r)&&r.getAttribute("rel")===i&&t.dom.elWrap.contains(r))return;l.legendRel=n?i:null;const a=new u(this.ctx.w);if("heatmap"===t.config.chart.type||this.isBarsDistributed){const e=parseInt(null!=i?i:"0",10)-1;n&&this.ctx.events.fireEvent("legendHover",[this.ctx,e,this.w]),a.highlightRangeInSeries(e,n?"highlight":"reset")}else s.closest(".apexcharts-inactive-legend")||a.toggleSeriesOnHover(e,s)}onLegendKeyDown(e){const t=this,s=this.w,i=e.target;if(H(i)&&("Enter"===e.key||" "===e.key)){e.preventDefault();const n=i.getAttribute("rel");t.onLegendClick(e),null!==n&&s.config.legend.onItemClick.toggleDataSeries&&requestAnimationFrame(()=>{var e;const t=null==(e=s.dom.baseEl)?void 0:e.querySelector(`.apexcharts-legend-series[rel="${n}"]`);t&&t.focus()})}}onLegendPointerDown(e){const t=e.target;this.recoveredRel=null,this.legendPress=0===e.button&&H(t)?{el:t,rel:t.getAttribute("rel")}:null}onLegendPointerUp(e){const t=this.legendPress;this.legendPress=null;const s=e.target;t&&!t.el.isConnected&&H(s)&&s.getAttribute("rel")===t.rel&&(this.recoveredRel=t.rel,this.onLegendClick(e))}onLegendClickEvent(e){const t=this.recoveredRel;this.recoveredRel=null;const s=e.target;null!==t&&e.isTrusted&&s.getAttribute("rel")===t||this.onLegendClick(e)}onLegendClick(e){var t;const s=this.w,i=e.target;if(!s.config.legend.customLegendItems.length&&H(i)){const e=parseInt(null!=(t=i.getAttribute("rel"))?t:"0",10)-1,n="true"===i.getAttribute("data:collapsed"),r=this.w.config.chart.events.legendClick;"function"==typeof r&&r(this.ctx,e,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,e,this.w]);const l=this.w.config.legend.markers.onClick;"function"==typeof l&&i.classList.contains("apexcharts-legend-marker")&&(l(this.ctx,e,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,e,this.w])),"treemap"!==s.config.chart.type&&"heatmap"!==s.config.chart.type&&!this.isBarsDistributed&&s.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(e,n)}}}}),e.default=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexLegend={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,a=(t,r,s)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=(e=>e&&e.__esModule?e:{default:e})(require("apexcharts/core")),l=globalThis.console;const c="__apexcharts_crossfilters__";function h(e){if(!Number.isFinite(e))return e;const t=Number(e.toPrecision(12));return Object.is(t,-0)?0:t}function f(e){return"number"==typeof e&&Number.isFinite(e)}function u(e){if("function"==typeof e)return e;if(e&&"object"==typeof e){if("string"==typeof e.sum){const t=e.sum;return e=>e.reduce((e,r)=>e+(Number(r[t])||0),0)}if("string"==typeof e.avg){const t=e.avg;return e=>e.length?e.reduce((e,r)=>e+(Number(r[t])||0),0)/e.length:0}if("string"==typeof e.min){const t=e.min;return e=>e.length?Math.min(...e.map(e=>Number(e[t])||0)):0}if("string"==typeof e.max){const t=e.max;return e=>e.length?Math.max(...e.map(e=>Number(e[t])||0)):0}}return e=>e.length}function d(e,t){return"function"==typeof t?e.slice().sort(t):"asc"===t?e.slice().sort((e,t)=>e>t?1:e<t?-1:0):"desc"===t?e.slice().sort((e,t)=>e<t?1:e>t?-1:0):e}function g(e,t){if(!f(e))return-1;const r=t.length-1;if(e<t[0]||e>t[r])return-1;if(e===t[r])return r-1;for(let s=0;s<r;s++)if(e>=t[s]&&e<t[s+1])return s;return-1}function m(e){const t=[];for(let r=0;r<e.length-1;r++)t.push(h((e[r]+e[r+1])/2));return t}class p{constructor(e,t){this.dims=new Map,this.listeners=new Map,this.id=e,this.records=Array.isArray(t)?t:[]}static store(){const e=globalThis;return e[c]||(e[c]=new Map),e[c]}static getOrCreate(e){if(!e||"string"!=typeof e.id)throw new Error("Crossfilter.getOrCreate requires an { id } string.");const t=p.store(),r=t.get(e.id);if(r)return e.records&&r.setRecords(e.records),r;const s=new p(e.id,e.records);return t.set(e.id,s),s}static get(e){return p.store().get(e)||null}setRecords(e){return this.records=Array.isArray(e)?e:[],this.dims.forEach(e=>this.recomputeDomain(e)),this.emit("records",this.state()),this.emit("change",this.state()),this}registerDimension(e,t){if(!t||"function"!=typeof t.dimension)throw new Error(`crossfilter.registerDimension("${e}") needs a dimension function.`);const r=t.type||(t.bins?"range":"category"),s={accessor:t.dimension,reducer:u(t.reduce),type:r,bins:t.bins,order:t.order,filter:null,labels:[],edges:null,xLabels:[],yLabels:[]};return this.dims.set(e,s),this.recomputeDomain(s),null!=t.filter&&this.setFilterOn(s,t.filter),this}hasDimension(e){return this.dims.has(e)}removeDimension(e){const t=this.dims.get(e),r=!!t&&this.hasFilter(t);return this.dims.delete(e),r&&this.emit("change",this.state()),this}recomputeDomain(e){if("matrix"===e.type){const t=function(e,t,r){const s=new Set,i=new Set,n=[],a=[];for(let r=0;r<e.length;r++){const o=t(e[r]);if(!o)continue;const l=o[0],c=o[1];null==l||s.has(l)||(s.add(l),n.push(l)),null==c||i.has(c)||(i.add(c),a.push(c))}return{xLabels:d(n,r),yLabels:d(a,r)}}(this.records,e.accessor,e.order);return e.xLabels=t.xLabels,e.yLabels=t.yLabels,void(e.edges=null)}if("range"===e.type)return e.edges=function(e,t,r){if(r&&Array.isArray(r.thresholds)&&r.thresholds.length>=2){const e=Array.from(new Set(r.thresholds.filter(f))).sort((e,t)=>e-t);return e.length>=2?e.map(h):[0,1]}let s=1/0,i=-1/0;for(let r=0;r<e.length;r++){const n=t(e[r]);f(n)&&(n<s&&(s=n),n>i&&(i=n))}if(s===1/0)return[0,1];if(s===i){const e=Math.abs(s)>0?Math.abs(s):1;return[h(s),h(s+e)]}if(r&&f(r.width)&&r.width>0){const e=r.width,t=Math.floor(s/e)*e;let n=Math.ceil(i/e)*e;n<=t&&(n=t+e);const a=Math.max(1,Math.round((n-t)/e)),o=new Array(a+1);for(let r=0;r<=a;r++)o[r]=h(t+r*e);return o}const n=r&&f(r.count)&&r.count>=1?Math.floor(r.count):30,a=(i-s)/n,o=new Array(n+1);for(let e=0;e<=n;e++)o[e]=h(s+e*a);return o[n]=h(i),o}(this.records,e.accessor,e.bins),void(e.labels=m(e.edges));if(e.labels=function(e,t,r){const s=new Set,i=[];for(let r=0;r<e.length;r++){const n=t(e[r]);null!=n&&(s.has(n)||(s.add(n),i.push(n)))}return d(i,r)}(this.records,e.accessor,e.order),e.edges=null,e.filter instanceof Set){const t=new Set(e.labels);Array.from(e.filter).forEach(r=>{t.has(r)||e.filter.delete(r)})}}filter(e,t){const r=this.dims.get(e);return r?(this.setFilterOn(r,t),this.emit("change",this.state()),this):this}toggleKey(e,t){const r=this.dims.get(e);if(!r||"category"!==r.type)return this;r.filter instanceof Set||(r.filter=new Set);const s=r.filter;return s.has(t)?s.delete(t):s.add(t),0===s.size&&(r.filter=null),this.emit("change",this.state()),this}setFilterOn(e,t){if(null==t)return void(e.filter=null);if("range"===e.type){if(Array.isArray(t)&&2===t.length&&t.every(f)){const[r,s]=t;e.filter=[Math.min(r,s),Math.max(r,s)]}else e.filter=null;return}const r=new Set(t);e.filter=r.size?r:null}clear(e){const t=this.dims.get(e);return t&&(t.filter=null),this.emit("change",this.state()),this}reset(){return this.dims.forEach(e=>{e.filter=null}),this.emit("change",this.state()),this}hasFilter(e){return null!=e.filter&&(!(e.filter instanceof Set)||e.filter.size>0)}passes(e,t){if(!this.hasFilter(e))return!0;const r=e.accessor(t);if(e.filter instanceof Set)return e.filter.has(r);if(!f(r))return!1;const[s,i]=e.filter;return r>=s&&r<=i}filteredRecords(e){const t=[];return this.dims.forEach((r,s)=>{s!==e&&this.hasFilter(r)&&t.push(r)}),0===t.length?this.records:this.records.filter(e=>t.every(t=>this.passes(t,e)))}filteredRows(){return this.filteredRecords(null)}aggregateFor(e){const t=this.dims.get(e);if(!t)return{type:"category",labels:[],values:[],keys:[]};const r=this.filteredRecords(e);if("matrix"===t.type){const e=new Map(t.xLabels.map((e,t)=>[e,t])),s=new Map(t.yLabels.map((e,t)=>[e,t])),i=t.yLabels.map(()=>t.xLabels.map(()=>[]));for(let n=0;n<r.length;n++){const a=t.accessor(r[n]);if(!a)continue;const o=e.get(a[0]),l=s.get(a[1]);null!=o&&null!=l&&i[l][o].push(r[n])}return{type:"matrix",xLabels:t.xLabels.slice(),yLabels:t.yLabels.slice(),matrix:i.map(e=>e.map(e=>t.reducer(e)))}}if("range"===t.type){const e=t.edges||[0,1],s=e.length-1,i=Array.from({length:s},()=>[]);for(let s=0;s<r.length;s++){const n=g(t.accessor(r[s]),e);n>=0&&i[n].push(r[s])}return{type:"range",labels:m(e),values:i.map(e=>t.reducer(e)),keys:i.map((t,r)=>[e[r],e[r+1]]),edges:e}}const s=new Map;t.labels.forEach(e=>s.set(e,[]));for(let e=0;e<r.length;e++){const i=s.get(t.accessor(r[e]));i&&i.push(r[e])}return{type:"category",labels:t.labels.slice(),values:t.labels.map(e=>t.reducer(s.get(e)||[])),keys:t.labels.slice()}}aggregateAll(){const e={};return this.dims.forEach((t,r)=>{e[r]=this.aggregateFor(r)}),e}state(){const e={};return this.dims.forEach((t,r)=>{this.hasFilter(t)&&(e[r]=t.filter instanceof Set?Array.from(t.filter):t.filter.slice())}),{filters:e,filteredCount:this.filteredRows().length,total:this.records.length}}filterOf(e){const t=this.dims.get(e);return t&&this.hasFilter(t)?t.filter instanceof Set?new Set(t.filter):t.filter.slice():null}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>this.off(e,t)}off(e,t){var r;return null==(r=this.listeners.get(e))||r.delete(t),this}emit(e,t){var r;null==(r=this.listeners.get(e))||r.forEach(r=>{try{r(t)}catch(t){!function(e,...t){l.error(e,...t)}(`[Apex] a crossfilter ${e} listener threw`,t)}})}static esc(e){return String(null==e?"":e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}resolveColumns(e){if(Array.isArray(e)&&e.length)return e.map(e=>"string"==typeof e?{field:e,label:e}:{field:e.field,label:e.label||e.field,format:e.format});const t=this.records[0];return(t?Object.keys(t):[]).map(e=>({field:e,label:e}))}tableHTML(e,t,r){const s="<thead><tr>"+e.map(e=>`<th>${p.esc(e.label)}</th>`).join("")+"</tr></thead>",i="<tbody>"+t.map(t=>"<tr>"+e.map(e=>{const r=t[e.field],s=e.format?e.format(r,t):r;return`<td>${p.esc(s)}</td>`}).join("")+"</tr>").join("")+"</tbody>";return`<table class="apexcharts-cf-table"><caption>${t.length} of ${r} rows</caption>${s}${i}</table>`}dataTable(e,t){if(!e)return{refresh(){},destroy(){}};const r=t||{},s=this.resolveColumns(r.columns),i=r.pageSize||0,n=r.page||0,a=()=>{const t=this.filteredRows(),r=i?t.slice(n*i,n*i+i):t;e.innerHTML=this.tableHTML(s,r,t.length)};a();const o=this.on("change",a);return{refresh:a,destroy:()=>{o(),e.innerHTML=""}}}destroy(){p.store().delete(this.id),this.dims.clear(),this.listeners.clear(),this.records=[]}}const y=[".apexcharts-bar-area",".apexcharts-candlestick-area",".apexcharts-boxPlot-area",".apexcharts-rangebar-area",".apexcharts-marker"].join(", "),b=[".apexcharts-pie-area",".apexcharts-bar-area"].join(", "),_="apexcharts-crossfilter-dimmed",x=["pie","donut","polarArea","radialBar"];o.default.registerFeatures({linkedViews:class{constructor(e,t){this.w=e,this.ctx=t,this._dimmed=!1,this._wired=!1,this._pending=!1,this._lastValues=null,this._onPointSelect=this._onPointSelect.bind(this),this._afterRender=this._afterRender.bind(this),this._onChange=this._onChange.bind(this),"filter"===this._mode()&&this._initEngine()}_mode(){const e=this.w.config.chart.link;return e&&"function"==typeof e.dimension?"filter":e&&e.enabled?"highlight":"off"}_enabled(){const e=this.w.config.chart.link;return!(!e||!e.enabled)}onSourceSelection(e){var t;const r=this._mode();if("off"===r)return;if(!e||null==e.min||null==e.max)return;let s=Math.min(e.min,e.max),i=Math.max(e.min,e.max);const n=this.w.globals.minX,a=this.w.globals.maxX;if(isFinite(n)&&isFinite(a)&&a>n){const e=1e-6*(a-n);s-n<=e&&(s=n),a-i<=e&&(i=a)}if("filter"===r){const e=this._cf();if(!e)return;return e.filter(this._chartId(),[s,i]),void this._fireFilterChange(e,[s,i])}this._group().forEach(e=>{var t;null==(t=null==e?void 0:e.linkedViews)||t.applyDim(s,i)});const o={xaxis:{min:s,max:i},sourceChartID:this.w.globals.chartID};"function"==typeof this.w.config.chart.events.crossFilter&&this.w.config.chart.events.crossFilter(this.ctx,o),null==(t=this.ctx.events)||t.fireEvent("crossFilter",[this.ctx,o])}_group(){const e="function"==typeof this.ctx.getGroupedCharts?this.ctx.getGroupedCharts():[];return[this.ctx,...e]}applyDim(e,t){if(!this._enabled())return;const r=this.w,s=r.dom.baseEl;if(!s)return;const i=r.config.chart.link.dimOpacity;r.dom.elWrap&&"number"==typeof i&&r.dom.elWrap.style.setProperty("--apx-cf-dim",String(i));const n=r.globals.seriesX||[];s.querySelectorAll(y).forEach(r=>{const s=r.getAttribute("j");if(null===s)return;const i=parseInt(s,10),a=r.getAttribute("index"),o=null===a?0:parseInt(a,10),l=n[o]||n[0];if(!l)return;const c=l[i];null!=c&&r.classList.toggle(_,c<e||c>t)}),this._dimmed=!0}clear(){const e=this.w.dom.baseEl;e&&(e.querySelectorAll("."+_).forEach(e=>e.classList.remove(_)),this._dimmed=!1)}clearGroup(){if("filter"===this._mode()){const e=this._cf();return void(e&&e.reset())}this._group().forEach(e=>{var t;return null==(t=null==e?void 0:e.linkedViews)?void 0:t.clear()})}_chartId(){return this.w.globals.chartID}_cf(){const e=this.w.config.chart.link,t=e&&(e.id||this.w.config.chart.group);return t?p.get(t):null}_isPie(){return-1!==x.indexOf(this.w.config.chart.type)}_isHeatmap(){return"heatmap"===this.w.config.chart.type}_initEngine(){const e=this._cf(),t=this.w.config.chart.link;if(!e){const e=t&&t.id||this.w.config.chart.group;return void console.warn(`[apexcharts] chart.link.dimension is set but no crossfilter coordinator "${e}" exists. Call ApexCharts.crossfilter({ id, records }) before creating the chart.`)}const r=this._chartId();e.hasDimension(r)||e.registerDimension(r,{dimension:t.dimension,reduce:t.reduce,type:t.type||(this._isHeatmap()?"matrix":void 0),bins:t.bins,order:t.order}),this._injectSeries(e.aggregateFor(r)),this._wire(e)}_seriesFromAgg(e){if("matrix"===e.type)return e.yLabels.map((t,r)=>({name:String(t),data:e.xLabels.map((t,s)=>({x:String(t),y:e.matrix[r][s]}))}));if(this._isPie())return e.values.slice();const t=this.w.config.chart.link.seriesName||"Count";return"range"===e.type?[{name:t,data:e.labels.map((t,r)=>[t,e.values[r]])}]:[{name:t,data:e.values.slice()}]}_sigOf(e){return JSON.stringify(e.matrix||e.values)}_injectSeries(e){const t=this.w;this._lastValues=this._sigOf(e),t.config.series=this._seriesFromAgg(e),"matrix"!==e.type&&(this._isPie()?t.config.labels=e.labels.map(String):"category"===e.type?(t.config.xaxis||(t.config.xaxis={}),t.config.xaxis.categories=e.labels.map(String)):"range"===e.type&&this._pinRangeDomain(e.edges))}_pinRangeDomain(e){if(!Array.isArray(e)||e.length<2)return;const t=this.w;t.config.xaxis||(t.config.xaxis={}),null==t.config.xaxis.min&&(t.config.xaxis.min=e[0]),null==t.config.xaxis.max&&(t.config.xaxis.max=e[e.length-1])}_wire(e){this._wired||(this._wired=!0,this.ctx.addEventListener("dataPointSelection",this._onPointSelect),this.ctx.addEventListener("mounted",this._afterRender),this.ctx.addEventListener("updated",this._afterRender),e.on("change",this._onChange))}_onPointSelect(e,t,r){if("filter"!==this._mode()||!r||null==r.dataPointIndex)return;const s=this._cf();if(!s)return;const i=this._chartId(),n=s.aggregateFor(i);if("matrix"===n.type)return;const a=n.keys[r.dataPointIndex];null!=a&&(s.toggleKey(i,a),this._fireFilterChange(s,a))}_onChange(){"filter"!==this._mode()||this._pending||(this._pending=!0,Promise.resolve().then(()=>{this._pending=!1,this.w.globals.isDestroyed||this._applyAggregation()}))}_applyAggregation(){if("filter"!==this._mode())return;const e=this._cf();if(!e)return;const t=e.aggregateFor(this._chartId()),r=this._sigOf(t);r!==this._lastValues?(this._lastValues=r,this.ctx.updateSeries(this._seriesFromAgg(t),!0)):this._applySelfDim()}_afterRender(){if("filter"!==this._mode())return;const e=this.w.config.series;e&&0!==e.length?this._applySelfDim():this._reassertSeries()}_reassertSeries(){this._pending||(this._pending=!0,Promise.resolve().then(()=>{if(this._pending=!1,this.w.globals.isDestroyed)return;const e=this._cf();if(!e)return;const t=e.aggregateFor(this._chartId()),r=this._seriesFromAgg(t);r.length&&(this._lastValues=this._sigOf(t),this.ctx.updateSeries(r,!0))}))}_applySelfDim(){const e=this._cf();if(!e)return;const t=this.w,r=t.dom.baseEl;if(!r)return;const s=this._chartId(),i=e.filterOf(s),n=t.config.chart.link.dimOpacity;t.dom.elWrap&&"number"==typeof n&&t.dom.elWrap.style.setProperty("--apx-cf-dim",String(n));const a=i instanceof Set,o=Array.isArray(i),l=e.aggregateFor(s);if("matrix"===l.type)return;const c=l.keys;r.querySelectorAll(b).forEach(e=>{const t=e.getAttribute("j");if(null===t)return;const r=c[parseInt(t,10)];let s=!1;a?s=!i.has(r):o&&Array.isArray(r)&&(s=r[1]<=i[0]||r[0]>=i[1]),e.classList.toggle(_,s)}),this._dimmed=!!i}_fireFilterChange(e,o){var l;const c=(h=((e,t)=>{for(var r in t||(t={}))i.call(t,r)&&a(e,r,t[r]);if(s)for(var r of s(t))n.call(t,r)&&a(e,r,t[r]);return e})({},e.state()),f={sourceChartID:this._chartId(),key:o},t(h,r(f)));var h,f;const u=this.w.config.chart.events;"function"==typeof u.filterChange&&u.filterChange(this.ctx,c),null==(l=this.ctx.events)||l.fireEvent("filterChange",[this.ctx,c])}teardown(){var e,t,r,s,i,n;if(this.clear(),this._wired){null==(t=(e=this.ctx).removeEventListener)||t.call(e,"dataPointSelection",this._onPointSelect),null==(s=(r=this.ctx).removeEventListener)||s.call(r,"mounted",this._afterRender),null==(n=(i=this.ctx).removeEventListener)||n.call(i,"updated",this._afterRender);const a=this._cf();a&&(a.off("change",this._onChange),a.removeDimension(this._chartId())),this._wired=!1}}},crossfilter:p}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>o.default});
|
package/dist/features/link.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e){var t="undefined"!=typeof globalThis?globalThis:self,r=t.ApexCharts;if(r&&r.__internals)return e.call(t);if(r)throw new Error("ApexCharts: dist/features/link.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return e.call(t);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/link.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var s={file:"dist/features/link.js",run:e,done:!1},i=t.__apexcharts_pending_addons__||(t.__apexcharts_pending_addons__=[]);i.push(s),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!s.done){var r=t.ApexCharts;if(r)if(r.__internals){s.done=!0;var n=i.indexOf(s);-1!==n&&i.splice(n,1);try{e.call(t),r.__drainsAddons||t.console.warn("ApexCharts: dist/features/link.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(e){t.console.error("ApexCharts: dist/features/link.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/link.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else t.console.warn("ApexCharts: dist/features/link.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var e,t;e=this,t=function(e){"use strict";var t=Object.defineProperty,r=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(e,r,s)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;const l=globalThis.ApexCharts,c=globalThis.console,h="__apexcharts_crossfilters__";function f(e){if(!Number.isFinite(e))return e;const t=Number(e.toPrecision(12));return Object.is(t,-0)?0:t}function d(e){return"number"==typeof e&&Number.isFinite(e)}function u(e){if("function"==typeof e)return e;if(e&&"object"==typeof e){if("string"==typeof e.sum){const t=e.sum;return e=>e.reduce((e,r)=>e+(Number(r[t])||0),0)}if("string"==typeof e.avg){const t=e.avg;return e=>e.length?e.reduce((e,r)=>e+(Number(r[t])||0),0)/e.length:0}if("string"==typeof e.min){const t=e.min;return e=>e.length?Math.min(...e.map(e=>Number(e[t])||0)):0}if("string"==typeof e.max){const t=e.max;return e=>e.length?Math.max(...e.map(e=>Number(e[t])||0)):0}}return e=>e.length}function g(e,t){return"function"==typeof t?e.slice().sort(t):"asc"===t?e.slice().sort((e,t)=>e>t?1:e<t?-1:0):"desc"===t?e.slice().sort((e,t)=>e<t?1:e>t?-1:0):e}function p(e,t){if(!d(e))return-1;const r=t.length-1;if(e<t[0]||e>t[r])return-1;if(e===t[r])return r-1;for(let s=0;s<r;s++)if(e>=t[s]&&e<t[s+1])return s;return-1}function m(e){const t=[];for(let r=0;r<e.length-1;r++)t.push(f((e[r]+e[r+1])/2));return t}class y{constructor(e,t){this.dims=new Map,this.listeners=new Map,this.id=e,this.records=Array.isArray(t)?t:[]}static store(){const e=globalThis;return e[h]||(e[h]=new Map),e[h]}static getOrCreate(e){if(!e||"string"!=typeof e.id)throw new Error("Crossfilter.getOrCreate requires an { id } string.");const t=y.store(),r=t.get(e.id);if(r)return e.records&&r.setRecords(e.records),r;const s=new y(e.id,e.records);return t.set(e.id,s),s}static get(e){return y.store().get(e)||null}setRecords(e){return this.records=Array.isArray(e)?e:[],this.dims.forEach(e=>this.recomputeDomain(e)),this.emit("records",this.state()),this.emit("change",this.state()),this}registerDimension(e,t){if(!t||"function"!=typeof t.dimension)throw new Error(`crossfilter.registerDimension("${e}") needs a dimension function.`);const r=t.type||(t.bins?"range":"category"),s={accessor:t.dimension,reducer:u(t.reduce),type:r,bins:t.bins,order:t.order,filter:null,labels:[],edges:null,xLabels:[],yLabels:[]};return this.dims.set(e,s),this.recomputeDomain(s),null!=t.filter&&this.setFilterOn(s,t.filter),this}hasDimension(e){return this.dims.has(e)}removeDimension(e){const t=this.dims.get(e),r=!!t&&this.hasFilter(t);return this.dims.delete(e),r&&this.emit("change",this.state()),this}recomputeDomain(e){if("matrix"===e.type){const t=function(e,t,r){const s=new Set,i=new Set,n=[],a=[];for(let r=0;r<e.length;r++){const o=t(e[r]);if(!o)continue;const l=o[0],c=o[1];null==l||s.has(l)||(s.add(l),n.push(l)),null==c||i.has(c)||(i.add(c),a.push(c))}return{xLabels:g(n,r),yLabels:g(a,r)}}(this.records,e.accessor,e.order);return e.xLabels=t.xLabels,e.yLabels=t.yLabels,void(e.edges=null)}if("range"===e.type)return e.edges=function(e,t,r){if(r&&Array.isArray(r.thresholds)&&r.thresholds.length>=2){const e=Array.from(new Set(r.thresholds.filter(d))).sort((e,t)=>e-t);return e.length>=2?e.map(f):[0,1]}let s=1/0,i=-1/0;for(let r=0;r<e.length;r++){const n=t(e[r]);d(n)&&(n<s&&(s=n),n>i&&(i=n))}if(s===1/0)return[0,1];if(s===i){const e=Math.abs(s)>0?Math.abs(s):1;return[f(s),f(s+e)]}if(r&&d(r.width)&&r.width>0){const e=r.width,t=Math.floor(s/e)*e;let n=Math.ceil(i/e)*e;n<=t&&(n=t+e);const a=Math.max(1,Math.round((n-t)/e)),o=new Array(a+1);for(let r=0;r<=a;r++)o[r]=f(t+r*e);return o}const n=r&&d(r.count)&&r.count>=1?Math.floor(r.count):30,a=(i-s)/n,o=new Array(n+1);for(let e=0;e<=n;e++)o[e]=f(s+e*a);return o[n]=f(i),o}(this.records,e.accessor,e.bins),void(e.labels=m(e.edges));if(e.labels=function(e,t,r){const s=new Set,i=[];for(let r=0;r<e.length;r++){const n=t(e[r]);null!=n&&(s.has(n)||(s.add(n),i.push(n)))}return g(i,r)}(this.records,e.accessor,e.order),e.edges=null,e.filter instanceof Set){const t=new Set(e.labels);Array.from(e.filter).forEach(r=>{t.has(r)||e.filter.delete(r)})}}filter(e,t){const r=this.dims.get(e);return r?(this.setFilterOn(r,t),this.emit("change",this.state()),this):this}toggleKey(e,t){const r=this.dims.get(e);if(!r||"category"!==r.type)return this;r.filter instanceof Set||(r.filter=new Set);const s=r.filter;return s.has(t)?s.delete(t):s.add(t),0===s.size&&(r.filter=null),this.emit("change",this.state()),this}setFilterOn(e,t){if(null==t)return void(e.filter=null);if("range"===e.type){if(Array.isArray(t)&&2===t.length&&t.every(d)){const[r,s]=t;e.filter=[Math.min(r,s),Math.max(r,s)]}else e.filter=null;return}const r=new Set(t);e.filter=r.size?r:null}clear(e){const t=this.dims.get(e);return t&&(t.filter=null),this.emit("change",this.state()),this}reset(){return this.dims.forEach(e=>{e.filter=null}),this.emit("change",this.state()),this}hasFilter(e){return null!=e.filter&&(!(e.filter instanceof Set)||e.filter.size>0)}passes(e,t){if(!this.hasFilter(e))return!0;const r=e.accessor(t);if(e.filter instanceof Set)return e.filter.has(r);if(!d(r))return!1;const[s,i]=e.filter;return r>=s&&r<=i}filteredRecords(e){const t=[];return this.dims.forEach((r,s)=>{s!==e&&this.hasFilter(r)&&t.push(r)}),0===t.length?this.records:this.records.filter(e=>t.every(t=>this.passes(t,e)))}filteredRows(){return this.filteredRecords(null)}aggregateFor(e){const t=this.dims.get(e);if(!t)return{type:"category",labels:[],values:[],keys:[]};const r=this.filteredRecords(e);if("matrix"===t.type){const e=new Map(t.xLabels.map((e,t)=>[e,t])),s=new Map(t.yLabels.map((e,t)=>[e,t])),i=t.yLabels.map(()=>t.xLabels.map(()=>[]));for(let n=0;n<r.length;n++){const a=t.accessor(r[n]);if(!a)continue;const o=e.get(a[0]),l=s.get(a[1]);null!=o&&null!=l&&i[l][o].push(r[n])}return{type:"matrix",xLabels:t.xLabels.slice(),yLabels:t.yLabels.slice(),matrix:i.map(e=>e.map(e=>t.reducer(e)))}}if("range"===t.type){const e=t.edges||[0,1],s=e.length-1,i=Array.from({length:s},()=>[]);for(let s=0;s<r.length;s++){const n=p(t.accessor(r[s]),e);n>=0&&i[n].push(r[s])}return{type:"range",labels:m(e),values:i.map(e=>t.reducer(e)),keys:i.map((t,r)=>[e[r],e[r+1]]),edges:e}}const s=new Map;t.labels.forEach(e=>s.set(e,[]));for(let e=0;e<r.length;e++){const i=s.get(t.accessor(r[e]));i&&i.push(r[e])}return{type:"category",labels:t.labels.slice(),values:t.labels.map(e=>t.reducer(s.get(e)||[])),keys:t.labels.slice()}}aggregateAll(){const e={};return this.dims.forEach((t,r)=>{e[r]=this.aggregateFor(r)}),e}state(){const e={};return this.dims.forEach((t,r)=>{this.hasFilter(t)&&(e[r]=t.filter instanceof Set?Array.from(t.filter):t.filter.slice())}),{filters:e,filteredCount:this.filteredRows().length,total:this.records.length}}filterOf(e){const t=this.dims.get(e);return t&&this.hasFilter(t)?t.filter instanceof Set?new Set(t.filter):t.filter.slice():null}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>this.off(e,t)}off(e,t){var r;return null==(r=this.listeners.get(e))||r.delete(t),this}emit(e,t){var r;null==(r=this.listeners.get(e))||r.forEach(r=>{try{r(t)}catch(t){!function(e,...t){c.error(e,...t)}(`[Apex] a crossfilter ${e} listener threw`,t)}})}static esc(e){return String(null==e?"":e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}resolveColumns(e){if(Array.isArray(e)&&e.length)return e.map(e=>"string"==typeof e?{field:e,label:e}:{field:e.field,label:e.label||e.field,format:e.format});const t=this.records[0];return(t?Object.keys(t):[]).map(e=>({field:e,label:e}))}tableHTML(e,t,r){const s="<thead><tr>"+e.map(e=>`<th>${y.esc(e.label)}</th>`).join("")+"</tr></thead>",i="<tbody>"+t.map(t=>"<tr>"+e.map(e=>{const r=t[e.field],s=e.format?e.format(r,t):r;return`<td>${y.esc(s)}</td>`}).join("")+"</tr>").join("")+"</tbody>";return`<table class="apexcharts-cf-table"><caption>${t.length} of ${r} rows</caption>${s}${i}</table>`}dataTable(e,t){if(!e)return{refresh(){},destroy(){}};const r=t||{},s=this.resolveColumns(r.columns),i=r.pageSize||0,n=r.page||0,a=()=>{const t=this.filteredRows(),r=i?t.slice(n*i,n*i+i):t;e.innerHTML=this.tableHTML(s,r,t.length)};a();const o=this.on("change",a);return{refresh:a,destroy:()=>{o(),e.innerHTML=""}}}destroy(){y.store().delete(this.id),this.dims.clear(),this.listeners.clear(),this.records=[]}}const x=[".apexcharts-bar-area",".apexcharts-candlestick-area",".apexcharts-boxPlot-area",".apexcharts-rangebar-area",".apexcharts-marker"].join(", "),_=[".apexcharts-pie-area",".apexcharts-bar-area"].join(", "),b="apexcharts-crossfilter-dimmed",w=["pie","donut","polarArea","radialBar"];l.registerFeatures({linkedViews:class{constructor(e,t){this.w=e,this.ctx=t,this._dimmed=!1,this._wired=!1,this._pending=!1,this._lastValues=null,this._onPointSelect=this._onPointSelect.bind(this),this._afterRender=this._afterRender.bind(this),this._onChange=this._onChange.bind(this),"filter"===this._mode()&&this._initEngine()}_mode(){const e=this.w.config.chart.link;return e&&"function"==typeof e.dimension?"filter":e&&e.enabled?"highlight":"off"}_enabled(){const e=this.w.config.chart.link;return!(!e||!e.enabled)}onSourceSelection(e){var t;const r=this._mode();if("off"===r)return;if(!e||null==e.min||null==e.max)return;let s=Math.min(e.min,e.max),i=Math.max(e.min,e.max);const n=this.w.globals.minX,a=this.w.globals.maxX;if(isFinite(n)&&isFinite(a)&&a>n){const e=1e-6*(a-n);s-n<=e&&(s=n),a-i<=e&&(i=a)}if("filter"===r){const e=this._cf();if(!e)return;return e.filter(this._chartId(),[s,i]),void this._fireFilterChange(e,[s,i])}this._group().forEach(e=>{var t;null==(t=null==e?void 0:e.linkedViews)||t.applyDim(s,i)});const o={xaxis:{min:s,max:i},sourceChartID:this.w.globals.chartID};"function"==typeof this.w.config.chart.events.crossFilter&&this.w.config.chart.events.crossFilter(this.ctx,o),null==(t=this.ctx.events)||t.fireEvent("crossFilter",[this.ctx,o])}_group(){const e="function"==typeof this.ctx.getGroupedCharts?this.ctx.getGroupedCharts():[];return[this.ctx,...e]}applyDim(e,t){if(!this._enabled())return;const r=this.w,s=r.dom.baseEl;if(!s)return;const i=r.config.chart.link.dimOpacity;r.dom.elWrap&&"number"==typeof i&&r.dom.elWrap.style.setProperty("--apx-cf-dim",String(i));const n=r.globals.seriesX||[];s.querySelectorAll(x).forEach(r=>{const s=r.getAttribute("j");if(null===s)return;const i=parseInt(s,10),a=r.getAttribute("index"),o=null===a?0:parseInt(a,10),l=n[o]||n[0];if(!l)return;const c=l[i];null!=c&&r.classList.toggle(b,c<e||c>t)}),this._dimmed=!0}clear(){const e=this.w.dom.baseEl;e&&(e.querySelectorAll("."+b).forEach(e=>e.classList.remove(b)),this._dimmed=!1)}clearGroup(){if("filter"===this._mode()){const e=this._cf();return void(e&&e.reset())}this._group().forEach(e=>{var t;return null==(t=null==e?void 0:e.linkedViews)?void 0:t.clear()})}_chartId(){return this.w.globals.chartID}_cf(){const e=this.w.config.chart.link,t=e&&(e.id||this.w.config.chart.group);return t?y.get(t):null}_isPie(){return-1!==w.indexOf(this.w.config.chart.type)}_isHeatmap(){return"heatmap"===this.w.config.chart.type}_initEngine(){const e=this._cf(),t=this.w.config.chart.link;if(!e){const e=t&&t.id||this.w.config.chart.group;return void console.warn(`[apexcharts] chart.link.dimension is set but no crossfilter coordinator "${e}" exists. Call ApexCharts.crossfilter({ id, records }) before creating the chart.`)}const r=this._chartId();e.hasDimension(r)||e.registerDimension(r,{dimension:t.dimension,reduce:t.reduce,type:t.type||(this._isHeatmap()?"matrix":void 0),bins:t.bins,order:t.order}),this._injectSeries(e.aggregateFor(r)),this._wire(e)}_seriesFromAgg(e){if("matrix"===e.type)return e.yLabels.map((t,r)=>({name:String(t),data:e.xLabels.map((t,s)=>({x:String(t),y:e.matrix[r][s]}))}));if(this._isPie())return e.values.slice();const t=this.w.config.chart.link.seriesName||"Count";return"range"===e.type?[{name:t,data:e.labels.map((t,r)=>[t,e.values[r]])}]:[{name:t,data:e.values.slice()}]}_sigOf(e){return JSON.stringify(e.matrix||e.values)}_injectSeries(e){const t=this.w;this._lastValues=this._sigOf(e),t.config.series=this._seriesFromAgg(e),"matrix"!==e.type&&(this._isPie()?t.config.labels=e.labels.map(String):"category"===e.type?(t.config.xaxis||(t.config.xaxis={}),t.config.xaxis.categories=e.labels.map(String)):"range"===e.type&&this._pinRangeDomain(e.edges))}_pinRangeDomain(e){if(!Array.isArray(e)||e.length<2)return;const t=this.w;t.config.xaxis||(t.config.xaxis={}),null==t.config.xaxis.min&&(t.config.xaxis.min=e[0]),null==t.config.xaxis.max&&(t.config.xaxis.max=e[e.length-1])}_wire(e){this._wired||(this._wired=!0,this.ctx.addEventListener("dataPointSelection",this._onPointSelect),this.ctx.addEventListener("mounted",this._afterRender),this.ctx.addEventListener("updated",this._afterRender),e.on("change",this._onChange))}_onPointSelect(e,t,r){if("filter"!==this._mode()||!r||null==r.dataPointIndex)return;const s=this._cf();if(!s)return;const i=this._chartId(),n=s.aggregateFor(i);if("matrix"===n.type)return;const a=n.keys[r.dataPointIndex];null!=a&&(s.toggleKey(i,a),this._fireFilterChange(s,a))}_onChange(){"filter"!==this._mode()||this._pending||(this._pending=!0,Promise.resolve().then(()=>{this._pending=!1,this.w.globals.isDestroyed||this._applyAggregation()}))}_applyAggregation(){if("filter"!==this._mode())return;const e=this._cf();if(!e)return;const t=e.aggregateFor(this._chartId()),r=this._sigOf(t);r!==this._lastValues?(this._lastValues=r,this.ctx.updateSeries(this._seriesFromAgg(t),!0)):this._applySelfDim()}_afterRender(){if("filter"!==this._mode())return;const e=this.w.config.series;e&&0!==e.length?this._applySelfDim():this._reassertSeries()}_reassertSeries(){this._pending||(this._pending=!0,Promise.resolve().then(()=>{if(this._pending=!1,this.w.globals.isDestroyed)return;const e=this._cf();if(!e)return;const t=e.aggregateFor(this._chartId()),r=this._seriesFromAgg(t);r.length&&(this._lastValues=this._sigOf(t),this.ctx.updateSeries(r,!0))}))}_applySelfDim(){const e=this._cf();if(!e)return;const t=this.w,r=t.dom.baseEl;if(!r)return;const s=this._chartId(),i=e.filterOf(s),n=t.config.chart.link.dimOpacity;t.dom.elWrap&&"number"==typeof n&&t.dom.elWrap.style.setProperty("--apx-cf-dim",String(n));const a=i instanceof Set,o=Array.isArray(i),l=e.aggregateFor(s);if("matrix"===l.type)return;const c=l.keys;r.querySelectorAll(_).forEach(e=>{const t=e.getAttribute("j");if(null===t)return;const r=c[parseInt(t,10)];let s=!1;a?s=!i.has(r):o&&Array.isArray(r)&&(s=r[1]<=i[0]||r[0]>=i[1]),e.classList.toggle(b,s)}),this._dimmed=!!i}_fireFilterChange(e,t){var l;const c=(h=((e,t)=>{for(var r in t||(t={}))n.call(t,r)&&o(e,r,t[r]);if(i)for(var r of i(t))a.call(t,r)&&o(e,r,t[r]);return e})({},e.state()),f={sourceChartID:this._chartId(),key:t},r(h,s(f)));var h,f;const d=this.w.config.chart.events;"function"==typeof d.filterChange&&d.filterChange(this.ctx,c),null==(l=this.ctx.events)||l.fireEvent("filterChange",[this.ctx,c])}teardown(){var e,t,r,s,i,n;if(this.clear(),this._wired){null==(t=(e=this.ctx).removeEventListener)||t.call(e,"dataPointSelection",this._onPointSelect),null==(s=(r=this.ctx).removeEventListener)||s.call(r,"mounted",this._afterRender),null==(n=(i=this.ctx).removeEventListener)||n.call(i,"updated",this._afterRender);const a=this._cf();a&&(a.off("change",this._onChange),a.removeDimension(this._chartId())),this._wired=!1}}},crossfilter:y}),e.default=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexLink={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.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 r in e)if("default"!==r){const l=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,l.get?l:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const t=e(require("apexcharts/core")),r=t.__apex_Graphics,l=t.__apex_Utils;t.default._customSeriesFactory=function(e,t){const s=class{constructor(e,t,r){this.w=e,this.ctx=t,this.xyRatios=r,this._warned=!1}draw(s,a,n){var i,o;const u=this.w,c=new r(u,this.ctx),d=function(e,t){const r=e&&e.renderer;return r&&r.kind&&"svg"!==r.kind?r:t}(this.ctx,c),h=c.group({class:"apexcharts-marks-series"});return s.forEach((r,s)=>{var a;const i=Array.isArray(n)?n[s]:s,o=c.group({class:"apexcharts-series",rel:i+1,seriesName:l.escapeString(u.seriesData.seriesNames[i]),"data:realIndex":i}),x=this._scales(i,(u.seriesData.series[i]||[]).length),y=u.globals.colors[i],p=(null==(a=u.config.series[i])?void 0:a.data)||[],f=u.seriesData.seriesX[i]||[],g=u.seriesData.series[i]||[];u.globals.seriesXvalues[i]=[],u.globals.seriesYvalues[i]=[],void 0===u.globals.pointsArray[i]&&(u.globals.pointsArray[i]=[]);for(let r=0;r<g.length;r++){const l=g[r];if(null==l)continue;const s=f[r],a=x.xAt(r,s),n=x.y(l),c=this._api(d,o,i,r);try{t.renderItem({datum:p[r],x:a,y:n,scales:x,api:c,seriesIndex:i,dataPointIndex:r,color:y})}catch(t){this._warned||(console.warn(`[apexcharts] renderItem for series type "${e}" threw; skipping datum:`,t),this._warned=!0)}u.globals.seriesXvalues[i][r]=a,u.globals.seriesYvalues[i][r]=n,u.globals.pointsArray[i][r]=[a,n]}c.setupEventDelegation(o,".apexcharts-marks-mark"),h.add(o)}),null==(o=null==(i=this.ctx.animations)?void 0:i.animationCompleted)||o.call(i,h),h}_scales(e,t){var r,l,s,a;const n=this.w.globals,i=this.w.config,o=this.xyRatios.xRatio,u=this.xyRatios.yRatio,c=null!=(l=null==(r=n.seriesYAxisReverseMap)?void 0:r[e])?l:0,d=Array.isArray(u)?null!=(s=u[c])?s:u[0]:u,h=n.maxYArr,x=Array.isArray(h)&&h.length&&null!=(a=h[c])?a:n.maxY,y=n.gridWidth,p=n.gridHeight,f=!n.isXNumeric,g=t||n.dataPoints||1,k=g>0?y/g:y,m="on"===i.xaxis.tickPlacement,b=e=>o?(e-n.minX)/o:y/2,v=n.minXDiff||1;return{x:b,xAt:(e,t)=>f?m&&g>1?e/(g-1)*y:(e+.5)*k:b(t),y:e=>(x-e)/d,gridWidth:y,gridHeight:p,band:f?k:o?v/o:y}}_api(e,t,r,l){const s=e=>{if(e){try{e.node.setAttribute("index",String(r)),e.node.setAttribute("j",String(l)),e.node.classList.add("apexcharts-marks-mark")}catch(e){}t.add(e)}return e};return{path:(t={})=>{var r,l,a,n,i,o,u,c,d;return s(e.drawPath({d:t.d||"",stroke:null!=(r=t.stroke)?r:"#000",strokeWidth:null!=(a=null!=(l=t.width)?l:t.strokeWidth)?a:1,fill:null!=(n=t.fill)?n:"none",fillOpacity:null!=(o=t.fillOpacity)?o:t.fill&&"none"!==t.fill?null!=(i=t.opacity)?i:1:0,strokeOpacity:null!=(c=null!=(u=t.strokeOpacity)?u:t.opacity)?c:1,strokeDashArray:null!=(d=t.dash)?d:0,strokeLinecap:t.lineCap}))},line:(t={})=>{var r,l,a,n;return s(e.drawLine(t.x1,t.y1,t.x2,t.y2,null!=(r=t.stroke)?r:"#000",null!=(l=t.dash)?l:0,null!=(n=null!=(a=t.width)?a:t.strokeWidth)?n:1))},rect:(t={})=>{var r,l,a,n,i,o,u,c;return s(e.drawRect(null!=(r=t.x)?r:0,null!=(l=t.y)?l:0,null!=(a=t.w)?a:0,null!=(n=t.h)?n:0,null!=(i=t.r)?i:0,null!=(o=t.fill)?o:"#000",null!=(u=t.opacity)?u:1,null!=t.stroke?null!=(c=t.strokeWidth)?c:1:null,t.stroke))},circle:(t={})=>{var r,l,a,n,i;return s(e.drawCircle(null!=(r=t.r)?r:0,{cx:null!=(l=t.cx)?l:0,cy:null!=(a=t.cy)?a:0,fill:null!=(n=t.fill)?n:"#000",stroke:t.stroke||"none","stroke-width":null!=(i=t.strokeWidth)?i:t.stroke?1:0}))},text:(t={})=>{var r,l,a,n;return s(e.drawText({x:null!=(r=t.x)?r:0,y:null!=(l=t.y)?l:0,text:null!=(a=t.text)?a:"",textAnchor:null!=(n=t.anchor)?n:"start",fontSize:t.size,foreColor:t.color,fontWeight:t.weight}))}}}};return s.dataType=t.dataType||"xy",s.yExtent="function"==typeof t.yExtent?t.yExtent:null,s},Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
package/dist/features/marks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e){var t="undefined"!=typeof globalThis?globalThis:self,s=t.ApexCharts;if(s&&s.__internals)return e.call(t);if(s)throw new Error("ApexCharts: dist/features/marks.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return e.call(t);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/marks.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var r={file:"dist/features/marks.js",run:e,done:!1},a=t.__apexcharts_pending_addons__||(t.__apexcharts_pending_addons__=[]);a.push(r),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!r.done){var s=t.ApexCharts;if(s)if(s.__internals){r.done=!0;var n=a.indexOf(r);-1!==n&&a.splice(n,1);try{e.call(t),s.__drainsAddons||t.console.warn("ApexCharts: dist/features/marks.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(e){t.console.error("ApexCharts: dist/features/marks.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/marks.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else t.console.warn("ApexCharts: dist/features/marks.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var e,t;e=this,t=function(e){"use strict";const t=globalThis.ApexCharts,s=globalThis.ApexCharts.__internals.__apex_Graphics,r=globalThis.ApexCharts.__internals.__apex_Utils;t._customSeriesFactory=function(e,t){const a=class{constructor(e,t,s){this.w=e,this.ctx=t,this.xyRatios=s,this._warned=!1}draw(a,n,i){var l,o;const d=this.w,c=new s(d,this.ctx),h=function(e,t){const s=e&&e.renderer;return s&&s.kind&&"svg"!==s.kind?s:t}(this.ctx,c),u=c.group({class:"apexcharts-marks-series"});return a.forEach((s,a)=>{var n;const l=Array.isArray(i)?i[a]:a,o=c.group({class:"apexcharts-series",rel:l+1,seriesName:r.escapeString(d.seriesData.seriesNames[l]),"data:realIndex":l}),p=this._scales(l,(d.seriesData.series[l]||[]).length),f=d.globals.colors[l],x=(null==(n=d.config.series[l])?void 0:n.data)||[],g=d.seriesData.seriesX[l]||[],y=d.seriesData.series[l]||[];d.globals.seriesXvalues[l]=[],d.globals.seriesYvalues[l]=[],void 0===d.globals.pointsArray[l]&&(d.globals.pointsArray[l]=[]);for(let s=0;s<y.length;s++){const r=y[s];if(null==r)continue;const a=g[s],n=p.xAt(s,a),i=p.y(r),c=this._api(h,o,l,s);try{t.renderItem({datum:x[s],x:n,y:i,scales:p,api:c,seriesIndex:l,dataPointIndex:s,color:f})}catch(t){this._warned||(console.warn(`[apexcharts] renderItem for series type "${e}" threw; skipping datum:`,t),this._warned=!0)}d.globals.seriesXvalues[l][s]=n,d.globals.seriesYvalues[l][s]=i,d.globals.pointsArray[l][s]=[n,i]}c.setupEventDelegation(o,".apexcharts-marks-mark"),u.add(o)}),null==(o=null==(l=this.ctx.animations)?void 0:l.animationCompleted)||o.call(l,u),u}_scales(e,t){var s,r,a,n;const i=this.w.globals,l=this.w.config,o=this.xyRatios.xRatio,d=this.xyRatios.yRatio,c=null!=(r=null==(s=i.seriesYAxisReverseMap)?void 0:s[e])?r:0,h=Array.isArray(d)?null!=(a=d[c])?a:d[0]:d,u=i.maxYArr,p=Array.isArray(u)&&u.length&&null!=(n=u[c])?n:i.maxY,f=i.gridWidth,x=i.gridHeight,g=!i.isXNumeric,y=t||i.dataPoints||1,m=y>0?f/y:f,A="on"===l.xaxis.tickPlacement,w=e=>o?(e-i.minX)/o:f/2,_=i.minXDiff||1;return{x:w,xAt:(e,t)=>g?A&&y>1?e/(y-1)*f:(e+.5)*m:w(t),y:e=>(p-e)/h,gridWidth:f,gridHeight:x,band:g?m:o?_/o:f}}_api(e,t,s,r){const a=e=>{if(e){try{e.node.setAttribute("index",String(s)),e.node.setAttribute("j",String(r)),e.node.classList.add("apexcharts-marks-mark")}catch(e){}t.add(e)}return e};return{path:(t={})=>{var s,r,n,i,l,o,d,c,h;return a(e.drawPath({d:t.d||"",stroke:null!=(s=t.stroke)?s:"#000",strokeWidth:null!=(n=null!=(r=t.width)?r:t.strokeWidth)?n:1,fill:null!=(i=t.fill)?i:"none",fillOpacity:null!=(o=t.fillOpacity)?o:t.fill&&"none"!==t.fill?null!=(l=t.opacity)?l:1:0,strokeOpacity:null!=(c=null!=(d=t.strokeOpacity)?d:t.opacity)?c:1,strokeDashArray:null!=(h=t.dash)?h:0,strokeLinecap:t.lineCap}))},line:(t={})=>{var s,r,n,i;return a(e.drawLine(t.x1,t.y1,t.x2,t.y2,null!=(s=t.stroke)?s:"#000",null!=(r=t.dash)?r:0,null!=(i=null!=(n=t.width)?n:t.strokeWidth)?i:1))},rect:(t={})=>{var s,r,n,i,l,o,d,c;return a(e.drawRect(null!=(s=t.x)?s:0,null!=(r=t.y)?r:0,null!=(n=t.w)?n:0,null!=(i=t.h)?i:0,null!=(l=t.r)?l:0,null!=(o=t.fill)?o:"#000",null!=(d=t.opacity)?d:1,null!=t.stroke?null!=(c=t.strokeWidth)?c:1:null,t.stroke))},circle:(t={})=>{var s,r,n,i,l;return a(e.drawCircle(null!=(s=t.r)?s:0,{cx:null!=(r=t.cx)?r:0,cy:null!=(n=t.cy)?n:0,fill:null!=(i=t.fill)?i:"#000",stroke:t.stroke||"none","stroke-width":null!=(l=t.strokeWidth)?l:t.stroke?1:0}))},text:(t={})=>{var s,r,n,i;return a(e.drawText({x:null!=(s=t.x)?s:0,y:null!=(r=t.y)?r:0,text:null!=(n=t.text)?n:"",textAnchor:null!=(i=t.anchor)?i:"start",fontSize:t.size,foreColor:t.color,fontWeight:t.weight}))}}}};return a.dataType=t.dataType||"xy",a.yExtent="function"==typeof t.yExtent?t.yExtent:null,a},e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexMarks={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";var e=Object.defineProperty,t=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i,a=(e,t)=>{for(var s in t||(t={}))r.call(t,s)&&o(e,s,t[s]);if(i)for(var s of i(t))n.call(t,s)&&o(e,s,t[s]);return e},h=(e,i)=>t(e,s(i));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function d(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const s in e)if("default"!==s){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>e[s]})}return t.default=e,Object.freeze(t)}const c=d(require("apexcharts/core")),l=c.__apex_Graphics,u=c.__apex_tooltip_Utils,_=c.__apex_Environment_Environment;c.default.registerFeatures({measure:class{constructor(e,t){this.w=e,this.ctx=t,this.graphics=new l(e),this.pins=[],this.drag=null,this.armed=!1,this.persistent=!1,this.pane=null,this._seedActive=!1,this._onKeyDown=this._onKeyDown.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onDown=this._onDown.bind(this),this._onMove=this._onMove.bind(this),this._onUp=this._onUp.bind(this),this._onSeedDown=this._onSeedDown.bind(this),this._onSeedKey=this._onSeedKey.bind(this),this._afterRender=this._afterRender.bind(this),t.addEventListener("mounted",this._afterRender),t.addEventListener("updated",this._afterRender),this._bindKeys()}_cfg(){return this.w.config.chart.measure||{}}_enabled(){return this.w.globals.axisCharts&&!0===this._cfg().enabled}_mode(){return"free"===this._cfg().mode?"free":"span"}_snapToSeries(e){const t=(this.w.config.series||[])[0];if(!t)return null;const s=this._points(t.data||[]);if(!s.length)return null;let i=s[0],r=Math.abs(s[0].x-e);for(let t=1;t<s.length;t++){const n=Math.abs(s[t].x-e);n<r&&(r=n,i=s[t])}return i}_resolve(e){if("free"===this._mode())return e;const t=this._snapToSeries(e.x);if(!t)return e;const s=this._dataToGrid(t.x,t.y);return{x:t.x,y:t.y,gx:s.gx,gy:s.gy}}_doc(){return this.w.dom.baseEl&&this.w.dom.baseEl.ownerDocument}_bindKeys(){if(this._keysBound)return;const e=this._doc();e&&(e.addEventListener("keydown",this._onKeyDown),e.addEventListener("keyup",this._onKeyUp),this._keysBound=!0)}_onKeyDown(e){if(!this._enabled()||this.persistent)return;const t=this._cfg().key||"m";e.key&&e.key.toLowerCase()===String(t).toLowerCase()?this._arm():"Escape"===e.key&&this._cancelDrag()}_onKeyUp(e){if(this.persistent)return;const t=this._cfg().key||"m";e.key&&e.key.toLowerCase()===String(t).toLowerCase()&&(this.drag||this._disarm())}startMeasure(){this._enabled()&&(this.persistent=!0,this._arm())}stopMeasure(){this.persistent=!1,this._cancelDrag(),this._disarm()}seedFromClient(e,t){if(!this._enabled())return;this._cancelDrag(),this._endSeed(!1);const s=this._project(e,t);this.drag={a:s,b:s},this._seedActive=!0;const i=this._doc();i&&(i.addEventListener("mousemove",this._onMove),i.addEventListener("touchmove",this._onMove,{passive:!1}),i.addEventListener("mousedown",this._onSeedDown,!0),i.addEventListener("touchstart",this._onSeedDown,!0),i.addEventListener("keydown",this._onSeedKey,!0)),this._renderLive()}_onSeedDown(e){if(!this._seedActive||!this.drag)return;e.preventDefault(),e.stopPropagation();const{cx:t,cy:s}=this._clientXY(e);this.drag.b=this._project(t,s),this._endSeed(!0)}_onSeedKey(e){"Escape"===e.key&&this._endSeed(!1)}_endSeed(e){var t,s;if(!this._seedActive)return;this._seedActive=!1;const i=this._doc();i&&(i.removeEventListener("mousemove",this._onMove),i.removeEventListener("touchmove",this._onMove),i.removeEventListener("mousedown",this._onSeedDown,!0),i.removeEventListener("touchstart",this._onSeedDown,!0),i.removeEventListener("keydown",this._onSeedKey,!0));const r=this.drag;if(this.drag=null,this._clearLive(),!e||!r)return;const n=this._resolve(r.a),o=this._resolve(r.b);if(Math.abs(n.gx-o.gx)<2&&Math.abs(n.gy-o.gy)<2)return;const a=this._mode();!1!==this._cfg().pinOnRelease&&(this.pins.push({xa:n.x,ya:n.y,xb:o.x,yb:o.y,mode:a}),this._renderPins(),null==(s=null==(t=this.ctx.history)?void 0:t.snapshot)||s.call(t,"measure")),this._fireMeasured(n,o)}clearMeasures(){var e,t;this.pins=[],this._renderPins(),null==(t=null==(e=this.ctx.history)?void 0:e.snapshot)||t.call(e,"clear measures")}getPins(){return this.pins.map(e=>({xa:e.xa,ya:e.ya,xb:e.xb,yb:e.yb,mode:"free"===e.mode?"free":"span"}))}setPins(e){this.pins=Array.isArray(e)?e.filter(e=>e&&isFinite(e.xa)&&isFinite(e.ya)&&isFinite(e.xb)&&isFinite(e.yb)).map(e=>({xa:+e.xa,ya:+e.ya,xb:+e.xb,yb:+e.yb,mode:"free"===e.mode?"free":"span"})):[],this._renderPins()}_points(e){const t=[];for(let s=0;s<e.length;s++){const i=e[s];let r,n;Array.isArray(i)?(r=+i[0],n=+i[1]):i&&"object"==typeof i?(r=+i.x,n=+i.y):(r=s,n=+i),isFinite(r)&&isFinite(n)&&t.push({x:r,y:n})}return t}_arm(){if(this.armed||!this._enabled())return;const e=this.w,t=e.dom.elGraphical;if(!t)return;this.armed=!0;const s=this.graphics.drawRect(0,0,e.layout.gridWidth,e.layout.gridHeight);s.node.setAttribute("class","apexcharts-measure-capture"),s.node.setAttribute("fill","transparent"),s.node.style.cursor="crosshair",s.node.style.pointerEvents="all",s.node.addEventListener("mousedown",this._onDown),s.node.addEventListener("touchstart",this._onDown,{passive:!1}),t.add(s),this.pane=s}_disarm(){if(this.armed=!1,this.pane){this.pane.node.removeEventListener("mousedown",this._onDown),this.pane.node.removeEventListener("touchstart",this._onDown);const e=this.pane.node;e.parentNode&&e.parentNode.removeChild(e),this.pane=null}}_clientXY(e){const t=e.touches&&e.touches[0]?e.touches[0]:e;return{cx:t.clientX,cy:t.clientY}}_plotRect(){const e=this.w;return e.dom.baseEl&&e.dom.baseEl.querySelector(".apexcharts-svg")?u.plotRect(e):null}_yRange(){const e=this.w.globals,t=e.yAxisScale&&e.yAxisScale[0];return t&&isFinite(t.niceMin)&&isFinite(t.niceMax)&&t.niceMax!==t.niceMin?[t.niceMin,t.niceMax]:[e.minY,e.maxY]}_project(e,t){const s=this.w,i=this._plotRect(),r=s.layout.gridWidth,n=s.layout.gridHeight,o=e=>e<0?0:e>1?1:e,a=i&&i.width?o((e-i.left)/i.width):0,h=i&&i.height?o((t-i.top)/i.height):0,[d,c]=this._yRange();return{x:s.globals.minX+a*(s.globals.maxX-s.globals.minX),y:c-h*(c-d),gx:a*r,gy:h*n}}_dataToGrid(e,t){const s=this.w,i=s.layout.gridWidth,r=s.layout.gridHeight,n=s.globals.maxX-s.globals.minX||1,[o,a]=this._yRange(),h=a-o||1;return{gx:(e-s.globals.minX)/n*i,gy:r-(t-o)/h*r}}_onDown(e){if(!this.armed)return;e.preventDefault(),e.stopPropagation();const{cx:t,cy:s}=this._clientXY(e),i=this._project(t,s);this.drag={a:i,b:i};const r=this._doc();r&&(r.addEventListener("mousemove",this._onMove),r.addEventListener("mouseup",this._onUp),r.addEventListener("touchmove",this._onMove,{passive:!1}),r.addEventListener("touchend",this._onUp)),this._renderLive()}_onMove(e){if(!this.drag)return;e.cancelable&&e.preventDefault();const{cx:t,cy:s}=this._clientXY(e);this.drag.b=this._project(t,s),this._renderLive()}_onUp(e){var t,s;const i=this._doc();if(i&&(i.removeEventListener("mousemove",this._onMove),i.removeEventListener("mouseup",this._onUp),i.removeEventListener("touchmove",this._onMove),i.removeEventListener("touchend",this._onUp)),!this.drag)return;const r=this.drag.a,n=this.drag.b;if(this.drag=null,this._clearLive(),Math.abs(r.gx-n.gx)<2&&Math.abs(r.gy-n.gy)<2)return void(this.persistent||this._disarm());const o=this._mode(),a=this._resolve(r),h=this._resolve(n);!1!==this._cfg().pinOnRelease&&(this.pins.push({xa:a.x,ya:a.y,xb:h.x,yb:h.y,mode:o}),this._renderPins(),null==(s=null==(t=this.ctx.history)?void 0:t.snapshot)||s.call(t,"measure")),this._fireMeasured(a,h),this.persistent||this._disarm()}_cancelDrag(){const e=this._doc();e&&(e.removeEventListener("mousemove",this._onMove),e.removeEventListener("mouseup",this._onUp),e.removeEventListener("touchmove",this._onMove),e.removeEventListener("touchend",this._onUp)),this.drag=null,this._clearLive()}_stats(e,t){const s=t.x-e.x,i=t.y-e.y;return{dx:s,dy:i,pct:0!==e.y?i/Math.abs(e.y)*100:NaN,slope:0!==s?i/s:NaN}}_fmt(e){if(!isFinite(e))return"n/a";const t=Math.abs(e);return 0!==t&&(t<.01||t>=1e6)?e.toExponential(2):String(Math.round(100*e)/100)}_computedStyle(){if(!_.isBrowser())return null;const e=this.w.dom.elGraphical&&this.w.dom.elGraphical.node;if(!e||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(e)}catch(e){return null}}_resolveColor(e,t,s,i){if(e)return e;const r=void 0!==i?i:this._computedStyle();return(r?r.getPropertyValue(t).trim():"")||s}_colors(){const e=this._cfg().colors||{},t=this._computedStyle();return{up:this._resolveColor(e.up,"--apx-measure-up","#16a34a",t),down:this._resolveColor(e.down,"--apx-measure-down","#dc2626",t),neutral:this._resolveColor(e.neutral,"--apx-measure-neutral","#64748b",t),guide:this._resolveColor(e.guide,"--apx-measure-guide","#94a3b8",t)}}_dirColor(e){const t=this._colors();return 0===e?t.neutral:e>0?t.up:t.down}_dirClass(e){return 0===e?"apexcharts-measure-flat":e>0?"apexcharts-measure-up":"apexcharts-measure-down"}_fmtPct(e){if(!isFinite(e))return"n/a";const t=this._cfg().format&&this._cfg().format.percent;if("function"==typeof t)try{const s=t(e);if(null!=s)return String(s)}catch(e){}return(e>=0?"+":"")+this._fmt(e)+"%"}_label(e,t,s,i){const r=this._cfg().label;if("function"==typeof r){const n=r({from:{x:e.x,y:e.y},to:{x:t.x,y:t.y},dx:s.dx,dy:s.dy,percentChange:s.pct,slope:s.slope,mode:i});return Array.isArray(n)?n.map(String):[String(n)]}if("span"===i){const i=0===s.dy?"":s.dy>0?" \u2191":" \u2193",r=isFinite(s.pct)?"("+this._fmtPct(s.pct)+")":"";return[this._fmtY(s.dy)+" "+r+i,this._fmtX(e.x)+" to "+this._fmtX(t.x)]}return["\u0394x "+this._fmtDx(s.dx),"\u0394y "+this._fmtY(s.dy),this._fmtPct(s.pct)]}_fmtDx(e){if("datetime"===this.w.config.xaxis.type){const t=e/864e5;return Math.round(10*t)/10+"d"}return this._fmt(e)}_fmtY(e){const t=this._cfg().format&&this._cfg().format.y;if("function"==typeof t)try{const s=t(e);if(null!=s)return String(s)}catch(e){}const s=this.w.globals.yLabelFormatters&&this.w.globals.yLabelFormatters[0];if("function"==typeof s)try{const t=s(e,{seriesIndex:0,dataPointIndex:-1,w:this.w});if(null!=t&&""!==t)return String(t)}catch(e){}return this._fmt(e)}_fmtX(e){const t=this.w,s=this._cfg().format&&this._cfg().format.x;if("function"==typeof s)try{const t=s(e);if(null!=t)return String(t)}catch(e){}if("datetime"===t.config.xaxis.type){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}const i=t.globals.xLabelFormatter;if("function"==typeof i)try{const s=i(e,{w:t});if(null!=s&&""!==s)return String(s)}catch(e){}return this._fmt(e)}_liveGroup(){const e=this.w;if(this._live&&this._live.node&&this._live.node.parentNode)return this._live;const t=this.graphics.group({class:"apexcharts-measure-live"});return t.node.style.pointerEvents="none",e.dom.elGraphical&&e.dom.elGraphical.add(t),this._live=t,t}_clearLive(){if(this._live&&this._live.node){const e=this._live.node;e.parentNode&&e.parentNode.removeChild(e)}this._live=null}_renderLive(){if(!this.drag)return;const e=this._liveGroup();for(;e.node.firstChild;)e.node.removeChild(e.node.firstChild);const t=this._resolve(this.drag.a),s=this._resolve(this.drag.b);this._drawRuler(e,t,s,!1,this._mode())}_renderPins(){const e=this.w,t=e.dom.baseEl&&e.dom.baseEl.querySelector(".apexcharts-measure-pins");if(t&&t.parentNode&&t.parentNode.removeChild(t),!this.pins.length||!e.dom.elGraphical)return;const s=this.graphics.group({class:"apexcharts-measure-pins"});s.node.style.pointerEvents="none",e.dom.elGraphical.add(s),this.pins.forEach(e=>{const t=h(a({},this._dataToGrid(e.xa,e.ya)),{x:e.xa,y:e.ya}),i=h(a({},this._dataToGrid(e.xb,e.yb)),{x:e.xb,y:e.yb});this._drawRuler(s,t,i,!0,e.mode||"span")})}_drawRuler(e,t,s,i,r){const n=this._stats(t,s),o=this.graphics.group({class:"apexcharts-measure-ruler "+this._dirClass(n.dy)+(i?" apexcharts-measure-pinned":"")});"free"===(r||this._mode())?this._drawFree(o,t,s,n):this._drawSpan(o,t,s,n),e.add(o)}_dot(e,t,s){if(!1===this._cfg().markers)return;const i=this.graphics.drawMarker(t.gx,t.gy,{pSize:4,shape:"circle",pointFillColor:s,pointFillOpacity:1,pointStrokeColor:"#fff",pointStrokeWidth:2,pointStrokeOpacity:1});e.add(i)}_readout(e,t,s,i,r,n,o){const a=this.graphics.drawRect(s,i,r,n,4);a.node.setAttribute("class","apexcharts-measure-label-bg"),a.attr({fill:"#ffffff","fill-opacity":.95,stroke:o,"stroke-width":1}),e.add(a);const h=this.graphics.drawText({x:s+9,y:i+15,text:t,textAnchor:"start",fontSize:"11px",foreColor:"#1e293b",cssClass:"apexcharts-measure-label"});e.add(h)}_drawSpan(e,t,s,i){const r=this.w,n=this._cfg(),o=r.layout.gridHeight,a=this._dirColor(i.dy),h=Math.min(t.gx,s.gx),d=Math.max(t.gx,s.gx);if(!1!==n.band){const t=this.graphics.drawRect(h,0,Math.max(0,d-h),o,0);t.node.setAttribute("class","apexcharts-measure-band"),t.attr({fill:a,"fill-opacity":.09,stroke:"none"}),e.add(t)}!1!==n.guides&&[t,s].forEach(t=>{const s=this.graphics.drawLine(t.gx,0,t.gx,o,this._colors().guide,4,1);s.node.setAttribute("class","apexcharts-measure-vline"),e.add(s)}),[t,s].forEach(t=>this._dot(e,t,a));const c=this._label(t,s,i,"span"),l=c.reduce((e,t)=>Math.max(e,t.length),0),u=Math.max(148,6.4*l),_=20+15*c.length;let p=(h+d)/2-u/2;p=Math.max(2,Math.min(p,r.layout.gridWidth-u-2)),this._readout(e,c,p,4,u,_,a)}_drawFree(e,t,s,i){const r=this._dirColor(i.dy),n=this.graphics.drawLine(t.gx,t.gy,s.gx,s.gy,r,0,2);n.node.setAttribute("class","apexcharts-measure-line"),e.add(n),[t,s].forEach(t=>this._dot(e,t,r));const o=this._label(t,s,i,"free"),a=o.reduce((e,t)=>Math.max(e,t.length),0),h=Math.max(72,6.2*a),d=16+15*o.length;let c=(t.gx+s.gx)/2+8,l=(t.gy+s.gy)/2-d/2;c=Math.max(2,Math.min(c,this.w.layout.gridWidth-h-2)),l=Math.max(2,Math.min(l,this.w.layout.gridHeight-d-2)),this._readout(e,o,c,l,h,d,r)}_fireMeasured(e,t){const s=this._stats(e,t),i={from:{x:e.x,y:e.y},to:{x:t.x,y:t.y},dx:s.dx,dy:s.dy,percentChange:s.pct,slope:s.slope},r=this.w.config.chart.events.measured;"function"==typeof r&&r(this.ctx,i),this.ctx.events.fireEvent("measured",[this.ctx,i])}_afterRender(){this._enabled()&&(this.w.interact.measureEnabled&&!this.persistent&&(this.persistent=!0),this.pins.length&&this._renderPins(),this.persistent&&!this.drag&&(this._disarm(),this._arm()))}teardown(){this._cancelDrag(),this._endSeed(!1),this._disarm();const e=this._doc();e&&this._keysBound&&(e.removeEventListener("keydown",this._onKeyDown),e.removeEventListener("keyup",this._onKeyUp)),this._keysBound=!1,this.pins=[]}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>c.default});
|
package/dist/features/measure.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e){var t="undefined"!=typeof globalThis?globalThis:self,s=t.ApexCharts;if(s&&s.__internals)return e.call(t);if(s)throw new Error("ApexCharts: dist/features/measure.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return e.call(t);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/measure.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var i={file:"dist/features/measure.js",run:e,done:!1},r=t.__apexcharts_pending_addons__||(t.__apexcharts_pending_addons__=[]);r.push(i),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!i.done){var s=t.ApexCharts;if(s)if(s.__internals){i.done=!0;var n=r.indexOf(i);-1!==n&&r.splice(n,1);try{e.call(t),s.__drainsAddons||t.console.warn("ApexCharts: dist/features/measure.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(e){t.console.error("ApexCharts: dist/features/measure.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/measure.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else t.console.warn("ApexCharts: dist/features/measure.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var e,t;e=this,t=function(e){"use strict";var t=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,a=(e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i,h=(e,t)=>{for(var s in t||(t={}))n.call(t,s)&&a(e,s,t[s]);if(r)for(var s of r(t))o.call(t,s)&&a(e,s,t[s]);return e},d=(e,t)=>s(e,i(t));const c=globalThis.ApexCharts,l=globalThis.ApexCharts.__internals.__apex_Graphics,p=globalThis.ApexCharts.__internals.__apex_tooltip_Utils,u=globalThis.ApexCharts.__internals.__apex_Environment_Environment;c.registerFeatures({measure:class{constructor(e,t){this.w=e,this.ctx=t,this.graphics=new l(e),this.pins=[],this.drag=null,this.armed=!1,this.persistent=!1,this.pane=null,this._seedActive=!1,this._onKeyDown=this._onKeyDown.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onDown=this._onDown.bind(this),this._onMove=this._onMove.bind(this),this._onUp=this._onUp.bind(this),this._onSeedDown=this._onSeedDown.bind(this),this._onSeedKey=this._onSeedKey.bind(this),this._afterRender=this._afterRender.bind(this),t.addEventListener("mounted",this._afterRender),t.addEventListener("updated",this._afterRender),this._bindKeys()}_cfg(){return this.w.config.chart.measure||{}}_enabled(){return this.w.globals.axisCharts&&!0===this._cfg().enabled}_mode(){return"free"===this._cfg().mode?"free":"span"}_snapToSeries(e){const t=(this.w.config.series||[])[0];if(!t)return null;const s=this._points(t.data||[]);if(!s.length)return null;let i=s[0],r=Math.abs(s[0].x-e);for(let t=1;t<s.length;t++){const n=Math.abs(s[t].x-e);n<r&&(r=n,i=s[t])}return i}_resolve(e){if("free"===this._mode())return e;const t=this._snapToSeries(e.x);if(!t)return e;const s=this._dataToGrid(t.x,t.y);return{x:t.x,y:t.y,gx:s.gx,gy:s.gy}}_doc(){return this.w.dom.baseEl&&this.w.dom.baseEl.ownerDocument}_bindKeys(){if(this._keysBound)return;const e=this._doc();e&&(e.addEventListener("keydown",this._onKeyDown),e.addEventListener("keyup",this._onKeyUp),this._keysBound=!0)}_onKeyDown(e){if(!this._enabled()||this.persistent)return;const t=this._cfg().key||"m";e.key&&e.key.toLowerCase()===String(t).toLowerCase()?this._arm():"Escape"===e.key&&this._cancelDrag()}_onKeyUp(e){if(this.persistent)return;const t=this._cfg().key||"m";e.key&&e.key.toLowerCase()===String(t).toLowerCase()&&(this.drag||this._disarm())}startMeasure(){this._enabled()&&(this.persistent=!0,this._arm())}stopMeasure(){this.persistent=!1,this._cancelDrag(),this._disarm()}seedFromClient(e,t){if(!this._enabled())return;this._cancelDrag(),this._endSeed(!1);const s=this._project(e,t);this.drag={a:s,b:s},this._seedActive=!0;const i=this._doc();i&&(i.addEventListener("mousemove",this._onMove),i.addEventListener("touchmove",this._onMove,{passive:!1}),i.addEventListener("mousedown",this._onSeedDown,!0),i.addEventListener("touchstart",this._onSeedDown,!0),i.addEventListener("keydown",this._onSeedKey,!0)),this._renderLive()}_onSeedDown(e){if(!this._seedActive||!this.drag)return;e.preventDefault(),e.stopPropagation();const{cx:t,cy:s}=this._clientXY(e);this.drag.b=this._project(t,s),this._endSeed(!0)}_onSeedKey(e){"Escape"===e.key&&this._endSeed(!1)}_endSeed(e){var t,s;if(!this._seedActive)return;this._seedActive=!1;const i=this._doc();i&&(i.removeEventListener("mousemove",this._onMove),i.removeEventListener("touchmove",this._onMove),i.removeEventListener("mousedown",this._onSeedDown,!0),i.removeEventListener("touchstart",this._onSeedDown,!0),i.removeEventListener("keydown",this._onSeedKey,!0));const r=this.drag;if(this.drag=null,this._clearLive(),!e||!r)return;const n=this._resolve(r.a),o=this._resolve(r.b);if(Math.abs(n.gx-o.gx)<2&&Math.abs(n.gy-o.gy)<2)return;const a=this._mode();!1!==this._cfg().pinOnRelease&&(this.pins.push({xa:n.x,ya:n.y,xb:o.x,yb:o.y,mode:a}),this._renderPins(),null==(s=null==(t=this.ctx.history)?void 0:t.snapshot)||s.call(t,"measure")),this._fireMeasured(n,o)}clearMeasures(){var e,t;this.pins=[],this._renderPins(),null==(t=null==(e=this.ctx.history)?void 0:e.snapshot)||t.call(e,"clear measures")}getPins(){return this.pins.map(e=>({xa:e.xa,ya:e.ya,xb:e.xb,yb:e.yb,mode:"free"===e.mode?"free":"span"}))}setPins(e){this.pins=Array.isArray(e)?e.filter(e=>e&&isFinite(e.xa)&&isFinite(e.ya)&&isFinite(e.xb)&&isFinite(e.yb)).map(e=>({xa:+e.xa,ya:+e.ya,xb:+e.xb,yb:+e.yb,mode:"free"===e.mode?"free":"span"})):[],this._renderPins()}_points(e){const t=[];for(let s=0;s<e.length;s++){const i=e[s];let r,n;Array.isArray(i)?(r=+i[0],n=+i[1]):i&&"object"==typeof i?(r=+i.x,n=+i.y):(r=s,n=+i),isFinite(r)&&isFinite(n)&&t.push({x:r,y:n})}return t}_arm(){if(this.armed||!this._enabled())return;const e=this.w,t=e.dom.elGraphical;if(!t)return;this.armed=!0;const s=this.graphics.drawRect(0,0,e.layout.gridWidth,e.layout.gridHeight);s.node.setAttribute("class","apexcharts-measure-capture"),s.node.setAttribute("fill","transparent"),s.node.style.cursor="crosshair",s.node.style.pointerEvents="all",s.node.addEventListener("mousedown",this._onDown),s.node.addEventListener("touchstart",this._onDown,{passive:!1}),t.add(s),this.pane=s}_disarm(){if(this.armed=!1,this.pane){this.pane.node.removeEventListener("mousedown",this._onDown),this.pane.node.removeEventListener("touchstart",this._onDown);const e=this.pane.node;e.parentNode&&e.parentNode.removeChild(e),this.pane=null}}_clientXY(e){const t=e.touches&&e.touches[0]?e.touches[0]:e;return{cx:t.clientX,cy:t.clientY}}_plotRect(){const e=this.w;return e.dom.baseEl&&e.dom.baseEl.querySelector(".apexcharts-svg")?p.plotRect(e):null}_yRange(){const e=this.w.globals,t=e.yAxisScale&&e.yAxisScale[0];return t&&isFinite(t.niceMin)&&isFinite(t.niceMax)&&t.niceMax!==t.niceMin?[t.niceMin,t.niceMax]:[e.minY,e.maxY]}_project(e,t){const s=this.w,i=this._plotRect(),r=s.layout.gridWidth,n=s.layout.gridHeight,o=e=>e<0?0:e>1?1:e,a=i&&i.width?o((e-i.left)/i.width):0,h=i&&i.height?o((t-i.top)/i.height):0,[d,c]=this._yRange();return{x:s.globals.minX+a*(s.globals.maxX-s.globals.minX),y:c-h*(c-d),gx:a*r,gy:h*n}}_dataToGrid(e,t){const s=this.w,i=s.layout.gridWidth,r=s.layout.gridHeight,n=s.globals.maxX-s.globals.minX||1,[o,a]=this._yRange(),h=a-o||1;return{gx:(e-s.globals.minX)/n*i,gy:r-(t-o)/h*r}}_onDown(e){if(!this.armed)return;e.preventDefault(),e.stopPropagation();const{cx:t,cy:s}=this._clientXY(e),i=this._project(t,s);this.drag={a:i,b:i};const r=this._doc();r&&(r.addEventListener("mousemove",this._onMove),r.addEventListener("mouseup",this._onUp),r.addEventListener("touchmove",this._onMove,{passive:!1}),r.addEventListener("touchend",this._onUp)),this._renderLive()}_onMove(e){if(!this.drag)return;e.cancelable&&e.preventDefault();const{cx:t,cy:s}=this._clientXY(e);this.drag.b=this._project(t,s),this._renderLive()}_onUp(e){var t,s;const i=this._doc();if(i&&(i.removeEventListener("mousemove",this._onMove),i.removeEventListener("mouseup",this._onUp),i.removeEventListener("touchmove",this._onMove),i.removeEventListener("touchend",this._onUp)),!this.drag)return;const r=this.drag.a,n=this.drag.b;if(this.drag=null,this._clearLive(),Math.abs(r.gx-n.gx)<2&&Math.abs(r.gy-n.gy)<2)return void(this.persistent||this._disarm());const o=this._mode(),a=this._resolve(r),h=this._resolve(n);!1!==this._cfg().pinOnRelease&&(this.pins.push({xa:a.x,ya:a.y,xb:h.x,yb:h.y,mode:o}),this._renderPins(),null==(s=null==(t=this.ctx.history)?void 0:t.snapshot)||s.call(t,"measure")),this._fireMeasured(a,h),this.persistent||this._disarm()}_cancelDrag(){const e=this._doc();e&&(e.removeEventListener("mousemove",this._onMove),e.removeEventListener("mouseup",this._onUp),e.removeEventListener("touchmove",this._onMove),e.removeEventListener("touchend",this._onUp)),this.drag=null,this._clearLive()}_stats(e,t){const s=t.x-e.x,i=t.y-e.y;return{dx:s,dy:i,pct:0!==e.y?i/Math.abs(e.y)*100:NaN,slope:0!==s?i/s:NaN}}_fmt(e){if(!isFinite(e))return"n/a";const t=Math.abs(e);return 0!==t&&(t<.01||t>=1e6)?e.toExponential(2):String(Math.round(100*e)/100)}_computedStyle(){if(!u.isBrowser())return null;const e=this.w.dom.elGraphical&&this.w.dom.elGraphical.node;if(!e||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(e)}catch(e){return null}}_resolveColor(e,t,s,i){if(e)return e;const r=void 0!==i?i:this._computedStyle();return(r?r.getPropertyValue(t).trim():"")||s}_colors(){const e=this._cfg().colors||{},t=this._computedStyle();return{up:this._resolveColor(e.up,"--apx-measure-up","#16a34a",t),down:this._resolveColor(e.down,"--apx-measure-down","#dc2626",t),neutral:this._resolveColor(e.neutral,"--apx-measure-neutral","#64748b",t),guide:this._resolveColor(e.guide,"--apx-measure-guide","#94a3b8",t)}}_dirColor(e){const t=this._colors();return 0===e?t.neutral:e>0?t.up:t.down}_dirClass(e){return 0===e?"apexcharts-measure-flat":e>0?"apexcharts-measure-up":"apexcharts-measure-down"}_fmtPct(e){if(!isFinite(e))return"n/a";const t=this._cfg().format&&this._cfg().format.percent;if("function"==typeof t)try{const s=t(e);if(null!=s)return String(s)}catch(e){}return(e>=0?"+":"")+this._fmt(e)+"%"}_label(e,t,s,i){const r=this._cfg().label;if("function"==typeof r){const n=r({from:{x:e.x,y:e.y},to:{x:t.x,y:t.y},dx:s.dx,dy:s.dy,percentChange:s.pct,slope:s.slope,mode:i});return Array.isArray(n)?n.map(String):[String(n)]}if("span"===i){const i=0===s.dy?"":s.dy>0?" \u2191":" \u2193",r=isFinite(s.pct)?"("+this._fmtPct(s.pct)+")":"";return[this._fmtY(s.dy)+" "+r+i,this._fmtX(e.x)+" to "+this._fmtX(t.x)]}return["\u0394x "+this._fmtDx(s.dx),"\u0394y "+this._fmtY(s.dy),this._fmtPct(s.pct)]}_fmtDx(e){if("datetime"===this.w.config.xaxis.type){const t=e/864e5;return Math.round(10*t)/10+"d"}return this._fmt(e)}_fmtY(e){const t=this._cfg().format&&this._cfg().format.y;if("function"==typeof t)try{const s=t(e);if(null!=s)return String(s)}catch(e){}const s=this.w.globals.yLabelFormatters&&this.w.globals.yLabelFormatters[0];if("function"==typeof s)try{const t=s(e,{seriesIndex:0,dataPointIndex:-1,w:this.w});if(null!=t&&""!==t)return String(t)}catch(e){}return this._fmt(e)}_fmtX(e){const t=this.w,s=this._cfg().format&&this._cfg().format.x;if("function"==typeof s)try{const t=s(e);if(null!=t)return String(t)}catch(e){}if("datetime"===t.config.xaxis.type)return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"});const i=t.globals.xLabelFormatter;if("function"==typeof i)try{const s=i(e,{w:t});if(null!=s&&""!==s)return String(s)}catch(e){}return this._fmt(e)}_liveGroup(){const e=this.w;if(this._live&&this._live.node&&this._live.node.parentNode)return this._live;const t=this.graphics.group({class:"apexcharts-measure-live"});return t.node.style.pointerEvents="none",e.dom.elGraphical&&e.dom.elGraphical.add(t),this._live=t,t}_clearLive(){if(this._live&&this._live.node){const e=this._live.node;e.parentNode&&e.parentNode.removeChild(e)}this._live=null}_renderLive(){if(!this.drag)return;const e=this._liveGroup();for(;e.node.firstChild;)e.node.removeChild(e.node.firstChild);const t=this._resolve(this.drag.a),s=this._resolve(this.drag.b);this._drawRuler(e,t,s,!1,this._mode())}_renderPins(){const e=this.w,t=e.dom.baseEl&&e.dom.baseEl.querySelector(".apexcharts-measure-pins");if(t&&t.parentNode&&t.parentNode.removeChild(t),!this.pins.length||!e.dom.elGraphical)return;const s=this.graphics.group({class:"apexcharts-measure-pins"});s.node.style.pointerEvents="none",e.dom.elGraphical.add(s),this.pins.forEach(e=>{const t=d(h({},this._dataToGrid(e.xa,e.ya)),{x:e.xa,y:e.ya}),i=d(h({},this._dataToGrid(e.xb,e.yb)),{x:e.xb,y:e.yb});this._drawRuler(s,t,i,!0,e.mode||"span")})}_drawRuler(e,t,s,i,r){const n=this._stats(t,s),o=this.graphics.group({class:"apexcharts-measure-ruler "+this._dirClass(n.dy)+(i?" apexcharts-measure-pinned":"")});"free"===(r||this._mode())?this._drawFree(o,t,s,n):this._drawSpan(o,t,s,n),e.add(o)}_dot(e,t,s){if(!1===this._cfg().markers)return;const i=this.graphics.drawMarker(t.gx,t.gy,{pSize:4,shape:"circle",pointFillColor:s,pointFillOpacity:1,pointStrokeColor:"#fff",pointStrokeWidth:2,pointStrokeOpacity:1});e.add(i)}_readout(e,t,s,i,r,n,o){const a=this.graphics.drawRect(s,i,r,n,4);a.node.setAttribute("class","apexcharts-measure-label-bg"),a.attr({fill:"#ffffff","fill-opacity":.95,stroke:o,"stroke-width":1}),e.add(a);const h=this.graphics.drawText({x:s+9,y:i+15,text:t,textAnchor:"start",fontSize:"11px",foreColor:"#1e293b",cssClass:"apexcharts-measure-label"});e.add(h)}_drawSpan(e,t,s,i){const r=this.w,n=this._cfg(),o=r.layout.gridHeight,a=this._dirColor(i.dy),h=Math.min(t.gx,s.gx),d=Math.max(t.gx,s.gx);if(!1!==n.band){const t=this.graphics.drawRect(h,0,Math.max(0,d-h),o,0);t.node.setAttribute("class","apexcharts-measure-band"),t.attr({fill:a,"fill-opacity":.09,stroke:"none"}),e.add(t)}!1!==n.guides&&[t,s].forEach(t=>{const s=this.graphics.drawLine(t.gx,0,t.gx,o,this._colors().guide,4,1);s.node.setAttribute("class","apexcharts-measure-vline"),e.add(s)}),[t,s].forEach(t=>this._dot(e,t,a));const c=this._label(t,s,i,"span"),l=c.reduce((e,t)=>Math.max(e,t.length),0),p=Math.max(148,6.4*l),u=20+15*c.length;let _=(h+d)/2-p/2;_=Math.max(2,Math.min(_,r.layout.gridWidth-p-2)),this._readout(e,c,_,4,p,u,a)}_drawFree(e,t,s,i){const r=this._dirColor(i.dy),n=this.graphics.drawLine(t.gx,t.gy,s.gx,s.gy,r,0,2);n.node.setAttribute("class","apexcharts-measure-line"),e.add(n),[t,s].forEach(t=>this._dot(e,t,r));const o=this._label(t,s,i,"free"),a=o.reduce((e,t)=>Math.max(e,t.length),0),h=Math.max(72,6.2*a),d=16+15*o.length;let c=(t.gx+s.gx)/2+8,l=(t.gy+s.gy)/2-d/2;c=Math.max(2,Math.min(c,this.w.layout.gridWidth-h-2)),l=Math.max(2,Math.min(l,this.w.layout.gridHeight-d-2)),this._readout(e,o,c,l,h,d,r)}_fireMeasured(e,t){const s=this._stats(e,t),i={from:{x:e.x,y:e.y},to:{x:t.x,y:t.y},dx:s.dx,dy:s.dy,percentChange:s.pct,slope:s.slope},r=this.w.config.chart.events.measured;"function"==typeof r&&r(this.ctx,i),this.ctx.events.fireEvent("measured",[this.ctx,i])}_afterRender(){this._enabled()&&(this.w.interact.measureEnabled&&!this.persistent&&(this.persistent=!0),this.pins.length&&this._renderPins(),this.persistent&&!this.drag&&(this._disarm(),this._arm()))}teardown(){this._cancelDrag(),this._endSeed(!1),this._disarm();const e=this._doc();e&&this._keysBound&&(e.removeEventListener("keydown",this._onKeyDown),e.removeEventListener("keyup",this._onKeyUp)),this._keysBound=!1,this.pins=[]}}}),e.default=c,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexMeasure={})});
|