apexcharts 8.2.0 → 8.3.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 +271 -173
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +35 -0
- package/dist/apexcharts.esm.js +1722 -1527
- package/dist/apexcharts.full.js +1459 -1075
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +994 -715
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +994 -715
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +91 -40
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +433 -394
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +364 -322
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +91 -40
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +364 -322
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +433 -394
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +271 -173
- package/dist/donut.common.js +1 -1
- package/dist/donut.esm.js +1 -1
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +433 -394
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +250 -187
- package/dist/features/annotations.common.js +1 -1
- package/dist/features/annotations.esm.js +1 -1
- package/dist/features/annotations.js +1 -1
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +2 -2
- package/dist/features/drilldown.esm.js +4 -2
- package/dist/features/drilldown.js +2 -2
- package/dist/features/dumbbell.common.js +1 -1
- package/dist/features/dumbbell.esm.js +1 -1
- package/dist/features/dumbbell.js +1 -1
- package/dist/features/exports.common.js +1 -1
- package/dist/features/exports.esm.js +1 -1
- package/dist/features/exports.js +1 -1
- package/dist/features/facet.common.js +1 -1
- package/dist/features/facet.esm.js +1 -1
- package/dist/features/facet.js +1 -1
- package/dist/features/highlight-filter.common.js +2 -2
- package/dist/features/highlight-filter.esm.js +14 -9
- package/dist/features/highlight-filter.js +2 -2
- package/dist/features/history.common.js +1 -1
- package/dist/features/history.esm.js +1 -1
- package/dist/features/history.js +1 -1
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +2 -2
- package/dist/features/keyboard.esm.js +97 -145
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +63 -43
- 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 +1 -1
- package/dist/features/morph.esm.js +1 -1
- package/dist/features/morph.js +1 -1
- package/dist/features/perspectives.common.js +1 -1
- package/dist/features/perspectives.esm.js +1 -1
- package/dist/features/perspectives.js +1 -1
- package/dist/features/raincloud.common.js +1 -1
- package/dist/features/raincloud.esm.js +1 -1
- package/dist/features/raincloud.js +1 -1
- package/dist/features/renderer-canvas.common.js +2 -2
- package/dist/features/renderer-canvas.esm.js +2 -1
- package/dist/features/renderer-canvas.js +2 -2
- package/dist/features/stats.common.js +1 -1
- package/dist/features/stats.esm.js +1 -1
- package/dist/features/stats.js +1 -1
- package/dist/features/storyboard.common.js +1 -1
- package/dist/features/storyboard.esm.js +1 -1
- package/dist/features/storyboard.js +1 -1
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +3 -2
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +92 -2
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +83 -47
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +1 -1
- package/dist/features/waterfall.esm.js +1 -1
- package/dist/features/waterfall.js +1 -1
- package/dist/features/weave.common.js +1 -1
- package/dist/features/weave.esm.js +1 -1
- package/dist/features/weave.js +1 -1
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +950 -795
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +3 -17
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +433 -394
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +54 -38
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +91 -40
- package/dist/line.js +2 -2
- package/dist/locales/en.json +2 -1
- package/dist/locales/ro.json +3 -2
- package/dist/pictograms.common.js +1 -1
- package/dist/pictograms.esm.js +1 -1
- package/dist/pictograms.js +1 -1
- package/dist/pie.common.js +1 -1
- package/dist/pie.esm.js +1 -1
- package/dist/pie.js +1 -1
- package/dist/polarArea.common.js +1 -1
- package/dist/polarArea.esm.js +1 -1
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +5 -4
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +1 -1
- package/dist/radialBar.esm.js +1 -1
- package/dist/radialBar.js +1 -1
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +72 -26
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +91 -40
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +433 -394
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +91 -40
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +93 -41
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +103 -93
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +105 -86
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +1 -1
- package/dist/unit-shapes.esm.js +1 -1
- package/dist/unit-shapes.js +1 -1
- package/dist/unit.common.js +2 -2
- package/dist/unit.esm.js +280 -202
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +72 -26
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +432 -393
- package/package.json +1 -1
- package/src/apexcharts.js +13 -6
- package/src/assets/apexcharts.css +35 -0
- package/src/charts/Bar.js +62 -55
- package/src/charts/BarStacked.js +80 -88
- package/src/charts/BoxCandleStick.js +28 -31
- package/src/charts/Icicle.js +37 -37
- package/src/charts/Line.js +118 -42
- package/src/charts/Radar.js +5 -7
- package/src/charts/RangeBar.js +47 -43
- package/src/charts/Sunburst.js +101 -98
- package/src/charts/Treemap.js +108 -66
- package/src/charts/Unit.js +368 -250
- package/src/charts/Violin.js +48 -30
- package/src/charts/common/Breadcrumb.js +2 -2
- package/src/charts/common/Hierarchy.js +32 -11
- package/src/charts/common/Jitter.js +32 -7
- package/src/charts/common/bar/DataLabels.js +76 -81
- package/src/charts/common/bar/Helpers.js +43 -7
- package/src/charts/common/line/Helpers.js +12 -15
- package/src/charts/common/partition/NodeTooltip.js +8 -1
- package/src/charts/common/partition/Partition.js +33 -1
- package/src/charts/common/treemap/Helpers.js +3 -11
- package/src/locales/en.json +2 -1
- package/src/locales/ro.json +3 -2
- package/src/modules/Core.js +4 -0
- package/src/modules/CoreUtils.js +18 -42
- package/src/modules/Data.js +23 -24
- package/src/modules/DataLabels.js +6 -6
- package/src/modules/Graphics.js +62 -49
- package/src/modules/Markers.js +3 -1
- package/src/modules/Range.js +44 -29
- package/src/modules/RendererController.js +17 -3
- package/src/modules/Scales.js +32 -9
- package/src/modules/Series.js +39 -18
- package/src/modules/Theme.js +1 -1
- package/src/modules/ZoomPanSelection.js +119 -2
- package/src/modules/accessibility/KeyboardNavigation.js +114 -186
- package/src/modules/animations/LengthTransition.js +22 -2
- package/src/modules/drilldown/Breadcrumb.js +5 -2
- package/src/modules/helpers/Destroy.js +1 -1
- package/src/modules/highlightFilter/HighlightFilter.js +8 -9
- package/src/modules/highlightFilter/TreemapPart.js +2 -2
- package/src/modules/legend/HeatmapGradientLegend.js +76 -45
- package/src/modules/legend/Helpers.js +2 -0
- package/src/modules/legend/Legend.js +11 -12
- package/src/modules/settings/Options.js +7 -0
- package/src/modules/streamgraph/StreamLabels.js +1 -0
- package/src/modules/tooltip/Tooltip.js +20 -4
- package/src/modules/tooltip/Utils.js +8 -0
- package/src/modules/trellis/Trellis.js +6 -0
- package/src/modules/trellis/TrellisChrome.js +18 -7
- package/src/modules/trellis/TrellisSync.js +2 -0
- package/src/renderers/canvas/CanvasGraphics.js +1 -0
- package/src/ssr/DOMShim.js +10 -0
- package/src/types/internal.d.ts +9 -3
- package/types/apexcharts.d.ts +31 -12
package/dist/features/legend.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.3.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,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.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(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);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:A(e.color)})).sort((e,t)=>e.value-t.value);const n=(Array.isArray(e.colors)&&e.colors.length>=2?e.colors:y).map(A),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._bandHitEls=[],this._activeBandIndex=-1,this._targetEl=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"),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"));const{min:N,max:M,stops:j,bands:O}=this._computeStops();this._min=N,this._max=M,j.forEach(e=>{const t=b.createElementNS(E,"stop");t.setAttribute("offset",`${(100*e.percent).toFixed(2)}%`),t.setAttribute("stop-color",e.color),H.appendChild(t)}),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 B=(null==(l=h.arrow)?void 0:l.color)||c.config.chart.foreColor,D=this._buildArrow(u,B,g);if(k.appendChild(D),this.arrowEl=D,this._bandHitEls=[],c.config.legend.onItemHover.highlightDataSeries&&O.length>0&&O.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(!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]),new u(r).highlightRangeInSeries(a,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const e=this._activeBandIndex;this._activeBandIndex=-1,new u(this.w).highlightRangeInSeries(e,"reset")}_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;const n=this.w;if(!this.arrowEl)return;const r=e[e.length-1];if(!r||"object"!=typeof r)return;const l=r.seriesIndex,a=r.dataPointIndex;if("number"!=typeof l||"number"!=typeof a)return;if(!k.supports(n))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)}(n,l,a):null==(i=null==(s=null==(t=n.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}_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;void 0!==i.min&&void 0!==i.max&&i.max>i.min?(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 p=[],u=[];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;p.push({percent:(s+i)/2,color:e.color}),u.push({index:e._originalIndex,p1:s,p2:i})})}else{const e=s.globals.colors[0]||"#008FFB",i=new f,r=s.config.plotOptions[s.config.chart.type]||{},l=null!=(t=r.shadeIntensity)?t:.5,a=s.globals.hasNegs,o=Math.max(2,n.stops||16);for(let t=0;t<o;t++){const n=t/(o-1),c=h+n*(g-h),d=Math.abs(g)+Math.abs(h),u=0===d?0:100*c/d;let f;f=a?r.reverseNegativeShade?u<0?u/100*(1.25*l):1.25*l*(1-u/100):u<=0?1-(1+u/100)*l:(1-u/100)*l:1-u/100,f>1&&(f=1),f<-1&&(f=-1);const x=r.enableShades?i.shadeColor("dark"===s.config.theme.mode?-1*f:f,e):e;p.push({percent:n,color:x})}}return{min:h,max:g,stops:p,bands:u}}}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 m(this)}init(){const e=this.w,t=e.globals,s=e.config;this.isBarsDistributed="bar"===s.chart.type&&s.plotOptions.bar.distributed&&1===s.series.length;const i=s.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||"heatmap"===s.chart.type||k.isEnabled(e)||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(i||!t.axisCharts)&&s.legend.show){const t=e.dom.elLegendWrap;for(;t.firstChild;)t.removeChild(t.firstChild);this.heatmapGradientLegend&&(this.heatmapGradientLegend.destroy(),this.heatmapGradientLegend=null),k.isEnabled(e)?(this.heatmapGradientLegend=new k(e,this.ctx),this.heatmapGradientLegend.draw()):(this.drawLegends(),"bottom"===s.legend.position||"top"===s.legend.position?this.legendAlignHorizontal():"right"!==s.legend.position&&"left"!==s.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"),m.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),m.style.color=y,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 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)&&x.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)&&x.classList.add("apexcharts-hidden-null-series");const S=c[s.labelData.seriesGroupIndex[t]];S&&i.appendChild(S),(S||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){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!i.classList.contains("apexcharts-inactive-legend")&&n&&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(()=>{const e=s.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${n}"]`);e&&e.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,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={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.3.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.3.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.3.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.3.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.3.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.3.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={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.3.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";var t=Object.defineProperty,e=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(e,r,i)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,n=(t,n)=>{for(var a in n||(n={}))r.call(n,a)&&s(t,a,n[a]);if(e)for(var a of e(n))i.call(n,a)&&s(t,a,n[a]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function a(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const r in t)if("default"!==r){const i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>t[r]})}return e.default=t,Object.freeze(e)}const l=a(require("apexcharts/core")),o=l.__apex_Environment_Environment,h=l.__apex_BrowserAPIs_BrowserAPIs,c=l.__apex_Animations_prefersReducedMotion,u=l.__apex_PathMorphing_parsePath;function p(t,e){if(!(e>0))return[];if(1===e)return[n({},t)];const r=t.width>=t.height,i=r?t.width:t.height,s=r?t.height:t.width,a=s>0?i/s:e;let l=Math.max(1,Math.ceil(Math.sqrt(a*e)));l>e&&(l=e);const o=Math.floor(e/l);let h=e-o*l;const c=[],u=i/l;let p=0;for(let e=0;e<l;e++){const e=o+(h>0?1:0);h>0&&h--;const i=e>0?s/e:0;for(let s=0;s<e;s++)c.push(r?{x:t.x+p,y:t.y+s*i,width:u,height:i}:{x:t.x+s*i,y:t.y+p,width:i,height:u});p+=u}return c}function d(t,e,r){if(!(e>0))return[];const i=t.width>=t.height,s=i?t.width:t.height,n=i?t.height:t.width,a=i?t.y:t.x,l=a+n,o=n>0?s/n:e;let h=Math.max(Math.ceil(Math.sqrt(o*e)),Math.ceil(s/16));h>=1||(h=1),h>e&&(h=e);const c=Math.floor(e/h);let u=e-c*h;const p=[],d=s/h;let f=i?t.x:t.y;for(let t=0;t<h;t++){const t=c+(u>0?1:0);u>0&&u--;const e=[],s=r(f,f+d,i);if(Array.isArray(s))for(let t=0;t<s.length;t++){const r=s[t];if(!r)continue;const i=Math.max(a,Math.min(r[0],r[1])),n=Math.min(l,Math.max(r[0],r[1]));n>i&&e.push([i,n])}e.length||e.push([a,l]);const n=e.reduce((t,e)=>t+(e[1]-e[0]),0),o=e.map(r=>n>0?(r[1]-r[0])/n*t:t/e.length),h=o.map(t=>Math.floor(t));let g=h.reduce((t,e)=>t+e,0);const y=o.map((t,e)=>({i:e,frac:t-Math.floor(t)})).sort((t,e)=>e.frac-t.frac);for(let e=0;g<t;e++,g++)h[y[e%y.length].i]++;for(let t=0;t<e.length;t++){const r=h[t];if(r<=0)continue;const s=e[t][0],n=(e[t][1]-s)/r;for(let t=0;t<r;t++)p.push(i?{x:f,y:s+t*n,width:d,height:n}:{x:s+t*n,y:f,width:n,height:d})}f+=d}return p}function f(t,e,r,i,s,n){let a=s===r?0:Math.round((t-r)/(s-r)*32767),l=n===i?0:Math.round((e-i)/(n-i)*32767),o=0;for(let t=32768;t>=1;t/=2){const e=(a&t)>0?1:0,r=(l&t)>0?1:0;if(o+=t*t*(3*e^r),0===r){1===e&&(a=t-1-a,l=t-1-l);const r=a;a=l,l=r}}return o}function g(t,e){let r=1/0,i=1/0,s=-1/0,n=-1/0;const a=t.map(t=>{const[a,l]=e(t);return a<r&&(r=a),a>s&&(s=a),l<i&&(i=l),l>n&&(n=l),[a,l]});return t.map((t,e)=>({item:t,d:f(a[e][0],a[e][1],r,i,s,n)})).sort((t,e)=>t.d-e.d).map(t=>t.item)}function y(t){if(!t||"string"!=typeof t)return null;const e=t.trim();if("#"===e[0]){const t=e.slice(1);return 3===t.length?[parseInt(t[0]+t[0],16),parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),1]:6===t.length||8===t.length?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),8===t.length?parseInt(t.slice(6,8),16)/255:1]:null}const r=e.match(/^rgba?\(([^)]+)\)$/i);if(r){const t=r[1].split(",").map(t=>parseFloat(t));return t.length<3||t.some(t=>!isFinite(t))?null:[t[0],t[1],t[2],t.length>3?t[3]:1]}return null}function m(t,e){const r=y(t),i=y(e);return r&&i?t=>{const e=Math.round(r[0]+(i[0]-r[0])*t),s=Math.round(r[1]+(i[1]-r[1])*t),n=Math.round(r[2]+(i[2]-r[2])*t),a=r[3]+(i[3]-r[3])*t;return a>=1?`rgb(${e},${s},${n})`:`rgba(${e},${s},${n},${a})`}:null}function x(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}const b=new Set(["bar","funnel","pyramid","histogram"]),A=new Set(["pie","donut","polarArea","radialBar","gauge"]),_=new Set(["unit","waffle"]),w=new Set(["treemap","sunburst"]),$=new Set(["boxPlot","violin"]);let v=0;const M=1500,S=t=>{t.removeAttribute("opacity"),t.removeAttribute("data-piece-hidden")};function P(t){return b.has(t)?"bar":A.has(t)?"radial":_.has(t)?"unit":w.has(t)?"partition":$.has(t)?"summary":null}l.default.registerFeatures({morphTypeChange:class{constructor(t,e){this.w=t,this.ctx=e,this._snapshot=null,this._shown=!1,this._ghost=null,this._pieceLayer=null,this._pieceCancel=null,this._ghostTimer=void 0}canMorphTypes(t,e){if(t===e)return!1;const r=P(t),i=P(e);return!(!r||!i)&&("partition"===r==("partition"===i)||"unit"!==r&&"unit"!==i)}isCompatibleSeriesShape(t,e,r){if(!Array.isArray(r)||0===r.length)return!1;const i=P(t),s=P(e);return"unit"===s?!!r.every(t=>"number"==typeof t)||r.every(t=>t&&"object"==typeof t&&Array.isArray(t.data)):"partition"===s||("radial"===s?!!r.every(t=>"number"==typeof t)||1===r.length&&r[0]&&"object"==typeof r[0]&&Array.isArray(r[0].data):"bar"===s||"summary"===s?r.every(t=>t&&"object"==typeof t&&Array.isArray(t.data)):null!==i&&null!==s)}captureBeforeDestroy({fromType:t,toType:e,newSeries:r}){var i;if(this._snapshot=null,this._shown=!1,this._removeGhost(),this._cancelPieces(),!o.isBrowser())return!1;const s=this.w.config.chart.animations;if(!s||!1===s.enabled)return!1;if(s.chartTypeMorph&&!1===s.chartTypeMorph.enabled)return!1;if(s.respectReducedMotion&&c())return!1;if(!this.canMorphTypes(t,e))return!1;if(!this.isCompatibleSeriesShape(t,e,r))return!1;const{marks:n,branches:a,unitDots:l}=this._captureFromDOM(t);if(!n.length)return!1;const h=this._buildMapping(n,t,e,r,a);if(0===h.size)return!1;const u=this.w.globals,p=null==(i=this.w.dom.elGraphical)?void 0:i.node,d=u.layoutTween&&!u.layoutTween.done&&u.layoutTween.graphical===p?u.layoutTween.rect:null,f=u.circleTween,g=f&&!f.done&&(null==p?void 0:p.contains(f.node))?f:null,y=g?g.circle.r/g.target.r:1;this._snapshot={fromType:t,toType:e,mapping:h,oldLayout:{translateX:d?d.x:this.w.layout.translateX||0,translateY:d?d.y:this.w.layout.translateY||0,scale:y,shiftX:g?g.circle.cx-y*g.target.cx:0,shiftY:g?g.circle.cy-y*g.target.cy:0}};const m=P(t),x=P(e),b=this._canProbePaths();if("unit"===x&&("bar"===m||"summary"===m||"radial"===m&&b)){const t=this._countUnitSeries(r);this._snapshot.pieceOut=t>0&&t<=M}else if("unit"===m&&("bar"===x||"summary"===x||"radial"===x&&b&&!/^(radialBar|gauge)$/.test(e))){let t=0;l.forEach(e=>{t+=e.length}),t>0&&t<=M&&(this._snapshot.pieceIn=!0,this._snapshot.sourceDots=l,this._snapshot.keyOrder=this._targetKeys(x,r))}return!this._needsGhost(t,e)||this._snapshot.pieceOut||this._snapshot.pieceIn||this._captureGhost(),this.w.globals.previousPaths=[],!0}_needsGhost(t,e){return"unit"===P(t)||"unit"===P(e)}_captureGhost(){var t,e;const r=null==(t=this.w.dom)?void 0:t.Paper,i=r&&r.node;if(!i||"function"!=typeof i.cloneNode)return;const s=i.cloneNode(!0),n=[".apexcharts-xaxis",".apexcharts-yaxis",".apexcharts-grid",".apexcharts-legend",".apexcharts-title-text",".apexcharts-subtitle-text",".apexcharts-annotations",".apexcharts-zoom-rect",".apexcharts-selection-rect",".apexcharts-xcrosshairs",".apexcharts-ycrosshairs"];if("function"==typeof s.querySelectorAll&&n.forEach(t=>{s.querySelectorAll(t).forEach(t=>{t.remove()})}),"function"==typeof s.querySelectorAll){const t="-ghost"+ ++v,e=new Set;s.querySelectorAll("[id]").forEach(r=>{e.add(r.id),r.id+=t}),s.querySelectorAll("*").forEach(r=>{for(const i of r.attributes){const r=i.value.replace(/(url\(['"]?#|^#)([^'")\s]+)/g,(r,i,s)=>e.has(s)?i+s+t:r);r!==i.value&&(i.value=r)}})}null==(e=s.removeAttribute)||e.call(s,"id"),this._ghost=s}_mountGhost(){var t,e,r;const i=this._ghost;if(!i||!o.isBrowser())return;const s=null==(t=this.w.dom)?void 0:t.elWrap;if(!s||"function"!=typeof s.appendChild)return void(this._ghost=null);const n=i.style;n&&(n.position="absolute",n.left="0",n.top="0",n.background="transparent",n.pointerEvents="none",n.opacity="1"),null==(e=i.setAttribute)||e.call(i,"aria-hidden","true"),null==(r=i.setAttribute)||r.call(i,"class","apexcharts-morph-ghost"),s.appendChild(i);const a=this.getSpeed(),l=Math.max(120,Math.round(.55*a));h.requestAnimationFrame(()=>{n&&(n.transition=`opacity ${l}ms ease-in`,n.opacity="0")}),this._ghostTimer=setTimeout(()=>this._removeGhost(),l+60)}_removeGhost(){clearTimeout(this._ghostTimer);const t=this._ghost;this._ghost=null,null==t||t.remove()}_countUnitSeries(t){if(!Array.isArray(t))return 0;let e=0;for(const r of t){if(!r||"object"!=typeof r||!Array.isArray(r.data))return 0;e+=r.data.length}return e}usesPieceTakeover(){return!(!this._snapshot||!this._snapshot.pieceOut)}claimsTargetMark(t,e){return!!(this._snapshot&&this._snapshot.pieceIn&&this._snapshot.mapping.has(`${t}:${e}`))}_makePieceLayer(){var t,e;const r=null==(t=this.w.dom)?void 0:t.elGraphical,i=r&&r.node;if(!i||"function"!=typeof i.appendChild)return null;const s=h.createElementNS("http://www.w3.org/2000/svg","g");if(!s)return null;s.setAttribute("class","apexcharts-morph-pieces"),s.setAttribute("pointer-events","none");const n=null==(e=this.w.globals)?void 0:e.cuid;return n&&s.setAttribute("clip-path",`url(#gridRectBarMask${n})`),i.appendChild(s),this._pieceLayer=s,s}_revealPieceHidden(){var t;const e=null==(t=this.w.globals.dom)?void 0:t.baseEl;e&&"function"==typeof e.querySelectorAll&&e.querySelectorAll("[data-piece-hidden]").forEach(S)}_cancelPieces(){this._pieceCancel&&(this._pieceCancel(),this._pieceCancel=null);const t=this._pieceLayer;this._pieceLayer=null,null==t||t.remove(),this._revealPieceHidden()}_canProbePaths(){if(!o.isBrowser())return!1;const t=h.createElementNS("http://www.w3.org/2000/svg","path");return!!t&&"function"==typeof t.isPointInFill}_makeExtentProber(t,e,r){const i=r.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",t),i.setAttribute("fill","#000"),i.setAttribute("stroke","#000"),i.setAttribute("stroke-width","3"),i.setAttribute("visibility","hidden"),r.appendChild(i);const s=i.ownerSVGElement;if("function"!=typeof i.isPointInFill||!s||"function"!=typeof s.createSVGPoint)return r.removeChild(i),null;const n=s.createSVGPoint(),a=(t,e)=>{n.x=t,n.y=e;const r=i;return r.isPointInFill(n)||"function"==typeof r.isPointInStroke&&r.isPointInStroke(n)},l=48;return{intervalsAt:(t,r,i)=>{const s=i?e.y:e.x,n=s+(i?e.height:e.width);if(!(n>s))return null;const o=(t,e)=>i?a(e,t):a(t,e),h=[t+.1*(r-t),(t+r)/2,r-.1*(r-t)],c=(t,e,r)=>{let i=e,s=t;for(let t=0;t<6;t++){const t=(i+s)/2;o(t,r)?s=t:i=t}return(i+s)/2},u=(n-s)/l,p=new Array(49).fill(null);let d=!1;for(const t of h)for(let e=0;e<=l;e++)null===p[e]&&o(s+e*u,t)&&(p[e]=t,d=!0);if(!d)return null;const f=[];let g=-1;for(let t=0;t<=49;t++){const e=t<=l&&null!==p[t];if(e&&g<0&&(g=t),!e&&g>=0){const e=t-1,r=p[g],i=0===g?s:c(s+g*u,s+(g-1)*u,r),a=e===l?n:c(s+e*u,s+(e+1)*u,p[e]);a>i&&f.push([i,a]),g=-1}}return f.length?f:null},dispose:()=>{i.remove()}}}_separatePieces(){var t;const e=this._snapshot,r=null==(t=this.w.globals.dom)?void 0:t.baseEl;if(!e||!r)return this._revealPieceHidden();const i=this._readUnitDots(r,new Map);let s=0;if(i.forEach(t=>{s+=t.length}),0===s||s>M)return this._revealPieceHidden();const n=this._makePieceLayer();if(!n)return this._revealPieceHidden();const a=[],l=n.ownerDocument,o=P(e.fromType),h="summary"===o||"radial"===o;if(Array.from(i.keys()).sort((t,e)=>t-e).forEach(t=>{var r;const s=i.get(t),o=this.getInitialBBoxFor(t),c=e.mapping.get(`${t}:0`);if(!o||!c)return void s.forEach(t=>S(t.el));const u=c.fill&&0!==c.fill.indexOf("url(")?c.fill:(null==(r=this.w.globals.colors)?void 0:r[t])||s[0].fill;let f=null;if(h){const e=this.getInitialPathFor(t,0);e&&(f=this._makeExtentProber(e,o,n))}const y=f?d(o,s.length,f.intervalsAt):p(o,s.length);f&&f.dispose();const x=g(y,t=>[t.x+t.width/2,t.y+t.height/2]),b=g(s,t=>[t.x,t.y]);for(let e=0;e<b.length;e++){const r=x[e],i=b[e],s=l.createElementNS("http://www.w3.org/2000/svg","rect");s.setAttribute("data-i",String(t)),s.setAttribute("data-key",i.el.getAttribute("data-key")),s.setAttribute("x",String(r.x)),s.setAttribute("y",String(r.y)),s.setAttribute("width",String(r.width)),s.setAttribute("height",String(r.height)),s.setAttribute("rx","0"),s.setAttribute("fill",String(u)),n.appendChild(s),a.push({el:s,from:{x:r.x,y:r.y,width:r.width,height:r.height,rx:0},to:{x:i.x-i.r,y:i.y-i.r,width:2*i.r,height:2*i.r,rx:i.r},fill:m(u,i.fill),fillEnd:i.fill,delay:0,meta:{dotEl:i.el}})}}),!a.length)return this._cancelPieces();this._runPieces(a,t=>{S(t.meta.dotEl),t.el.remove()})}_readUnitDots(t,e){return t.querySelectorAll(".apexcharts-unit-area").forEach(t=>{var r;const i=parseInt(null!=(r=t.getAttribute("i"))?r:"",10);if(isNaN(i))return;const s=e=>parseFloat(t.getAttribute(e)),n=t.getAttribute("cx"),a=s("width")||0,l=s("height")||0,o=null!=n?parseFloat(n):s("x")+a/2,h=null!=n?s("cy"):s("y")+l/2,c=(null!=n?s("r"):Math.max(a,l)/2)||3;if(!isFinite(o)||!isFinite(h))return;let u=e.get(i);u||e.set(i,u=[]),u.push({el:t,x:o,y:h,r:c,fill:t.getAttribute("fill")})}),e}_combinePieces(){var t,e;const r=this._snapshot,i=null==(t=this.w.globals.dom)?void 0:t.baseEl;if(!(r&&r.sourceDots&&r.keyOrder&&i))return this._revealPieceHidden();const s=this._collectTargetMarks(r.toType);if(!s.size)return this._revealPieceHidden();const{dx:n,dy:a}=this._oldToNew(),l=Array.from(r.sourceDots.keys()).sort((t,e)=>t-e),o=this._makePieceLayer();if(!o)return this._revealPieceHidden();const h=o.ownerDocument,c=[],u=P(r.toType),f="summary"===u||"radial"===u;for(let t=0;t<l.length;t++){const i=r.sourceDots.get(l[t]),u=r.keyOrder[l[t]],y=u?s.get(u):null,x=y&&this._markD(y),b=x&&this._pathBBox(x);if(!b||!i||!i.length){y&&y.els.forEach(S);continue}const A={x:b.minX,y:b.minY,width:b.maxX-b.minX,height:b.maxY-b.minY},_=y.fill&&0!==y.fill.indexOf("url(")?y.fill:(null==(e=this.w.globals.colors)?void 0:e[y.realIndex])||i[0].fill,w=f?this._makeExtentProber(x,A,o):null,$=w?d(A,i.length,w.intervalsAt):p(A,i.length);w&&w.dispose();const v=g($,t=>[t.x+t.width/2,t.y+t.height/2]),M=g(i,t=>[t.x,t.y]),P={remaining:M.length,els:y.els,g:o.appendChild(h.createElementNS("http://www.w3.org/2000/svg","g"))};for(let t=0;t<M.length;t++){const e=M[t],r=v[t],i=h.createElementNS("http://www.w3.org/2000/svg","rect"),s=e.x+n-e.r,l=e.y+a-e.r;i.setAttribute("data-key",u),i.setAttribute("x",String(s)),i.setAttribute("y",String(l)),i.setAttribute("width",String(2*e.r)),i.setAttribute("height",String(2*e.r)),i.setAttribute("rx",String(e.r)),i.setAttribute("fill",String(e.fill||_)),P.g.appendChild(i),c.push({el:i,from:{x:s,y:l,width:2*e.r,height:2*e.r,rx:e.r},to:{x:r.x,y:r.y,width:r.width,height:r.height,rx:0},fill:m(e.fill,_),fillEnd:String(_),delay:0,meta:{markState:P}})}}if(!c.length)return this._cancelPieces();this._runPieces(c,t=>{const e=t.meta.markState;e.remaining--,0===e.remaining&&(e.els.forEach(S),e.g.remove())})}_markD(t){return t.d||t.els.map(t=>t.getAttribute("pathTo")||t.getAttribute("d")).filter(Boolean).join(" ")}_runPieces(t,e){const r=this.getSpeed(),i=Math.min(300,.35*r),s=Math.max(180,r-i);for(let e=0;e<t.length;e++)t[e].delay=t.length>1?e/(t.length-1)*i:0;this._pieceCancel=function({pieces:t,duration:e,onPieceDone:r,onAllDone:i,alive:s}){let n=!1;const a=Date.now(),l=Math.max(1,e),o=(t,e)=>{const r=t.from,i=t.to,s=t.el;s.setAttribute("x",String(r.x+(i.x-r.x)*e)),s.setAttribute("y",String(r.y+(i.y-r.y)*e)),s.setAttribute("width",String(Math.max(0,r.width+(i.width-r.width)*e))),s.setAttribute("height",String(Math.max(0,r.height+(i.height-r.height)*e))),s.setAttribute("rx",String(Math.max(0,r.rx+(i.rx-r.rx)*e))),t.fill?s.setAttribute("fill",t.fill(e)):e>=1&&t.fillEnd&&s.setAttribute("fill",t.fillEnd)},c=()=>{if(n||s&&!s())return;const e=Date.now()-a;let u=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s._done)continue;const n=(e-s.delay)/l;if(n<1&&(u=!0),n<=0)continue;const a=Math.min(1,n);o(s,x(a)),a>=1&&(s._done=!0,r&&r(s))}u?h.requestAnimationFrame(c):i&&i()};return h.requestAnimationFrame(c),()=>{n=!0}}({pieces:t,duration:s,onPieceDone:e,alive:()=>!this.w.globals.isDestroyed,onAllDone:()=>{this._pieceCancel=null,this._cancelPieces()}})}_collectTargetMarks(t){var e;const r=null==(e=this.w.globals.dom)?void 0:e.baseEl,i=new Map;if(!r)return i;const s=P(t);if("radial"===s)return r.querySelectorAll(".apexcharts-pie-series .apexcharts-pie-area").forEach((t,e)=>{const r=t.getAttribute("data:pathFinal")||t.getAttribute("d");r&&r.trim()&&i.set(`${e}:0`,{realIndex:e,d:r,fill:t.getAttribute("fill"),els:[t]})}),i;const n="summary"===s?`.apexcharts-${t}-series`:".apexcharts-bar-series";return r.querySelectorAll(`${n} .apexcharts-series`).forEach(t=>{var e;const r=parseInt(null!=(e=t.getAttribute("data:realIndex"))?e:"0",10)||0;let s=0;t.querySelectorAll("path[pathTo]:not(.apexcharts-highlight-part)").forEach(t=>{var e;const n=t.getAttribute("pathTo")||t.getAttribute("d");if(!n||!n.trim())return;const a=parseInt(null!=(e=t.getAttribute("j"))?e:"",10),l=isNaN(a)?s++:a,o=`${r}:${l}`,h=i.get(o);h?h.els.push(t):i.set(o,{realIndex:r,fill:t.getAttribute("fill"),els:[t]})})}),i}_captureFromDOM(t){var e;const r=null==(e=this.w.globals.dom)?void 0:e.baseEl;if(!r)return{marks:[],branches:[],unitDots:new Map};const i=[],s=[],n=new Map,a=P(t);if("bar"===a){r.querySelectorAll(".apexcharts-bar-series .apexcharts-series").forEach(t=>{var e;const r=parseInt(null!=(e=t.getAttribute("data:realIndex"))?e:"0",10);t.querySelectorAll("path[pathTo]:not(.apexcharts-highlight-part)").forEach((t,e)=>{const s=t.getAttribute("d")||t.getAttribute("pathTo");s&&i.push({realIndex:r,j:e,d:s,fill:t.getAttribute("fill")})})})}else if("summary"===a){const e=new Map;r.querySelectorAll(`.apexcharts-${t}-area`).forEach(t=>{var r,i;const s=parseInt(null!=(r=t.getAttribute("j"))?r:"",10);if(isNaN(s))return;const n=t.getAttribute("d")||t.getAttribute("pathTo");if(!n||!n.trim())return;const a="function"==typeof t.closest?t.closest(".apexcharts-series"):null,l=parseInt(null!=(i=null==a?void 0:a.getAttribute("data:realIndex"))?i:"0",10)||0,o=`${l}:${s}`,h=e.get(o);h?h.d+=` ${n}`:e.set(o,{realIndex:l,j:s,d:n,fill:t.getAttribute("fill")})}),Array.from(e.values()).sort((t,e)=>t.realIndex-e.realIndex||t.j-e.j).forEach(t=>i.push(t))}else if("partition"===a)if("treemap"===t){const t=t=>{var e,r,i,s;const n=parseFloat(null!=(e=t.getAttribute("x"))?e:""),a=parseFloat(null!=(r=t.getAttribute("y"))?r:""),l=parseFloat(null!=(i=t.getAttribute("width"))?i:""),o=parseFloat(null!=(s=t.getAttribute("height"))?s:"");return[n,a,l,o].every(t=>isFinite(t))?`M ${n} ${a} L ${n+l} ${a} L ${n+l} ${a+o} L ${n} ${a+o} Z`:null};r.querySelectorAll(".apexcharts-treemap-rect").forEach(e=>{var r,s;const n=t(e);n&&i.push({realIndex:parseInt(null!=(r=e.getAttribute("i"))?r:"0",10)||0,j:parseInt(null!=(s=e.getAttribute("j"))?s:"0",10)||0,d:n,fill:e.getAttribute("fill"),key:e.getAttribute("data:key")||null})});r.querySelectorAll(".apexcharts-treemap-parent-rect").forEach(e=>{const r=t(e),i=e.getAttribute("data:key");r&&i&&s.push({key:i,d:r,fill:e.getAttribute("fill")})})}else{const t=r.querySelectorAll(".apexcharts-sunburst-arc"),e=[];t.forEach(t=>{"true"===t.getAttribute("data:leaf")&&e.push(t)});(e.length?e:Array.from(t)).forEach((t,e)=>{const r=t.getAttribute("d");r&&r.trim()&&i.push({realIndex:e,j:0,d:r,fill:t.getAttribute("fill"),key:t.getAttribute("data:key")||null})}),t.forEach(t=>{if("true"===t.getAttribute("data:leaf"))return;const e=t.getAttribute("d"),r=t.getAttribute("data:key");e&&e.trim()&&r&&s.push({key:r,d:e,fill:t.getAttribute("fill")})})}else if("unit"===a)this._readUnitDots(r,n),Array.from(n.keys()).sort((t,e)=>t-e).forEach(t=>{const e=n.get(t),r=e.map(t=>t.x),s=e.map(t=>t.y),a=Math.min(...r)-2,l=Math.min(...s)-2,o=Math.max(...r)+2,h=Math.max(...s)+2;i.push({realIndex:t,j:0,d:`M ${a} ${l} L ${o} ${l} L ${o} ${h} L ${a} ${h} Z`,fill:e[0].fill})});else if("radial"===a)if("radialBar"===t||"gauge"===t){const t=this.w.globals.circleGeometry,e=t?t.cx:this.w.layout.gridWidth/2,s=t?t.cy:this.w.layout.gridHeight/2;r.querySelectorAll(".apexcharts-radial-series .apexcharts-radialbar-area").forEach(t=>{var r;const n=t.parentElement,a=parseInt(null!=(r=null==n?void 0:n.getAttribute("data:realIndex"))?r:"0",10),l=t.getAttribute("d");if(!l)return;const o=parseFloat(t.getAttribute("stroke-width")||"0"),h=o>1&&this._radialArcToFilledSegment(l,o,e,s)||l;i.push({realIndex:a,j:0,d:h,fill:t.getAttribute("stroke")})})}else{r.querySelectorAll(".apexcharts-pie-series .apexcharts-pie-area").forEach((t,e)=>{const r=t.getAttribute("d");r&&i.push({realIndex:e,j:0,d:r,fill:t.getAttribute("fill")})})}return{marks:i,branches:s,unitDots:n}}_radialArcToFilledSegment(t,e,r,i){const s=t.match(/M\s*(-?[\d.]+)\s+(-?[\d.]+)\s+A\s*(-?[\d.]+)\s+(?:-?[\d.]+)\s+(?:-?[\d.]+)\s+(\d)\s+(\d)\s+(-?[\d.]+)\s+(-?[\d.]+)/);if(!s)return null;const n=parseFloat(s[1]),a=parseFloat(s[2]),l=parseFloat(s[3]),o=parseInt(s[4],10),h=parseInt(s[5],10),c=parseFloat(s[6]),u=parseFloat(s[7]);if(!isFinite(l)||l<=0)return null;const p=e/2,d=l+p,f=Math.max(0,l-p),g=(t,e,s)=>{const n=t-r,a=e-i,l=Math.sqrt(n*n+a*a);if(0===l)return{x:r,y:i};const o=s/l;return{x:r+n*o,y:i+a*o}},y=g(n,a,d),m=g(c,u,d),x=g(n,a,f),b=g(c,u,f),A=h?0:1;return`M ${y.x} ${y.y} A ${d} ${d} 0 ${o} ${h} ${m.x} ${m.y} L ${b.x} ${b.y} A ${f} ${f} 0 ${o} ${A} ${x.x} ${x.y} Z`}buildRingSegmentPath(t,e,r,i,s,n){const a=i/2,l=r+a,o=Math.max(0,r-a),h=(s-90)*Math.PI/180,c=(n-90)*Math.PI/180,u=t+l*Math.cos(h),p=e+l*Math.sin(h),d=t+l*Math.cos(c),f=e+l*Math.sin(c),g=t+o*Math.cos(h),y=e+o*Math.sin(h),m=t+o*Math.cos(c),x=e+o*Math.sin(c),b=n>s?1:0,A=Math.abs(n-s)>180?1:0;return`M ${u} ${p} A ${l} ${l} 0 ${A} ${b} ${d} ${f} L ${m} ${x} A ${o} ${o} 0 ${A} ${1-b} ${g} ${y} Z`}getFromType(){return this._snapshot?this._snapshot.fromType:null}_buildMapping(t,e,r,i,s){const n=new Map,a=P(r),l=t.slice().sort((t,e)=>t.realIndex-e.realIndex||t.j-e.j);if("partition"===a&&s&&s.length){const t=l.filter(t=>t.key);t.length===l.length&&(t.forEach(t=>{n.set(`key:${t.key}`,{d:t.d,fill:t.fill})}),s.forEach(t=>{n.set(`key:${t.key}`,{d:t.d,fill:t.fill})}))}const o="unit"===P(e);if("radial"===a||"unit"===a||"partition"===a)return l.forEach((t,e)=>{n.set(`${o?t.realIndex:e}:0`,{d:t.d,fill:t.fill})}),n;if("bar"===a||"summary"===a){const t=this._targetKeys(a,i);l.forEach((e,r)=>{const i=t[o?e.realIndex:r];i&&n.set(i,{d:e.d,fill:e.fill})})}return n}_targetKeys(t,e){var r;const i=[],s=Array.isArray(e)?e:[];if("radial"===t){const t=1===s.length&&Array.isArray(null==(r=s[0])?void 0:r.data)?s[0].data.length:s.length;for(let e=0;e<t;e++)i.push(`${e}:0`)}else s.forEach((t,e)=>{const r=t&&Array.isArray(t.data)?t.data:[];for(let t=0;t<r.length;t++)i.push(`${e}:${t}`)});return i}isActive(){return null!==this._snapshot}getInitialPathFor(t,e){if(!this._snapshot)return null;const r=this._snapshot.mapping.get(`${t}:${e}`);if(!r)return null;const{k:i,dx:s,dy:n}=this._oldToNew();return 1===i&&0===s&&0===n?r.d:this._translatePathD(r.d,s,n,i)}_oldToNew(){var t,e,r;const i=this._snapshot.oldLayout;return{k:null!=(t=i.scale)?t:1,dx:i.translateX+(null!=(e=i.shiftX)?e:0)-(this.w.layout.translateX||0),dy:i.translateY+(null!=(r=i.shiftY)?r:0)-(this.w.layout.translateY||0)}}_translatePathD(t,e,r,i=1){if(0===e&&0===r&&1===i)return t;const s=u(t),n=t=>t*i+e,a=t=>t*i+r;return s.map(t=>{const e=t[0];return"Z"===e?"Z":"M"===e||"L"===e||"T"===e?`${e} ${n(t[1])} ${a(t[2])}`:"H"===e?`${e} ${n(t[1])}`:"V"===e?`${e} ${a(t[1])}`:"C"===e?`${e} ${n(t[1])} ${a(t[2])} ${n(t[3])} ${a(t[4])} ${n(t[5])} ${a(t[6])}`:"S"===e||"Q"===e?`${e} ${n(t[1])} ${a(t[2])} ${n(t[3])} ${a(t[4])}`:"A"===e?`${e} ${t[1]*i} ${t[2]*i} ${t[3]} ${t[4]} ${t[5]} ${n(t[6])} ${a(t[7])}`:t.join(" ")}).join(" ")}getInitialCenterFor(t){const e=this.getInitialBBoxFor(t);return e?{x:e.x+e.width/2,y:e.y+e.height/2}:null}getInitialPathAt(t){return this.getInitialPathFor(t,0)}getInitialPathForKey(t){return this._snapshot&&t?this.getInitialPathFor("key",t):null}hasKeyedMarks(){if(!this._snapshot)return!1;for(const t of this._snapshot.mapping.keys())if("string"==typeof t&&t.startsWith("key:"))return!0;return!1}getInitialSlotFor(t,e,r){const i=this.getInitialBBoxFor(t);if(!i)return null;const s=i.x+i.width/2,n=i.y+i.height/2;if(!(r>1&&e>=0))return{x:s,y:n};const a=(Math.min(e,r-1)+.5)/r;return i.height>=i.width?{x:s,y:i.y+i.height*(1-a)}:{x:i.x+i.width*a,y:n}}getInitialBBoxFor(t){if(!this._snapshot)return null;const e=this._snapshot.mapping.get(`${t}:0`);if(!e)return null;const r=this._pathBBox(e.d);if(!r)return null;const{k:i,dx:s,dy:n}=this._oldToNew();return{x:r.minX*i+s,y:r.minY*i+n,width:(r.maxX-r.minX)*i,height:(r.maxY-r.minY)*i}}_pathBBox(t){let e=1/0,r=1/0,i=-1/0,s=-1/0,n=0,a=0,l=0,o=0;const h=(t,n)=>{isFinite(t)&&isFinite(n)&&(t<e&&(e=t),t>i&&(i=t),n<r&&(r=n),n>s&&(s=n))};return u(t).forEach(t=>{const e=t[0];if("Z"===e)return n=l,void(a=o);const r=t.length,i="H"===e?t[1]:"V"===e?n:t[r-2],s="H"===e?a:"V"===e?t[1]:t[r-1];if("A"===e){if(t[1]){const e=(n-i)/2,r=(a-s)/2,l=(t[4]===t[5]?-1:1)*Math.sqrt(Math.max(0,t[1]*t[1]/(e*e+r*r)-1)),o=n-e+l*r,c=a-r-l*e,u=Math.hypot(n-o,a-c),p=Math.atan2(a-c,n-o),d=2*Math.PI;let f=Math.atan2(s-c,i-o)-p;t[5]&&f<0?f+=d:!t[5]&&f>0&&(f-=d);for(let t=0;t<d;t+=Math.PI/2){((f>0?t-p:p-t)%d+d)%d<=Math.abs(f)&&h(o+u*Math.cos(t),c+u*Math.sin(t))}}}else if("H"!==e&&"V"!==e)for(let e=1;e+1<r;e+=2)h(t[e],t[e+1]);h(i,s),n=i,a=s,"M"===e&&(l=i,o=s)}),e>i?null:{minX:e,minY:r,maxX:i,maxY:s}}getSpeed(){const t=this.w.config.chart.animations;return t.chartTypeMorph&&t.chartTypeMorph.speed||t.speed||600}applyChromeFade(){var t;if(!this._snapshot||!o.isBrowser())return;this._shown=!0;const e=null==(t=this.w.globals.dom)?void 0:t.baseEl;if(!e||this._snapshot.resume)return;this._snapshot.pieceOut?this._separatePieces():this._snapshot.pieceIn?this._combinePieces():this._mountGhost();const r=this.getSpeed(),i=Array.from(e.querySelectorAll(".apexcharts-xaxis,.apexcharts-yaxis,.apexcharts-grid,.apexcharts-legend,.apexcharts-title-text,.apexcharts-subtitle-text")).filter(t=>t.style),s=(t,e)=>i.forEach(r=>{r.style.opacity=t,null!=e&&(r.style.transition=e)});s("0",`opacity ${r}ms ease-out`);const n=()=>this.w.globals.isDestroyed;h.requestAnimationFrame(()=>n()||s("1")),setTimeout(()=>n()||s("",""),r+80);const a=this._snapshot;setTimeout(()=>{n()||this._snapshot&&this._snapshot!==a||this.cleanup()},r+100)}retire(){const t=this._snapshot;if(!t||!this._shown)return;const e=this._pieceLayer;this.ctx._unitPieces=t.pieceOut&&e;const r=new Map;null==e||e.querySelectorAll("g").forEach(t=>{const e=t.firstChild&&t.getBBox();e&&r.set(t.firstChild.getAttribute("data-key"),{d:`M${e.x} ${e.y}H${e.x+e.width}V${e.y+e.height}H${e.x}Z`})}),this.cleanup(!0),r.size&&(this._collectTargetMarks(t.toType).forEach((t,e)=>{r.has(e)||r.set(e,{d:this._markD(t)})}),this.w.globals.previousPaths=[],this._snapshot=Object.assign(t,{mapping:r,pieceIn:!1,resume:!0,oldLayout:n({},this.w.layout)}),h.requestAnimationFrame(()=>{this._snapshot===t&&(this._shown=!0)}))}cleanup(t){this._snapshot=null,this._shown=!1,t||this._removeGhost(),this._cancelPieces()}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>l.default});
|