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
|
@@ -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 t(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const o in t)if("default"!==o){const a=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>t[o]})}return e.default=t,Object.freeze(e)}const e=t(require("apexcharts/core")),o=e.__apex_Graphics,a=e.__apex_Utils,n=e.__apex_CoreUtils,i=e.__apex_Animations_applyProgressiveReveal;class s{constructor(t){this.w=t.w,this.annoCtx=t}setOrientations(t,e=null){var o,a;const n=this.w;if("vertical"===t.label.orientation){const i=null!==e?e:0,s=n.dom.baseEl.querySelector(`.apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='${i}']`);if(null!==s){const e=s.getBBox();s.setAttribute("x",String(parseFloat(null!=(o=s.getAttribute("x"))?o:"0")-e.height+4));const n="top"===t.label.position?e.width:-e.width;s.setAttribute("y",String(parseFloat(null!=(a=s.getAttribute("y"))?a:"0")+n));const{x:i,y:l}=this.annoCtx.graphics.rotateAroundCenter(s);s.setAttribute("transform",`rotate(-90 ${i} ${l})`)}}}addBackgroundToAnno(t,e){const o=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;const a=o.dom.baseEl.querySelector(".apexcharts-grid");if(!a)return null;const n=a.getBoundingClientRect(),i=a.getBBox(),s=n.width/i.width||1,l=t.getBoundingClientRect();let{left:r,right:d,top:h,bottom:c}=e.label.style.padding;"vertical"===e.label.orientation&&([h,c,r,d]=[r,d,h,c]);const x=n.left-i.x*s,p=n.top-i.y*s,g=(l.left-x)/s-r,f=(l.top-p)/s-h,b=this.annoCtx.graphics.drawRect(g,f,l.width/s+r+d,l.height/s+h+c,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&b.node.classList.add(e.id),b}annotationsBackground(){const t=this.w,e=(e,o,a)=>{const n=t.dom.baseEl.querySelector(`.apexcharts-${a}-annotations .apexcharts-${a}-annotation-label[rel='${o}']`);if(n){const o=n.parentNode,a=this.addBackgroundToAnno(n,e);if(a){null==o||o.insertBefore(a.node,n);const s=n.getAttribute("x");null!==s&&i(a,parseFloat(s),t),e.label.mouseEnter&&a.node.addEventListener("mouseenter",e.label.mouseEnter.bind(this,e)),e.label.mouseLeave&&a.node.addEventListener("mouseleave",e.label.mouseLeave.bind(this,e)),e.label.click&&a.node.addEventListener("click",e.label.click.bind(this,e))}}};t.config.annotations.xaxis.forEach((t,o)=>e(t,o,"xaxis")),t.config.annotations.yaxis.forEach((t,o)=>e(t,o,"yaxis")),t.config.annotations.points.forEach((t,o)=>e(t,o,"point"))}usesCategoryX(){const t=this.w;return("category"===t.config.xaxis.type||t.config.xaxis.convertedCatToNumeric)&&!this.annoCtx.invertAxis&&!t.axisFlags.dataFormatXNumeric&&!t.config.chart.sparkline.enabled}hasXDomain(){const t=this.w;return this.annoCtx.invertAxis?a.isNumber(t.globals.minY)&&a.isNumber(t.globals.yRange[0]):this.usesCategoryX()?t.labelData.labels.length>0||t.labelData.categoryLabels.length>0:a.isNumber(t.globals.minX)&&a.isNumber(t.globals.xRange)}getY1Y2(t,e){var o,a,i;const s=this.w,l="y1"===t?e.y:e.y2,r="string"==typeof l&&l.includes("px");let d,h=!1;if(this.annoCtx.invertAxis){const t=s.config.xaxis.convertedCatToNumeric?s.labelData.categoryLabels:s.labelData.labels,a=t.indexOf(l);if(!r&&-1===a)return{yP:0,clipped:!0};const n=s.dom.baseEl.querySelector(`.apexcharts-yaxis-texts-g text:nth-child(${a+1})`);d=n?parseFloat(null!=(o=n.getAttribute("y"))?o:"0"):(s.layout.gridHeight/t.length-1)*(a+1)-s.globals.barHeight,void 0!==e.seriesIndex&&s.globals.barHeight&&(d+=this.barSlotOffset(e.seriesIndex,s.globals.barHeight))}else{if(!s.config.yaxis[e.yAxisIndex])return{yP:0,clipped:!0};const t=s.globals.seriesYAxisMap[e.yAxisIndex],o=null!=(a=null==t?void 0:t[0])?a:null;if(null===o&&s.seriesData.series.length)return{yP:0,clipped:!0};const r=null===o?s.globals.minY:s.globals.minYArr[o],c=null===o?s.globals.maxY-s.globals.minY:s.globals.yRange[o],x=s.config.yaxis[e.yAxisIndex].logarithmic&&null!==o?new n(this.w).getLogVal(s.config.yaxis[e.yAxisIndex].logBase,l,o)/s.globals.yLogRatio[o]:(l-r)/(c/s.layout.gridHeight);d=s.layout.gridHeight-Math.min(Math.max(x,0),s.layout.gridHeight),h=x>s.layout.gridHeight||x<0,!e.marker||void 0!==e.y&&null!==e.y||(d=0),(null==(i=s.config.yaxis[e.yAxisIndex])?void 0:i.reversed)&&(d=x)}return r&&(d=parseFloat(l)),{yP:d,clipped:h}}getX1X2(t,e){const o=this.w,a="x1"===t?e.x:e.x2,n=this.annoCtx.invertAxis?o.globals.minY:o.globals.minX,i=this.annoCtx.invertAxis?o.globals.maxY:o.globals.maxX,s=this.annoCtx.invertAxis?o.globals.yRange[0]:o.globals.xRange;let l=!1;const r="string"==typeof a&&a.includes("px"),d=null==a&&e.marker;if(!r&&!d&&!this.hasXDomain())return{x:0,clipped:!0};let h=this.annoCtx.inversedReversedAxis?(i-a)/(s/o.layout.gridWidth):(a-n)/(s/o.layout.gridWidth);return this.usesCategoryX()&&(h=this.getStringX(a)),"string"==typeof a&&a.includes("px")&&(h=parseFloat(a)),null==a&&e.marker&&(h=o.layout.gridWidth),void 0!==e.seriesIndex&&o.globals.barWidth&&!this.annoCtx.invertAxis&&(h+=this.barSlotOffset(e.seriesIndex,o.globals.barWidth)),"number"!=typeof h&&(h=0,l=!0),parseFloat(h.toFixed(10))>parseFloat(o.layout.gridWidth.toFixed(10))?(h=o.layout.gridWidth,l=!0):h<0&&(h=0,l=!0),{x:h,clipped:l}}barSlotOffset(t,e){const o=this.w;if(o.config.chart.stacked)return 0;let a=0,n=0;return o.seriesData.series.forEach((e,i)=>{var s;const l=null==(s=o.config.series[i])?void 0:s.type;!e.length||o.globals.comboCharts&&"bar"!==l&&"column"!==l||(i<t&&n++,a++)}),e*(n-(a-1)/2)}getStringX(t){var e;const o=this.w;let a=t;if(o.config.xaxis.convertedCatToNumeric&&o.labelData.categoryLabels.length){const e=String(t);t=o.labelData.categoryLabels.findIndex(t=>String(t)===e)+1}const n=o.labelData.labels.map(t=>Array.isArray(t)?t.join(" "):t).indexOf(t),i=o.dom.baseEl.querySelector(`.apexcharts-xaxis-texts-g text:nth-child(${n+1})`);return i?a=parseFloat(null!=(e=i.getAttribute("x"))?e:"0"):n>-1&&(a=o.axisFlags.isXNumeric?(t-o.globals.minX)/(o.globals.xRange/o.layout.gridWidth):o.globals.padHorizontal+(n+.5)*o.layout.gridWidth/o.globals.dataPoints),a}}class l{constructor(t){this.w=t.w,this.annoCtx=t,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new s(this.annoCtx)}addXaxisAnnotation(t,e,o){const n=this.w,s=this.helpers.getX1X2("x1",t);let l=s.x;const r=s.clipped;let d,h=!0;const c=t.label.text,x=t.strokeDashArray;if(a.isNumber(l)){if(null===t.x2||void 0===t.x2){if(!r){const o=this.annoCtx.graphics.drawLine(l+t.offsetX,0+t.offsetY,l+t.offsetX,n.layout.gridHeight+t.offsetY,t.borderColor,x,t.borderWidth);e.appendChild(o.node),t.id&&o.node.classList.add(t.id),i(o,l+t.offsetX,n)}}else{const o=this.helpers.getX1X2("x2",t);if(d=o.x,h=o.clipped,d<l){const t=l;l=d,d=t}const a=this.annoCtx.graphics.drawRect(l+t.offsetX,0+t.offsetY,d-l,n.layout.gridHeight+t.offsetY,0,t.fillColor,t.opacity,1,t.borderColor,x);a.node.classList.add("apexcharts-annotation-rect"),a.attr("clip-path",`url(#gridRectMask${n.globals.cuid})`),e.appendChild(a.node),t.id&&a.node.classList.add(t.id),i(a,l+t.offsetX,n)}if(!r||!h){const a=this.annoCtx.graphics.getTextRects(c,t.label.style.fontSize),s="top"===t.label.position?4:"center"===t.label.position?n.layout.gridHeight/2+("vertical"===t.label.orientation?a.width/2:0):n.layout.gridHeight,r=this.annoCtx.graphics.drawText({x:l+t.label.offsetX,y:s+t.label.offsetY-("vertical"===t.label.orientation?"top"===t.label.position?a.width/2-12:-a.width/2:0),text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-xaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});r.attr({rel:o}),e.appendChild(r.node),i(r,l+t.label.offsetX,n),this.annoCtx.helpers.setOrientations(t,o)}}}drawXAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return t.config.annotations.xaxis.map((t,o)=>{this.addXaxisAnnotation(t,e.node,o)}),e}}const r=e.__apex_axes_AxesUtils;class d{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new s(this.annoCtx),this.axesUtils=new r(this.annoCtx.w,{theme:this.annoCtx.theme,timeScale:this.annoCtx.timeScale})}addYaxisAnnotation(t,e,o){const a=this.w,n=t.strokeDashArray;let i=this.helpers.getY1Y2("y1",t),s=i.yP;const l=i.clipped;let r,d=!0,h=!1;const c=t.label.text;if(null===t.y2||void 0===t.y2){if(!l){h=!0;const o=this.annoCtx.graphics.drawLine(0+t.offsetX,s+t.offsetY,this._getYAxisAnnotationWidth(t),s+t.offsetY,t.borderColor,n,t.borderWidth);e.appendChild(o.node),t.id&&o.node.classList.add(t.id)}}else{if(i=this.helpers.getY1Y2("y2",t),r=i.yP,d=i.clipped,r>s){const t=s;s=r,r=t}if(!l||!d){h=!0;const o=this.annoCtx.graphics.drawRect(0+t.offsetX,r+t.offsetY,this._getYAxisAnnotationWidth(t),s-r,0,t.fillColor,t.opacity,1,t.borderColor,n);o.node.classList.add("apexcharts-annotation-rect"),o.attr("clip-path",`url(#gridRectMask${a.globals.cuid})`),e.appendChild(o.node),t.id&&o.node.classList.add(t.id)}}if(h){const n="right"===t.label.position?a.layout.gridWidth:"center"===t.label.position?a.layout.gridWidth/2:0,i=this.annoCtx.graphics.drawText({x:n+t.label.offsetX,y:(null!=r?r:s)+t.label.offsetY-3,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-yaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});i.attr({rel:o}),e.appendChild(i.node)}}_getYAxisAnnotationWidth(t){const e=this.w;let o=e.layout.gridWidth;return o=t.width.indexOf("%")>-1?e.layout.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10),o+t.offsetX}drawYAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return t.config.annotations.yaxis.forEach((t,o)=>{t.yAxisIndex=this.axesUtils.translateYAxisIndex(t.yAxisIndex),this.axesUtils.isYAxisHidden(t.yAxisIndex)&&this.axesUtils.yAxisAllSeriesCollapsed(t.yAxisIndex)||this.addYaxisAnnotation(t,e.node,o)}),e}}const h=e.__apex_BrowserAPIs_BrowserAPIs;class c{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new s(this.annoCtx)}addPointAnnotation(t,e,o){const n=this.w;if(n.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)return;const s=this.helpers.getX1X2("x1",t),l=s.x,r=s.clipped,d=this.helpers.getY1Y2("y1",t),h=d.yP,c=d.clipped;if(a.isNumber(l)&&!c&&!r){const a={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:`apexcharts-point-annotation-marker ${t.marker.cssClass} ${t.id?t.id:""}`};let s=this.annoCtx.graphics.drawMarker(l+t.marker.offsetX,h+t.marker.offsetY,a);e.appendChild(s.node);const r=[s.node];i(s,l,n);const d=t.label.text?t.label.text:"",c=this.getConstrainedLabelX(d,l+t.label.offsetX,t.label),x=this.annoCtx.graphics.drawText({x:c,y:h+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-point-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});if(x.attr({rel:o}),e.appendChild(x.node),i(x,l,n),t.customSVG.SVG){const o=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});o.attr({transform:`translate(${l+t.customSVG.offsetX}, ${h+t.customSVG.offsetY})`}),o.node.innerHTML=t.customSVG.SVG,e.appendChild(o.node),r.push(o.node)}if(t.image.path){const e=t.image.width?t.image.width:20,o=t.image.height?t.image.height:20;s=this.annoCtx.addImage({x:l+t.image.offsetX-e/2,y:h+t.image.offsetY-o/2,width:e,height:o,path:t.image.path,appendTo:".apexcharts-point-annotations"}),r.push(s.node)}t.tooltip&&t.tooltip.enabled&&r.forEach(e=>{e.addEventListener("mouseenter",()=>{this.showPointTooltip(t,e)}),e.addEventListener("mouseleave",()=>{this.hidePointTooltip()})}),t.mouseEnter&&s.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&s.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&s.node.addEventListener("click",t.click.bind(this,t))}}getConstrainedLabelX(t,e,o){const a=this.w;if(!t)return e;const{width:n}=this.annoCtx.graphics.getTextRects(t,o.style.fontSize,o.style.fontFamily,void 0,!0,o.style.fontWeight);let i,s;switch(o.textAnchor){case"start":i=e,s=e+n;break;case"end":i=e-n,s=e;break;default:i=e-n/2,s=e+n/2}const l=o.style.padding||{};return i-=l.left||0,s+=l.right||0,i<0?e-i:s>a.layout.gridWidth?e-(s-a.layout.gridWidth):e}getPointTooltipEl(){const t=this.w;let e=t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");return e||(e=h.createElementNS("http://www.w3.org/1999/xhtml","div"),e.classList.add("apexcharts-tooltip","apexcharts-annotation-tooltip"),t.dom.elWrap.appendChild(e)),e}getPointTooltipContent(t){const e=this.w,o=t.tooltip||{};if("function"==typeof o.formatter)return o.formatter({annotation:t,seriesIndex:t.seriesIndex,id:t.id,w:e});let a=null!=o.text?o.text:t.label&&t.label.text;return Array.isArray(a)&&(a=a.join("<br/>")),null==a?"":String(a)}showPointTooltip(t,e){const o=this.w,a=this.getPointTooltipContent(t);if(!a)return;const n=this.getPointTooltipEl();n.innerHTML=a;const i=t.tooltip.theme||o.config.tooltip.theme||"light";n.classList.remove("apexcharts-theme-light","apexcharts-theme-dark"),n.classList.add(`apexcharts-theme-${i}`),n.classList.add("apexcharts-active");const s=o.dom.elWrap.getBoundingClientRect(),l=e.getBoundingClientRect(),r=n.getBoundingClientRect(),d=t.tooltip.offsetX||0,h=t.tooltip.offsetY||0;let c=l.left-s.left+l.width/2-r.width/2,x=l.top-s.top-r.height-10;c=Math.max(0,Math.min(c,s.width-r.width)),x<0&&(x=l.top-s.top+l.height+10),n.style.left=c+d+"px",n.style.top=x+h+"px"}hidePointTooltip(){const t=this.w.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");t&&t.classList.remove("apexcharts-active")}drawPointAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return t.config.annotations.points.map((t,o)=>{this.addPointAnnotation(t,e.node,o)}),e}}const x=e.__apex_Options;e.default.registerFeatures({annotations:class{constructor(t,{theme:e=null,timeScale:a=null}={}){this.w=t,this.theme=e,this.timeScale=a,this.invertAxis=void 0,this.inversedReversedAxis=void 0,this.graphics=new o(this.w),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new s(this),this.xAxisAnnotations=new l(this),this.yAxisAnnotations=new d(this),this.pointsAnnotations=new c(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0)}drawAxesAnnotations(){const t=this.w;if(t.globals.axisCharts){const e=this.yAxisAnnotations.drawYAxisAnnotations(),o=this.xAxisAnnotations.drawXAxisAnnotations(),a=this.pointsAnnotations.drawPointAnnotations(),n=t.config.chart.animations.enabled,i=[e,o,a],s=[o.node,e.node,a.node],l="line"===t.config.chart.type||"area"===t.config.chart.type||"rangeArea"===t.config.chart.type,r=[l,!1,l];for(let e=0;e<3;e++)t.dom.elGraphical.add(i[e]),!n||t.globals.resized||t.globals.dataChanged||t.globals.animationEnded||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&!r[e]&&s[e].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:s[e],index:0});this.helpers.annotationsBackground()}}drawImageAnnos(){this.w.config.annotations.images.map(t=>{this.addImage(t)})}drawTextAnnos(){this.w.config.annotations.texts.map(t=>{this.addText(t)})}addXaxisAnnotation(t,e,o){this.xAxisAnnotations.addXaxisAnnotation(t,e,o)}addYaxisAnnotation(t,e,o){this.yAxisAnnotations.addYaxisAnnotation(t,e,o)}addPointAnnotation(t,e,o){this.pointsAnnotations.addPointAnnotation(t,e,o)}addText(t){const{x:e,y:o,text:a,textAnchor:n,foreColor:i,fontSize:s,fontFamily:l,fontWeight:r,cssClass:d,backgroundColor:h,borderWidth:c,strokeDashArray:x,borderRadius:p,borderColor:g,appendTo:f=".apexcharts-svg",paddingLeft:b=4,paddingRight:u=4,paddingBottom:y=2,paddingTop:m=2}=t,A=this.w,w=A.dom.baseEl.querySelector(f);if(!w)return;const C=this.graphics.drawText({x:e,y:o,text:a,textAnchor:n||"start",fontSize:s||"12px",fontWeight:r||"regular",fontFamily:l||A.config.chart.fontFamily,foreColor:i||A.config.chart.foreColor,cssClass:d||""});w.appendChild(C.node);const v=C.bbox();if(a){const t=this.graphics.drawRect(v.x-b,v.y-m,v.width+b+u,v.height+y+m,p,h||"transparent",1,c,g,x);w.insertBefore(t.node,C.node)}}addImage(t){const e=this.w,{path:o,x:a=0,y:n=0,width:i=20,height:s=20,appendTo:l=".apexcharts-svg"}=t,r=e.dom.Paper.image(o);r.size(i,s).move(a,n);const d=e.dom.baseEl.querySelector(l);return d&&d.appendChild(r.node),r}addXaxisAnnotationExternal(t,e,o){return this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"xaxis",contextMethod:o.addXaxisAnnotation}),o}addYaxisAnnotationExternal(t,e,o){return this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"yaxis",contextMethod:o.addYaxisAnnotation}),o}addPointAnnotationExternal(t,e,o){return void 0===this.invertAxis&&(this.invertAxis=o.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"point",contextMethod:o.addPointAnnotation}),o}addAnnotationExternal({params:t,pushToMemory:e,context:o,type:n,contextMethod:i}){var s;const l=o,r=l.w,d=r.dom.baseEl.querySelector(`.apexcharts-${n}-annotations`),h=((null==(s=r.config.annotations["point"===n?"points":n])?void 0:s.length)||0)+d.childNodes.length,c=new x,p=Object.assign({},"xaxis"===n?c.xAxisAnnotation:"yaxis"===n?c.yAxisAnnotation:c.pointAnnotation),g=a.extend(p,t);switch(n){case"xaxis":this.addXaxisAnnotation(g,d,h);break;case"yaxis":this.addYaxisAnnotation(g,d,h);break;case"point":this.addPointAnnotation(g,d,h)}const f=r.dom.baseEl.querySelector(`.apexcharts-${n}-annotations .apexcharts-${n}-annotation-label[rel='${h}']`),b=this.helpers.addBackgroundToAnno(f,g);return b&&d.insertBefore(b.node,f),e&&r.globals.memory.methodsToExec.push({context:l,id:g.id?g.id:a.randomId(),method:i,label:"addAnnotation",params:t}),o}_removeAnnotationTooltip(t){const e=t.dom.elWrap&&t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");e&&e.parentNode&&e.parentNode.removeChild(e)}clearAnnotations(t){const e=t.w;this._removeAnnotationTooltip(e);const o=e.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations");for(let t=e.globals.memory.methodsToExec.length-1;t>=0;t--)"addText"!==e.globals.memory.methodsToExec[t].label&&"addAnnotation"!==e.globals.memory.methodsToExec[t].label||e.globals.memory.methodsToExec.splice(t,1);Array.prototype.forEach.call(o,t=>{for(;t.firstChild;)t.removeChild(t.firstChild)})}removeAnnotation(t,e){const o=t.w;this._removeAnnotationTooltip(o);const a=o.dom.baseEl.querySelectorAll(`.${e}`);a&&(o.globals.memory.methodsToExec=o.globals.memory.methodsToExec.filter(t=>t.id!==e),Object.keys(o.config.annotations).forEach(t=>{const a=o.config.annotations[t];Array.isArray(a)&&(o.config.annotations[t]=a.filter(t=>t.id!==e))}),Array.prototype.forEach.call(a,t=>{t.parentElement.removeChild(t)}))}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>e.default});
|
|
@@ -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(t){var e="undefined"!=typeof globalThis?globalThis:self,a=e.ApexCharts;if(a&&a.__internals)return t.call(e);if(a)throw new Error("ApexCharts: dist/features/annotations.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 t.call(e);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/annotations.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 o={file:"dist/features/annotations.js",run:t,done:!1},n=e.__apexcharts_pending_addons__||(e.__apexcharts_pending_addons__=[]);n.push(o),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!o.done){var a=e.ApexCharts;if(a)if(a.__internals){o.done=!0;var s=n.indexOf(o);-1!==s&&n.splice(s,1);try{t.call(e),a.__drainsAddons||e.console.warn("ApexCharts: dist/features/annotations.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(t){e.console.error("ApexCharts: dist/features/annotations.js could not register with the ApexCharts script on this page: "+(t&&t.message))}}else e.console.error("ApexCharts: dist/features/annotations.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 e.console.warn("ApexCharts: dist/features/annotations.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 t,e;t=this,e=function(t){"use strict";const e=globalThis.ApexCharts,a=globalThis.ApexCharts.__internals.__apex_Graphics,o=globalThis.ApexCharts.__internals.__apex_Utils,n=globalThis.ApexCharts.__internals.__apex_CoreUtils,s=globalThis.ApexCharts.__internals;s.__apex_Animations,s.__apex_Animations_computeStagger,s.__apex_Animations_applyAnimationPolicy,s.__apex_Animations_prefersReducedMotion;const i=s.__apex_Animations_applyProgressiveReveal;class r{constructor(t){this.w=t.w,this.annoCtx=t}setOrientations(t,e=null){var a,o;const n=this.w;if("vertical"===t.label.orientation){const s=null!==e?e:0,i=n.dom.baseEl.querySelector(`.apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='${s}']`);if(null!==i){const e=i.getBBox();i.setAttribute("x",String(parseFloat(null!=(a=i.getAttribute("x"))?a:"0")-e.height+4));const n="top"===t.label.position?e.width:-e.width;i.setAttribute("y",String(parseFloat(null!=(o=i.getAttribute("y"))?o:"0")+n));const{x:s,y:r}=this.annoCtx.graphics.rotateAroundCenter(i);i.setAttribute("transform",`rotate(-90 ${s} ${r})`)}}}addBackgroundToAnno(t,e){const a=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;const o=a.dom.baseEl.querySelector(".apexcharts-grid");if(!o)return null;const n=o.getBoundingClientRect(),s=o.getBBox(),i=n.width/s.width||1,r=t.getBoundingClientRect();let{left:l,right:d,top:h,bottom:c}=e.label.style.padding;"vertical"===e.label.orientation&&([h,c,l,d]=[l,d,h,c]);const p=n.left-s.x*i,x=n.top-s.y*i,g=(r.left-p)/i-l,f=(r.top-x)/i-h,u=this.annoCtx.graphics.drawRect(g,f,r.width/i+l+d,r.height/i+h+c,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&u.node.classList.add(e.id),u}annotationsBackground(){const t=this.w,e=(e,a,o)=>{const n=t.dom.baseEl.querySelector(`.apexcharts-${o}-annotations .apexcharts-${o}-annotation-label[rel='${a}']`);if(n){const a=n.parentNode,o=this.addBackgroundToAnno(n,e);if(o){null==a||a.insertBefore(o.node,n);const s=n.getAttribute("x");null!==s&&i(o,parseFloat(s),t),e.label.mouseEnter&&o.node.addEventListener("mouseenter",e.label.mouseEnter.bind(this,e)),e.label.mouseLeave&&o.node.addEventListener("mouseleave",e.label.mouseLeave.bind(this,e)),e.label.click&&o.node.addEventListener("click",e.label.click.bind(this,e))}}};t.config.annotations.xaxis.forEach((t,a)=>e(t,a,"xaxis")),t.config.annotations.yaxis.forEach((t,a)=>e(t,a,"yaxis")),t.config.annotations.points.forEach((t,a)=>e(t,a,"point"))}usesCategoryX(){const t=this.w;return("category"===t.config.xaxis.type||t.config.xaxis.convertedCatToNumeric)&&!this.annoCtx.invertAxis&&!t.axisFlags.dataFormatXNumeric&&!t.config.chart.sparkline.enabled}hasXDomain(){const t=this.w;return this.annoCtx.invertAxis?o.isNumber(t.globals.minY)&&o.isNumber(t.globals.yRange[0]):this.usesCategoryX()?t.labelData.labels.length>0||t.labelData.categoryLabels.length>0:o.isNumber(t.globals.minX)&&o.isNumber(t.globals.xRange)}getY1Y2(t,e){var a,o,s;const i=this.w,r="y1"===t?e.y:e.y2,l="string"==typeof r&&r.includes("px");let d,h=!1;if(this.annoCtx.invertAxis){const t=i.config.xaxis.convertedCatToNumeric?i.labelData.categoryLabels:i.labelData.labels,o=t.indexOf(r);if(!l&&-1===o)return{yP:0,clipped:!0};const n=i.dom.baseEl.querySelector(`.apexcharts-yaxis-texts-g text:nth-child(${o+1})`);d=n?parseFloat(null!=(a=n.getAttribute("y"))?a:"0"):(i.layout.gridHeight/t.length-1)*(o+1)-i.globals.barHeight,void 0!==e.seriesIndex&&i.globals.barHeight&&(d+=this.barSlotOffset(e.seriesIndex,i.globals.barHeight))}else{if(!i.config.yaxis[e.yAxisIndex])return{yP:0,clipped:!0};const t=i.globals.seriesYAxisMap[e.yAxisIndex],a=null!=(o=null==t?void 0:t[0])?o:null;if(null===a&&i.seriesData.series.length)return{yP:0,clipped:!0};const l=null===a?i.globals.minY:i.globals.minYArr[a],c=null===a?i.globals.maxY-i.globals.minY:i.globals.yRange[a],p=i.config.yaxis[e.yAxisIndex].logarithmic&&null!==a?new n(this.w).getLogVal(i.config.yaxis[e.yAxisIndex].logBase,r,a)/i.globals.yLogRatio[a]:(r-l)/(c/i.layout.gridHeight);d=i.layout.gridHeight-Math.min(Math.max(p,0),i.layout.gridHeight),h=p>i.layout.gridHeight||p<0,!e.marker||void 0!==e.y&&null!==e.y||(d=0),(null==(s=i.config.yaxis[e.yAxisIndex])?void 0:s.reversed)&&(d=p)}return l&&(d=parseFloat(r)),{yP:d,clipped:h}}getX1X2(t,e){const a=this.w,o="x1"===t?e.x:e.x2,n=this.annoCtx.invertAxis?a.globals.minY:a.globals.minX,s=this.annoCtx.invertAxis?a.globals.maxY:a.globals.maxX,i=this.annoCtx.invertAxis?a.globals.yRange[0]:a.globals.xRange;let r=!1;const l="string"==typeof o&&o.includes("px"),d=null==o&&e.marker;if(!l&&!d&&!this.hasXDomain())return{x:0,clipped:!0};let h=this.annoCtx.inversedReversedAxis?(s-o)/(i/a.layout.gridWidth):(o-n)/(i/a.layout.gridWidth);return this.usesCategoryX()&&(h=this.getStringX(o)),"string"==typeof o&&o.includes("px")&&(h=parseFloat(o)),null==o&&e.marker&&(h=a.layout.gridWidth),void 0!==e.seriesIndex&&a.globals.barWidth&&!this.annoCtx.invertAxis&&(h+=this.barSlotOffset(e.seriesIndex,a.globals.barWidth)),"number"!=typeof h&&(h=0,r=!0),parseFloat(h.toFixed(10))>parseFloat(a.layout.gridWidth.toFixed(10))?(h=a.layout.gridWidth,r=!0):h<0&&(h=0,r=!0),{x:h,clipped:r}}barSlotOffset(t,e){const a=this.w;if(a.config.chart.stacked)return 0;let o=0,n=0;return a.seriesData.series.forEach((e,s)=>{var i;const r=null==(i=a.config.series[s])?void 0:i.type;!e.length||a.globals.comboCharts&&"bar"!==r&&"column"!==r||(s<t&&n++,o++)}),e*(n-(o-1)/2)}getStringX(t){var e;const a=this.w;let o=t;if(a.config.xaxis.convertedCatToNumeric&&a.labelData.categoryLabels.length){const e=String(t);t=a.labelData.categoryLabels.findIndex(t=>String(t)===e)+1}const n=a.labelData.labels.map(t=>Array.isArray(t)?t.join(" "):t).indexOf(t),s=a.dom.baseEl.querySelector(`.apexcharts-xaxis-texts-g text:nth-child(${n+1})`);return s?o=parseFloat(null!=(e=s.getAttribute("x"))?e:"0"):n>-1&&(o=a.axisFlags.isXNumeric?(t-a.globals.minX)/(a.globals.xRange/a.layout.gridWidth):a.globals.padHorizontal+(n+.5)*a.layout.gridWidth/a.globals.dataPoints),o}}class l{constructor(t){this.w=t.w,this.annoCtx=t,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new r(this.annoCtx)}addXaxisAnnotation(t,e,a){const n=this.w,s=this.helpers.getX1X2("x1",t);let r=s.x;const l=s.clipped;let d,h=!0;const c=t.label.text,p=t.strokeDashArray;if(o.isNumber(r)){if(null===t.x2||void 0===t.x2){if(!l){const a=this.annoCtx.graphics.drawLine(r+t.offsetX,0+t.offsetY,r+t.offsetX,n.layout.gridHeight+t.offsetY,t.borderColor,p,t.borderWidth);e.appendChild(a.node),t.id&&a.node.classList.add(t.id),i(a,r+t.offsetX,n)}}else{const a=this.helpers.getX1X2("x2",t);if(d=a.x,h=a.clipped,d<r){const t=r;r=d,d=t}const o=this.annoCtx.graphics.drawRect(r+t.offsetX,0+t.offsetY,d-r,n.layout.gridHeight+t.offsetY,0,t.fillColor,t.opacity,1,t.borderColor,p);o.node.classList.add("apexcharts-annotation-rect"),o.attr("clip-path",`url(#gridRectMask${n.globals.cuid})`),e.appendChild(o.node),t.id&&o.node.classList.add(t.id),i(o,r+t.offsetX,n)}if(!l||!h){const o=this.annoCtx.graphics.getTextRects(c,t.label.style.fontSize),s="top"===t.label.position?4:"center"===t.label.position?n.layout.gridHeight/2+("vertical"===t.label.orientation?o.width/2:0):n.layout.gridHeight,l=this.annoCtx.graphics.drawText({x:r+t.label.offsetX,y:s+t.label.offsetY-("vertical"===t.label.orientation?"top"===t.label.position?o.width/2-12:-o.width/2:0),text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-xaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});l.attr({rel:a}),e.appendChild(l.node),i(l,r+t.label.offsetX,n),this.annoCtx.helpers.setOrientations(t,a)}}}drawXAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return t.config.annotations.xaxis.map((t,a)=>{this.addXaxisAnnotation(t,e.node,a)}),e}}const d=globalThis.ApexCharts.__internals.__apex_axes_AxesUtils;class h{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new r(this.annoCtx),this.axesUtils=new d(this.annoCtx.w,{theme:this.annoCtx.theme,timeScale:this.annoCtx.timeScale})}addYaxisAnnotation(t,e,a){const o=this.w,n=t.strokeDashArray;let s=this.helpers.getY1Y2("y1",t),i=s.yP;const r=s.clipped;let l,d=!0,h=!1;const c=t.label.text;if(null===t.y2||void 0===t.y2){if(!r){h=!0;const a=this.annoCtx.graphics.drawLine(0+t.offsetX,i+t.offsetY,this._getYAxisAnnotationWidth(t),i+t.offsetY,t.borderColor,n,t.borderWidth);e.appendChild(a.node),t.id&&a.node.classList.add(t.id)}}else{if(s=this.helpers.getY1Y2("y2",t),l=s.yP,d=s.clipped,l>i){const t=i;i=l,l=t}if(!r||!d){h=!0;const a=this.annoCtx.graphics.drawRect(0+t.offsetX,l+t.offsetY,this._getYAxisAnnotationWidth(t),i-l,0,t.fillColor,t.opacity,1,t.borderColor,n);a.node.classList.add("apexcharts-annotation-rect"),a.attr("clip-path",`url(#gridRectMask${o.globals.cuid})`),e.appendChild(a.node),t.id&&a.node.classList.add(t.id)}}if(h){const n="right"===t.label.position?o.layout.gridWidth:"center"===t.label.position?o.layout.gridWidth/2:0,s=this.annoCtx.graphics.drawText({x:n+t.label.offsetX,y:(null!=l?l:i)+t.label.offsetY-3,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-yaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});s.attr({rel:a}),e.appendChild(s.node)}}_getYAxisAnnotationWidth(t){const e=this.w;let a=e.layout.gridWidth;return a=t.width.indexOf("%")>-1?e.layout.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10),a+t.offsetX}drawYAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return t.config.annotations.yaxis.forEach((t,a)=>{t.yAxisIndex=this.axesUtils.translateYAxisIndex(t.yAxisIndex),this.axesUtils.isYAxisHidden(t.yAxisIndex)&&this.axesUtils.yAxisAllSeriesCollapsed(t.yAxisIndex)||this.addYaxisAnnotation(t,e.node,a)}),e}}const c=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs;class p{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new r(this.annoCtx)}addPointAnnotation(t,e,a){const n=this.w;if(n.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)return;const s=this.helpers.getX1X2("x1",t),r=s.x,l=s.clipped,d=this.helpers.getY1Y2("y1",t),h=d.yP,c=d.clipped;if(o.isNumber(r)&&!c&&!l){const o={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:`apexcharts-point-annotation-marker ${t.marker.cssClass} ${t.id?t.id:""}`};let s=this.annoCtx.graphics.drawMarker(r+t.marker.offsetX,h+t.marker.offsetY,o);e.appendChild(s.node);const l=[s.node];i(s,r,n);const d=t.label.text?t.label.text:"",c=this.getConstrainedLabelX(d,r+t.label.offsetX,t.label),p=this.annoCtx.graphics.drawText({x:c,y:h+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-point-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});if(p.attr({rel:a}),e.appendChild(p.node),i(p,r,n),t.customSVG.SVG){const a=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});a.attr({transform:`translate(${r+t.customSVG.offsetX}, ${h+t.customSVG.offsetY})`}),a.node.innerHTML=t.customSVG.SVG,e.appendChild(a.node),l.push(a.node)}if(t.image.path){const e=t.image.width?t.image.width:20,a=t.image.height?t.image.height:20;s=this.annoCtx.addImage({x:r+t.image.offsetX-e/2,y:h+t.image.offsetY-a/2,width:e,height:a,path:t.image.path,appendTo:".apexcharts-point-annotations"}),l.push(s.node)}t.tooltip&&t.tooltip.enabled&&l.forEach(e=>{e.addEventListener("mouseenter",()=>{this.showPointTooltip(t,e)}),e.addEventListener("mouseleave",()=>{this.hidePointTooltip()})}),t.mouseEnter&&s.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&s.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&s.node.addEventListener("click",t.click.bind(this,t))}}getConstrainedLabelX(t,e,a){const o=this.w;if(!t)return e;const{width:n}=this.annoCtx.graphics.getTextRects(t,a.style.fontSize,a.style.fontFamily,void 0,!0,a.style.fontWeight);let s,i;switch(a.textAnchor){case"start":s=e,i=e+n;break;case"end":s=e-n,i=e;break;default:s=e-n/2,i=e+n/2}const r=a.style.padding||{};return s-=r.left||0,i+=r.right||0,s<0?e-s:i>o.layout.gridWidth?e-(i-o.layout.gridWidth):e}getPointTooltipEl(){const t=this.w;let e=t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");return e||(e=c.createElementNS("http://www.w3.org/1999/xhtml","div"),e.classList.add("apexcharts-tooltip","apexcharts-annotation-tooltip"),t.dom.elWrap.appendChild(e)),e}getPointTooltipContent(t){const e=this.w,a=t.tooltip||{};if("function"==typeof a.formatter)return a.formatter({annotation:t,seriesIndex:t.seriesIndex,id:t.id,w:e});let o=null!=a.text?a.text:t.label&&t.label.text;return Array.isArray(o)&&(o=o.join("<br/>")),null==o?"":String(o)}showPointTooltip(t,e){const a=this.w,o=this.getPointTooltipContent(t);if(!o)return;const n=this.getPointTooltipEl();n.innerHTML=o;const s=t.tooltip.theme||a.config.tooltip.theme||"light";n.classList.remove("apexcharts-theme-light","apexcharts-theme-dark"),n.classList.add(`apexcharts-theme-${s}`),n.classList.add("apexcharts-active");const i=a.dom.elWrap.getBoundingClientRect(),r=e.getBoundingClientRect(),l=n.getBoundingClientRect(),d=t.tooltip.offsetX||0,h=t.tooltip.offsetY||0;let c=r.left-i.left+r.width/2-l.width/2,p=r.top-i.top-l.height-10;c=Math.max(0,Math.min(c,i.width-l.width)),p<0&&(p=r.top-i.top+r.height+10),n.style.left=c+d+"px",n.style.top=p+h+"px"}hidePointTooltip(){const t=this.w.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");t&&t.classList.remove("apexcharts-active")}drawPointAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return t.config.annotations.points.map((t,a)=>{this.addPointAnnotation(t,e.node,a)}),e}}const x=globalThis.ApexCharts.__internals.__apex_Options;e.registerFeatures({annotations:class{constructor(t,{theme:e=null,timeScale:o=null}={}){this.w=t,this.theme=e,this.timeScale=o,this.invertAxis=void 0,this.inversedReversedAxis=void 0,this.graphics=new a(this.w),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new r(this),this.xAxisAnnotations=new l(this),this.yAxisAnnotations=new h(this),this.pointsAnnotations=new p(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0)}drawAxesAnnotations(){const t=this.w;if(t.globals.axisCharts){const e=this.yAxisAnnotations.drawYAxisAnnotations(),a=this.xAxisAnnotations.drawXAxisAnnotations(),o=this.pointsAnnotations.drawPointAnnotations(),n=t.config.chart.animations.enabled,s=[e,a,o],i=[a.node,e.node,o.node],r="line"===t.config.chart.type||"area"===t.config.chart.type||"rangeArea"===t.config.chart.type,l=[r,!1,r];for(let e=0;e<3;e++)t.dom.elGraphical.add(s[e]),!n||t.globals.resized||t.globals.dataChanged||t.globals.animationEnded||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&!l[e]&&i[e].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:i[e],index:0});this.helpers.annotationsBackground()}}drawImageAnnos(){this.w.config.annotations.images.map(t=>{this.addImage(t)})}drawTextAnnos(){this.w.config.annotations.texts.map(t=>{this.addText(t)})}addXaxisAnnotation(t,e,a){this.xAxisAnnotations.addXaxisAnnotation(t,e,a)}addYaxisAnnotation(t,e,a){this.yAxisAnnotations.addYaxisAnnotation(t,e,a)}addPointAnnotation(t,e,a){this.pointsAnnotations.addPointAnnotation(t,e,a)}addText(t){const{x:e,y:a,text:o,textAnchor:n,foreColor:s,fontSize:i,fontFamily:r,fontWeight:l,cssClass:d,backgroundColor:h,borderWidth:c,strokeDashArray:p,borderRadius:x,borderColor:g,appendTo:f=".apexcharts-svg",paddingLeft:u=4,paddingRight:b=4,paddingBottom:m=2,paddingTop:y=2}=t,A=this.w,C=A.dom.baseEl.querySelector(f);if(!C)return;const w=this.graphics.drawText({x:e,y:a,text:o,textAnchor:n||"start",fontSize:i||"12px",fontWeight:l||"regular",fontFamily:r||A.config.chart.fontFamily,foreColor:s||A.config.chart.foreColor,cssClass:d||""});C.appendChild(w.node);const v=w.bbox();if(o){const t=this.graphics.drawRect(v.x-u,v.y-y,v.width+u+b,v.height+m+y,x,h||"transparent",1,c,g,p);C.insertBefore(t.node,w.node)}}addImage(t){const e=this.w,{path:a,x:o=0,y:n=0,width:s=20,height:i=20,appendTo:r=".apexcharts-svg"}=t,l=e.dom.Paper.image(a);l.size(s,i).move(o,n);const d=e.dom.baseEl.querySelector(r);return d&&d.appendChild(l.node),l}addXaxisAnnotationExternal(t,e,a){return this.addAnnotationExternal({params:t,pushToMemory:e,context:a,type:"xaxis",contextMethod:a.addXaxisAnnotation}),a}addYaxisAnnotationExternal(t,e,a){return this.addAnnotationExternal({params:t,pushToMemory:e,context:a,type:"yaxis",contextMethod:a.addYaxisAnnotation}),a}addPointAnnotationExternal(t,e,a){return void 0===this.invertAxis&&(this.invertAxis=a.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:a,type:"point",contextMethod:a.addPointAnnotation}),a}addAnnotationExternal({params:t,pushToMemory:e,context:a,type:n,contextMethod:s}){var i;const r=a,l=r.w,d=l.dom.baseEl.querySelector(`.apexcharts-${n}-annotations`),h=((null==(i=l.config.annotations["point"===n?"points":n])?void 0:i.length)||0)+d.childNodes.length,c=new x,p=Object.assign({},"xaxis"===n?c.xAxisAnnotation:"yaxis"===n?c.yAxisAnnotation:c.pointAnnotation),g=o.extend(p,t);switch(n){case"xaxis":this.addXaxisAnnotation(g,d,h);break;case"yaxis":this.addYaxisAnnotation(g,d,h);break;case"point":this.addPointAnnotation(g,d,h)}const f=l.dom.baseEl.querySelector(`.apexcharts-${n}-annotations .apexcharts-${n}-annotation-label[rel='${h}']`),u=this.helpers.addBackgroundToAnno(f,g);return u&&d.insertBefore(u.node,f),e&&l.globals.memory.methodsToExec.push({context:r,id:g.id?g.id:o.randomId(),method:s,label:"addAnnotation",params:t}),a}_removeAnnotationTooltip(t){const e=t.dom.elWrap&&t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");e&&e.parentNode&&e.parentNode.removeChild(e)}clearAnnotations(t){const e=t.w;this._removeAnnotationTooltip(e);const a=e.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations");for(let t=e.globals.memory.methodsToExec.length-1;t>=0;t--)"addText"!==e.globals.memory.methodsToExec[t].label&&"addAnnotation"!==e.globals.memory.methodsToExec[t].label||e.globals.memory.methodsToExec.splice(t,1);Array.prototype.forEach.call(a,t=>{for(;t.firstChild;)t.removeChild(t.firstChild)})}removeAnnotation(t,e){const a=t.w;this._removeAnnotationTooltip(a);const o=a.dom.baseEl.querySelectorAll(`.${e}`);o&&(a.globals.memory.methodsToExec=a.globals.memory.methodsToExec.filter(t=>t.id!==e),Object.keys(a.config.annotations).forEach(t=>{const o=a.config.annotations[t];Array.isArray(o)&&(a.config.annotations[t]=o.filter(t=>t.id!==e))}),Array.prototype.forEach.call(o,t=>{t.parentElement.removeChild(t)}))}}}),t.default=e,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexAnnotations={})});
|
|
@@ -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 n in e)if("default"!==n){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const t=e(require("apexcharts/core")),n=t.__apex_Environment_Environment,i=t.__apex_Utils,s=t.__apex_tooltip_Utils;t.default.registerFeatures({contextMenu:class{constructor(e,t){this.w=e,this.ctx=t,this.menu=null,this._items=[],this._focusIndex=-1,this._trigger=null,this._onContext=this._onContext.bind(this),this._onDocDown=this._onDocDown.bind(this),this._onKey=this._onKey.bind(this),this._afterRender=this._afterRender.bind(this),t.addEventListener("mounted",this._afterRender),t.addEventListener("updated",this._afterRender)}_cfg(){return this.w.config.chart.contextMenu||{}}_enabled(){return!0===this._cfg().enabled}_doc(){return this.w.dom.baseEl&&this.w.dom.baseEl.ownerDocument}_afterRender(){if(this._detachTrigger(),this.close(),!this._enabled()||!n.isBrowser())return;const e=this.w.dom.Paper&&this.w.dom.Paper.node;e&&(e.addEventListener("contextmenu",this._onContext),this._trigger=e)}_detachTrigger(){this._trigger&&(this._trigger.removeEventListener("contextmenu",this._onContext),this._trigger=null)}_onContext(e){this._enabled()&&(e.preventDefault(),this.open(e.clientX,e.clientY))}_clientToData(e,t){const n=this.w;if(!n.globals.axisCharts||!n.dom.baseEl||!n.dom.baseEl.querySelector(".apexcharts-svg"))return null;const i=s.plotRect(n);if(!i.width||!i.height)return null;const o=e=>e<0?0:e>1?1:e,r=o((e-i.left)/i.width),a=o((t-i.top)/i.height),l=n.globals.minX+r*(n.globals.maxX-n.globals.minX),c=n.globals.yAxisScale&&n.globals.yAxisScale[0],h=c&&isFinite(c.niceMin)?c.niceMin:n.globals.minY,u=c&&isFinite(c.niceMax)?c.niceMax:n.globals.maxY;return{x:l,y:u-a*(u-h)}}_resolveItems(e){const t=this._cfg(),n=Array.isArray(t.items)&&t.items.length?t.items:["annotate","xline","yline","measure"],i=t.labels||{},s=[];return n.forEach(t=>{if("string"==typeof t){if("annotate"===t)s.push({id:"annotate",label:i.annotate||"Add note here",run:()=>this._annotate(e)});else if("xline"===t)s.push({id:"xline",label:i.xline||"Annotate here",run:()=>this._line(e,"x")});else if("yline"===t)s.push({id:"yline",label:i.yline||"Mark this level",run:()=>this._line(e,"y")});else if("measure"===t){const t=this.ctx.measure;t&&this.w.config.chart.measure&&this.w.config.chart.measure.enabled&&s.push({id:"measure",label:i.measure||"Measure from here",run:()=>t.seedFromClient(e.clientX,e.clientY)})}}else t&&"object"==typeof t&&"function"==typeof t.onClick&&s.push({id:t.id||"custom",label:t.label||"Action",run:()=>t.onClick(this.ctx,e)})}),s}_annotate(e){if(null==e.x||null==e.y)return;const t=this._cfg(),n=this.ctx.ink;n&&"function"==typeof n.createAt?n.createAt(e.x,e.y,{text:t.noteText||"Note"}):this.ctx.addPointAnnotation({x:e.x,y:e.y,marker:{size:5},label:{text:t.noteText||"Note",style:{background:"#fff",color:"#334155"}}},!0)}_line(e,t){const n=this._cfg().line||{},s="x"===t?e.x:e.y;if(null==s)return;const o=this.ctx.ink;if(o&&"function"==typeof o.createLineAt)return void o.createLineAt(t,s,{text:n.text,strokeDashArray:n.strokeDashArray,color:n.color});const r={strokeDashArray:null!=n.strokeDashArray?n.strokeDashArray:4};n.text&&(r.label={text:n.text}),n.color&&(r.borderColor=n.color,r.label=i.extend(r.label||{},{borderColor:n.color})),"x"===t?this.ctx.addXaxisAnnotation(i.extend(r,{x:s}),!0):this.ctx.addYaxisAnnotation(i.extend(r,{y:s}),!0)}open(e,t){this.close();const n=this.w,i=n.dom.elWrap,o=this._doc();if(!i||!o)return;const r=this._clientToData(e,t),a=n.globals,l={x:r?r.x:null,y:r?r.y:null,seriesIndex:a.capturedSeriesIndex>=0?a.capturedSeriesIndex:null,dataPointIndex:a.capturedDataPointIndex>=0?a.capturedDataPointIndex:null,clientX:e,clientY:t},c=this._resolveItems(l);if(!c.length)return;this._items=c;const h=o.createElement("div");h.className="apexcharts-context-menu",h.setAttribute("role","menu"),h.style.position="absolute",h.style.visibility="hidden",c.forEach((e,t)=>{const n=o.createElement("button");n.type="button",n.className="apexcharts-context-menu-item",n.setAttribute("role","menuitem"),n.tabIndex=-1,n.textContent=e.label,n.addEventListener("click",e=>{e.stopPropagation(),this._activate(t)}),n.addEventListener("mouseenter",()=>this._focus(t)),h.appendChild(n)}),i.appendChild(h),this.menu=h;const u=i.getBoundingClientRect(),d=s.plotRect(n).zoom;let x=(e-u.left)/d,_=(t-u.top)/d;const m=h.offsetWidth,f=h.offsetHeight,p=Math.max(0,i.clientWidth-m),g=Math.max(0,i.clientHeight-f);x>p&&(x=p),_>g&&(_=g),h.style.left=Math.max(0,x)+"px",h.style.top=Math.max(0,_)+"px",h.style.visibility="visible",o.addEventListener("mousedown",this._onDocDown,!0),o.addEventListener("keydown",this._onKey,!0),this._focus(0)}_focus(e){if(!this.menu)return;const t=this.menu.querySelectorAll(".apexcharts-context-menu-item");this._focusIndex>=0&&t[this._focusIndex]&&t[this._focusIndex].classList.remove("apexcharts-context-menu-item--active"),this._focusIndex=e,t[e]&&(t[e].classList.add("apexcharts-context-menu-item--active"),"function"==typeof t[e].focus&&t[e].focus())}_activate(e){const t=this._items[e];this.close(),t&&t.run()}_onDocDown(e){this.menu&&this.menu.contains(e.target)||this.close()}_onKey(e){this.menu&&this._items.length&&("Escape"===e.key?(e.preventDefault(),this.close()):"ArrowDown"===e.key?(e.preventDefault(),this._focus((this._focusIndex+1)%this._items.length)):"ArrowUp"===e.key?(e.preventDefault(),this._focus((this._focusIndex-1+this._items.length)%this._items.length)):"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._activate(this._focusIndex<0?0:this._focusIndex)))}close(){const e=this._doc();e&&(e.removeEventListener("mousedown",this._onDocDown,!0),e.removeEventListener("keydown",this._onKey,!0)),this.menu&&this.menu.parentNode&&this.menu.parentNode.removeChild(this.menu),this.menu=null,this._items=[],this._focusIndex=-1}teardown(){this.close(),this._detachTrigger()}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
|
@@ -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,n=t.ApexCharts;if(n&&n.__internals)return e.call(t);if(n)throw new Error("ApexCharts: dist/features/context-menu.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/context-menu.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/context-menu.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 n=t.ApexCharts;if(n)if(n.__internals){s.done=!0;var o=i.indexOf(s);-1!==o&&i.splice(o,1);try{e.call(t),n.__drainsAddons||t.console.warn("ApexCharts: dist/features/context-menu.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/context-menu.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/context-menu.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/context-menu.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,n=globalThis.ApexCharts.__internals.__apex_Environment_Environment,s=globalThis.ApexCharts.__internals.__apex_Utils,i=globalThis.ApexCharts.__internals.__apex_tooltip_Utils;t.registerFeatures({contextMenu:class{constructor(e,t){this.w=e,this.ctx=t,this.menu=null,this._items=[],this._focusIndex=-1,this._trigger=null,this._onContext=this._onContext.bind(this),this._onDocDown=this._onDocDown.bind(this),this._onKey=this._onKey.bind(this),this._afterRender=this._afterRender.bind(this),t.addEventListener("mounted",this._afterRender),t.addEventListener("updated",this._afterRender)}_cfg(){return this.w.config.chart.contextMenu||{}}_enabled(){return!0===this._cfg().enabled}_doc(){return this.w.dom.baseEl&&this.w.dom.baseEl.ownerDocument}_afterRender(){if(this._detachTrigger(),this.close(),!this._enabled()||!n.isBrowser())return;const e=this.w.dom.Paper&&this.w.dom.Paper.node;e&&(e.addEventListener("contextmenu",this._onContext),this._trigger=e)}_detachTrigger(){this._trigger&&(this._trigger.removeEventListener("contextmenu",this._onContext),this._trigger=null)}_onContext(e){this._enabled()&&(e.preventDefault(),this.open(e.clientX,e.clientY))}_clientToData(e,t){const n=this.w;if(!n.globals.axisCharts||!n.dom.baseEl||!n.dom.baseEl.querySelector(".apexcharts-svg"))return null;const s=i.plotRect(n);if(!s.width||!s.height)return null;const o=e=>e<0?0:e>1?1:e,a=o((e-s.left)/s.width),r=o((t-s.top)/s.height),l=n.globals.minX+a*(n.globals.maxX-n.globals.minX),h=n.globals.yAxisScale&&n.globals.yAxisScale[0],c=h&&isFinite(h.niceMin)?h.niceMin:n.globals.minY,d=h&&isFinite(h.niceMax)?h.niceMax:n.globals.maxY;return{x:l,y:d-r*(d-c)}}_resolveItems(e){const t=this._cfg(),n=Array.isArray(t.items)&&t.items.length?t.items:["annotate","xline","yline","measure"],s=t.labels||{},i=[];return n.forEach(t=>{if("string"==typeof t){if("annotate"===t)i.push({id:"annotate",label:s.annotate||"Add note here",run:()=>this._annotate(e)});else if("xline"===t)i.push({id:"xline",label:s.xline||"Annotate here",run:()=>this._line(e,"x")});else if("yline"===t)i.push({id:"yline",label:s.yline||"Mark this level",run:()=>this._line(e,"y")});else if("measure"===t){const t=this.ctx.measure;t&&this.w.config.chart.measure&&this.w.config.chart.measure.enabled&&i.push({id:"measure",label:s.measure||"Measure from here",run:()=>t.seedFromClient(e.clientX,e.clientY)})}}else t&&"object"==typeof t&&"function"==typeof t.onClick&&i.push({id:t.id||"custom",label:t.label||"Action",run:()=>t.onClick(this.ctx,e)})}),i}_annotate(e){if(null==e.x||null==e.y)return;const t=this._cfg(),n=this.ctx.ink;n&&"function"==typeof n.createAt?n.createAt(e.x,e.y,{text:t.noteText||"Note"}):this.ctx.addPointAnnotation({x:e.x,y:e.y,marker:{size:5},label:{text:t.noteText||"Note",style:{background:"#fff",color:"#334155"}}},!0)}_line(e,t){const n=this._cfg().line||{},i="x"===t?e.x:e.y;if(null==i)return;const o=this.ctx.ink;if(o&&"function"==typeof o.createLineAt)return void o.createLineAt(t,i,{text:n.text,strokeDashArray:n.strokeDashArray,color:n.color});const a={strokeDashArray:null!=n.strokeDashArray?n.strokeDashArray:4};n.text&&(a.label={text:n.text}),n.color&&(a.borderColor=n.color,a.label=s.extend(a.label||{},{borderColor:n.color})),"x"===t?this.ctx.addXaxisAnnotation(s.extend(a,{x:i}),!0):this.ctx.addYaxisAnnotation(s.extend(a,{y:i}),!0)}open(e,t){this.close();const n=this.w,s=n.dom.elWrap,o=this._doc();if(!s||!o)return;const a=this._clientToData(e,t),r=n.globals,l={x:a?a.x:null,y:a?a.y:null,seriesIndex:r.capturedSeriesIndex>=0?r.capturedSeriesIndex:null,dataPointIndex:r.capturedDataPointIndex>=0?r.capturedDataPointIndex:null,clientX:e,clientY:t},h=this._resolveItems(l);if(!h.length)return;this._items=h;const c=o.createElement("div");c.className="apexcharts-context-menu",c.setAttribute("role","menu"),c.style.position="absolute",c.style.visibility="hidden",h.forEach((e,t)=>{const n=o.createElement("button");n.type="button",n.className="apexcharts-context-menu-item",n.setAttribute("role","menuitem"),n.tabIndex=-1,n.textContent=e.label,n.addEventListener("click",e=>{e.stopPropagation(),this._activate(t)}),n.addEventListener("mouseenter",()=>this._focus(t)),c.appendChild(n)}),s.appendChild(c),this.menu=c;const d=s.getBoundingClientRect(),u=i.plotRect(n).zoom;let x=(e-d.left)/u,f=(t-d.top)/u;const p=c.offsetWidth,_=c.offsetHeight,m=Math.max(0,s.clientWidth-p),g=Math.max(0,s.clientHeight-_);x>m&&(x=m),f>g&&(f=g),c.style.left=Math.max(0,x)+"px",c.style.top=Math.max(0,f)+"px",c.style.visibility="visible",o.addEventListener("mousedown",this._onDocDown,!0),o.addEventListener("keydown",this._onKey,!0),this._focus(0)}_focus(e){if(!this.menu)return;const t=this.menu.querySelectorAll(".apexcharts-context-menu-item");this._focusIndex>=0&&t[this._focusIndex]&&t[this._focusIndex].classList.remove("apexcharts-context-menu-item--active"),this._focusIndex=e,t[e]&&(t[e].classList.add("apexcharts-context-menu-item--active"),"function"==typeof t[e].focus&&t[e].focus())}_activate(e){const t=this._items[e];this.close(),t&&t.run()}_onDocDown(e){this.menu&&this.menu.contains(e.target)||this.close()}_onKey(e){this.menu&&this._items.length&&("Escape"===e.key?(e.preventDefault(),this.close()):"ArrowDown"===e.key?(e.preventDefault(),this._focus((this._focusIndex+1)%this._items.length)):"ArrowUp"===e.key?(e.preventDefault(),this._focus((this._focusIndex-1+this._items.length)%this._items.length)):"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._activate(this._focusIndex<0?0:this._focusIndex)))}close(){const e=this._doc();e&&(e.removeEventListener("mousedown",this._onDocDown,!0),e.removeEventListener("keydown",this._onKey,!0)),this.menu&&this.menu.parentNode&&this.menu.parentNode.removeChild(this.menu),this.menu=null,this._items=[],this._focusIndex=-1}teardown(){this.close(),this._detachTrigger()}}}),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).ApexContextMenu={})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.3.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(e,i,r)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,l=(t,e)=>{for(var i in e||(e={}))s.call(e,i)&&o(t,i,e[i]);if(r)for(var i of r(e))n.call(e,i)&&o(t,i,e[i]);return t},a=(t,r)=>e(t,i(r));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function c(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const d=c(require("apexcharts/core")),h=d.__apex_Utils,p=d.__apex_Environment_Environment,u=d.__apex_BrowserAPIs_BrowserAPIs;function f(t,e,i,r){var s;const n=null==(s=null==e?void 0:e.dimensions)?void 0:s.dimHelpers,o=n?n.getTitleSubtitleCoords("title").height+n.getTitleSubtitleCoords("subtitle").height:0,l=i.getBoundingClientRect().height||18,a=r&&r.offsetY||0,c=function(t,e){const i=t.layout.translateY||0,r=t.dom.elWrap;if(!r)return i;const s=t.dom.baseEl.querySelectorAll(".apexcharts-yaxis-label");if(!s.length)return i;const n=r.getBoundingClientRect().top,o=e.getBoundingClientRect();let l=i;for(let t=0;t<s.length;t++){const e=s[t].getBoundingClientRect();e.height&&(e.left>=o.right||e.right<=o.left||(l=Math.min(l,e.top-n)))}return l}(t,i);if(c-o>=l+1)return i.style.top=`${c-l-1+a}px`,!0;i.style.top=`${o+a}px`;const d="dark"===t.config.theme.mode;return i.style.background=d?"rgba(20,24,30,0.82)":"rgba(255,255,255,0.86)",i.style.borderRadius="4px",!1}const w="http://www.w3.org/1999/xhtml";class g{constructor(t,e,i){this.w=t,this.ctx=e,this.drilldown=i}render(t){if(!p.isBrowser())return;const e=this.w,i=e.dom.elWrap;if(!i)return;const r=i.querySelector(".apexcharts-breadcrumb");r&&r.parentNode&&r.parentNode.removeChild(r);const s=e.config.drilldown&&e.config.drilldown.breadcrumb;if(!s||!1===s.show)return;if(0===this.drilldown.depth)return;const n=u.createElementNS(w,"nav");n.setAttribute("class","apexcharts-breadcrumb"),n.setAttribute("aria-label","Drilldown breadcrumb"),this._position(n,s);const o=null!=s.separator?s.separator:" / ";t.forEach((e,i)=>{if(i>0){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-separator"),t.setAttribute("aria-hidden","true"),t.textContent=o,n.appendChild(t)}const r=this._label(e,i);if(i===t.length-1){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-item apexcharts-breadcrumb-current"),t.setAttribute("aria-current","page"),t.textContent=r,n.appendChild(t)}else{const t=u.createElementNS(w,"button");if(t.setAttribute("type","button"),t.setAttribute("class","apexcharts-breadcrumb-item"),0===i){const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-arrow"),e.setAttribute("aria-hidden","true"),e.textContent="\u2190",t.appendChild(e)}const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-label"),e.textContent=r,t.appendChild(e),t.addEventListener("click",()=>this.drilldown.drillToLevel(i)),n.appendChild(t)}}),i.appendChild(n),this.w.globals.axisCharts&&f(this.w,this.ctx,n,s),this._avoidChromeOverlap(n)}_avoidChromeOverlap(t){const e=this.w,i=[".apexcharts-title-text",".apexcharts-subtitle-text"].map(t=>e.dom.baseEl.querySelector(t)).filter(t=>null!==t);if(!i.length)return;const r=e.dom.elWrap.getBoundingClientRect().top;for(let e=0;e<i.length+1;e++){const e=t.getBoundingClientRect(),s=i.find(t=>{const i=t.getBoundingClientRect();return e.left<i.right&&e.right>i.left&&e.top<i.bottom&&e.bottom>i.top});if(!s)break;t.style.top=s.getBoundingClientRect().bottom-r+4+"px"}}_label(t,e){const i=this.w.config.drilldown.breadcrumb;let r;if(0===e)r=null!=i.rootLabel?i.rootLabel:"All";else{const e=(this.w.config.drilldown.series||[]).find(e=>e&&e.id===t);r=e&&e.name||String(t)}return"function"==typeof i.formatter?i.formatter(r,{index:e,depth:this.drilldown.depth}):r}_position(t,e){const i=e.offsetX||0,r=e.offsetY||0;t.style.position="absolute",t.style.top=r+"px","top-right"===e.position?t.style.right=3-i+"px":t.style.left=i+"px"}}const _="http://www.w3.org/1999/xhtml",b="apexcharts-drilldown-loading";class m{constructor(t){this.w=t,this.el=null}_cfg(){const t=this.w.config.drilldown,e=t&&t.loading;return!1===e?{show:!1}:e||{}}show(){if(!p.isBrowser())return;const t=this._cfg();if(!1===t.show)return;const e=this.w.dom.elWrap;if(!e)return;this.hide();const i=u.createElementNS(_,"div");i.setAttribute("class",b),i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-label",t.text||"Loading");const r=u.createElementNS(_,"div");if(r.setAttribute("class",`${b}-spinner`),r.setAttribute("aria-hidden","true"),i.appendChild(r),t.text){const e=u.createElementNS(_,"span");e.setAttribute("class",`${b}-text`),e.textContent=t.text,i.appendChild(e)}e.appendChild(i),this.el=i}hide(){const t=this.w.dom.elWrap;if(t){const e=t.querySelectorAll(`.${b}`);for(let t=0;t<e.length;t++){const i=e[t];i.parentNode&&i.parentNode.removeChild(i)}}else this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el);this.el=null}}const x="__apexDrilldownMarker";d.default.registerFeatures({drilldown:class{constructor(t,e){this.w=t,this.ctx=e,this.stack=[],this.rootSnapshot=null,this._wired=!1,this._asyncCache=new Map,this._pending=null,this._warnedUnreachable=!1,this._warnedNoSliceOffset=!1,this.breadcrumb=new g(t,e,this),this.loading=new m(t),this._onPointSelect=this._onPointSelect.bind(this),this._afterRender=this._afterRender.bind(this),this._onPlotDown=this._onPlotDown.bind(this),this._onPlotClick=this._onPlotClick.bind(this),this._downAt=null,this._plotClickWired=null,this.init()}init(){const t=this.w;t.config.drilldown&&t.config.drilldown.enabled&&(this._wired||(this._wired=!0,this.ctx.addEventListener("dataPointSelection",this._onPointSelect),this.ctx.addEventListener("mounted",this._afterRender),this.ctx.addEventListener("updated",this._afterRender),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series))))}get path(){return["root",...this.stack.map(t=>t.id)]}get depth(){return this.stack.length}drillDown(t,e,i){const r=this._resolveChild(t);return r?this._drillInto(r,e,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(t,e,i):(console.warn(`ApexCharts: drilldown id "${t}" not found in chart.drilldown.series, and no onDrillDown resolver is set.`),Promise.resolve(this.ctx))}drillUp(){return this.drillToLevel(this.stack.length-1)}drillToRoot(){return this.drillToLevel(0)}drillToLevel(t){const e=this.stack.length;if(t<0||t>=e)return Promise.resolve(this.ctx);const i=this.path[this.path.length-1],r=0===t?this.rootSnapshot:this.stack[t].restore;this.stack=this.stack.slice(0,t);const s=this.path[this.path.length-1];return this._apply(this._viewFromSnapshot(r),"up",{from:i,to:s})}_resolveChild(t){const e=this.w.config.drilldown&&this.w.config.drilldown.series;return Array.isArray(e)&&e.find(e=>e&&e.id===t)||null}_drillInto(t,e,i){if(this.stack.length>=32)return console.warn("ApexCharts: drilldown max depth (32) reached."),Promise.resolve(this.ctx);this.rootSnapshot||(this.rootSnapshot=this._snapshot());const r=this.path[this.path.length-1],s={id:t.id,name:t.name,restore:this._snapshot()};return this.stack.push(s),this._apply(this._viewFromChild(t),"down",{from:r,to:t.id,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex}).catch(e=>{throw this.stack[this.stack.length-1]===s&&this.stack.pop(),this._fire("drillDownError",{id:t.id,error:e}),e})}_drillDownAsync(t,e,i){const r=this.w.config.drilldown.onDrillDown,s=this._cacheGet(t);if(s)return this._drillInto(s,e,i);if(this._pending)return this._pending;let n;this.loading.show();try{n=r({id:t,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex})}catch(e){return this.loading.hide(),this._fire("drillDownError",{id:t,error:e}),Promise.resolve(this.ctx)}const o=()=>{this._pending=null,this.loading.hide()},c=Promise.resolve(n).then(r=>{if(o(),this._isDead())return this.ctx;if(!r||!r.data)return this._fire("drillDownError",{id:t,error:new Error(`drilldown: onDrillDown resolved without a drillable level for id "${t}" (expected an object with a \`data\` array).`)}),this.ctx;const s=null!=r.id?r:a(l({},r),{id:t});return this._cacheSet(t,s),this._drillInto(s,e,i)},e=>(o(),this._isDead()||this._fire("drillDownError",{id:t,error:e}),this.ctx));return this._pending=c,c}_isDead(){const t=this.w;return!t||!t.globals||!0===t.globals.isDestroyed}_cacheEnabled(){const t=this.w.config.drilldown;return!(!t||!1===t.cache)}_cacheGet(t){return this._cacheEnabled()&&null!=t&&this._asyncCache.get(t)||null}_cacheSet(t,e){this._cacheEnabled()&&null!=t&&this._asyncCache.set(t,e)}clearCache(t){return null==t?this._asyncCache.clear():this._asyncCache.delete(t),this.ctx}_snapshot(){const t=this.w.config,e=this._overrideFields(),i={series:this._uncollapseSeries(h.clone(t.series))};return Array.isArray(t.labels)&&t.labels.length&&(i.labels=h.clone(t.labels)),i.chart={type:t.chart.type,stacked:t.chart.stacked},e.has("xaxis")&&(i.xaxis=h.clone(t.xaxis)),e.has("yaxis")&&(i.yaxis=h.clone(t.yaxis)),e.has("colors")&&(i.colors=t.colors?h.clone(t.colors):void 0),e.has("plotOptions")&&(i.plotOptions=h.clone(t.plotOptions)),e.has("fill")&&(i.fill=h.clone(t.fill)),e.has("legend")&&(i.legend=h.clone(t.legend)),i}_uncollapseSeries(t){const e=this.w,i=e.globals,r=[...i.collapsedSeries||[],...i.ancillaryCollapsedSeries||[]];if(!r.length)return t;const s=e.config.chart.type,n=("pie"===s||"donut"===s||"polarArea"===s)&&1===t.length&&t[0]&&"object"==typeof t[0]&&Array.isArray(t[0].data)?t[0].data:t;for(const e of r){const r=e.index;i.axisCharts?t[r]&&(t[r].data=Array.isArray(e.data)?e.data.slice():e.data):n[r]&&"object"==typeof n[r]?n[r].y=e.data:void 0!==n[r]&&(n[r]=e.data)}return t}_overrideFields(){const t=new Set,e=this.w.config.drilldown&&this.w.config.drilldown.series||[];for(const i of e)i&&(i.xaxis&&t.add("xaxis"),i.yaxis&&t.add("yaxis"),i.colors&&t.add("colors"),i.plotOptions&&t.add("plotOptions"),i.fill&&t.add("fill"),i.legend&&t.add("legend"));return t}_copyOptionalViewFields(t,e){e.xaxis&&(t.xaxis=e.xaxis),e.yaxis&&(t.yaxis=e.yaxis),e.colors&&(t.colors=e.colors),e.plotOptions&&(t.plotOptions=e.plotOptions),e.fill&&(t.fill=e.fill),e.legend&&(t.legend=e.legend)}_viewFromChild(t){const e={};Array.isArray(t.series)?e.series=t.series:e.series=[{name:t.name||"",data:t.data}];const i={};return t.chart&&t.chart.type&&(i.type=t.chart.type),t.chart&&null!=t.chart.stacked&&(i.stacked=t.chart.stacked),Object.keys(i).length&&(e.chart=i),this._copyOptionalViewFields(e,t),e}_viewFromSnapshot(t){const e={series:t.series,chart:t.chart};return t.labels&&t.labels.length&&(e.labels=t.labels),this._copyOptionalViewFields(e,t),e}_apply(t,e,i){var r;const s=this.w;s.interact.selectedDataPoints=[],s.globals.collapsedSeries=[],s.globals.collapsedSeriesIndices=[],s.globals.ancillaryCollapsedSeries=[],s.globals.ancillaryCollapsedSeriesIndices=[],s.globals.allSeriesCollapsed=!1,s.globals.risingSeries=[],t.markers=a(l({},t.markers||{}),{discrete:this._drillMarkers(t.series)});const n=(!s.config.drilldown.animation||!1!==s.config.drilldown.animation.enabled)&&!1!==s.config.chart.animations.enabled;"down"===e&&this._fire("drillDownStart",i),null==(r=this.ctx.highlightFilter)||r.drillView(t);const o=e=>this.ctx.updateOptions(t,!1,e,!1,!1),c=()=>(this._fire("down"===e?"drillDownEnd":"drillUp",i),this.ctx);if(n&&this._zoomEnabled()){const t=this._triggerOrigin(i);if(t)return this._zoomDrill(t,e,()=>o(!1)).then(c)}return o(n).then(c)}_zoomEnabled(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation;return!(!t||!t.zoomFromPoint)}_svgNode(){const t=this.w.dom&&this.w.dom.Paper;return t&&t.node?t.node:null}_markGroup(){const t=this._svgNode();return t&&"function"==typeof t.querySelector?t.querySelector(".apexcharts-plot-series, .apexcharts-heatmap, .apexcharts-treemap"):null}_triggerOrigin(t){if(!p.isBrowser())return null;const e=this._svgNode(),i=this._markGroup();if(!e||!i||"function"!=typeof i.animate||"function"!=typeof e.getBoundingClientRect)return null;const r=e.getBoundingClientRect();let s=null;if(t&&null!=t.seriesIndex&&null!=t.dataPointIndex&&this.w.dom.baseEl&&(s=this.w.dom.baseEl.querySelector(`[index="${t.seriesIndex}"][j="${t.dataPointIndex}"]`)),s&&"function"==typeof s.getBoundingClientRect){const t=s.getBoundingClientRect();return{x:t.left+t.width/2-r.left,y:t.top+t.height/2-r.top}}const n=i.getBoundingClientRect();return{x:n.left+n.width/2-r.left,y:n.top+n.height/2-r.top}}_zoomDrill(t,e,i){return r=this,s=null,n=function*(){const r=this._zoomDuration(),s="down"===e,n=Math.round(.55*r),o=s?"scale(1.03)":"scale(0.97)",l=s?"scaleX(0.55) scaleY(0.85)":"scale(1.04)",a=e=>{e.style.transformBox="view-box",e.style.transformOrigin=`${t.x}px ${t.y}px`},c=this._markGroup();let d=null;if(c){a(c),d=c.animate([{transform:"scale(1)",opacity:1},{transform:o,opacity:0}],{duration:n,easing:"ease-in",fill:"forwards"});try{yield d.finished}catch(t){}}yield i();const h=this._markGroup();if(h){a(h),h.style.opacity="0",h.style.transform=l,d&&c===h&&d.cancel();const t=h.animate([{transform:l,opacity:0},{transform:"scale(1)",opacity:1}],{duration:r,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"});try{yield t.finished}catch(t){}(p=h).style.transform="",p.style.opacity="",p.style.transformOrigin="",p.style.transformBox="",t.cancel()}var p},new Promise((t,e)=>{var i=t=>{try{l(n.next(t))}catch(t){e(t)}},o=t=>{try{l(n.throw(t))}catch(t){e(t)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,o);l((n=n.apply(r,s)).next())});var r,s,n}_zoomDuration(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation,e=t&&"number"==typeof t.speed?t.speed:260;return Math.max(80,e)}_fire(t,e){const i=this.w.config.chart.events&&this.w.config.chart.events[t];"function"==typeof i&&i(e,this.ctx,this.w),this.ctx.events.fireEvent(t,[e,this.ctx,this.w])}_onPointSelect(t,e,i){if(!i||this._retired())return;const r=this._pointAt(i.seriesIndex,i.dataPointIndex);return r&&"object"==typeof r&&null!=r.drilldown?this.drillDown(r.drilldown,r,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(null,r,i):void 0}_pointAt(t,e){const i=this.w.config.series;if(!Array.isArray(i)||null==t||null==e)return null;const r=i[t];return r&&Array.isArray(r.data)&&null!=r.data[e]?r.data[e]:null}_retired(){return this.ctx.drilldown!==this&&(Promise.resolve().then(()=>{const t=this.ctx.events;t&&(t.removeEventListener("dataPointSelection",this._onPointSelect),t.removeEventListener("mounted",this._afterRender),t.removeEventListener("updated",this._afterRender))}),!0)}_afterRender(){const t=this.w;this._retired()||t.config.drilldown&&t.config.drilldown.enabled&&(this._markDrillableTargets(),this._wirePlotClick(),this.breadcrumb.render(this.path),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series)))}_markDrillableTargets(){if(!p.isBrowser())return;const t=this.w,e=t.dom.baseEl,i=t.config.series;if(!e||!Array.isArray(i))return;let r=0;i.forEach((t,i)=>{const s=t&&Array.isArray(t.data)?t.data:null;s&&s.forEach((t,s)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const n=e.querySelectorAll(`[index="${i}"][j="${s}"]`);n.length||r++,n.forEach(t=>{this._isClickThroughMark(t)&&t.classList.remove("no-pointer-events"),t.classList.add("apexcharts-drilldown-target")})})}),r&&!this._warnedUnreachable&&(this._warnedUnreachable=!0,console.warn(`ApexCharts: ${r} drillable point(s) have no clickable mark, so clicking them cannot do anything. Leave \`drilldown.marker\` on, or give the series markers of its own (\`markers.size > 0\`).`))}warnSliceOffsetDisabled(){this._warnedNoSliceOffset||(this._warnedNoSliceOffset=!0,console.warn("ApexCharts: `plotOptions.pie.expandOnClick` is not available in a drilldown pie/donut, so it was ignored. A slice click navigates, and a slice that slid out would be discarded by the drill it just triggered."))}_wirePlotClick(){if(!p.isBrowser())return;const t=this.w.dom.baseEl;t&&this._plotClickWired!==t&&(this._plotClickWired&&(this._plotClickWired.removeEventListener("mousedown",this._onPlotDown),this._plotClickWired.removeEventListener("click",this._onPlotClick)),t.addEventListener("mousedown",this._onPlotDown),t.addEventListener("click",this._onPlotClick),this._plotClickWired=t)}_onPlotDown(t){this._downAt={x:t.clientX,y:t.clientY}}_onPlotClick(t){const e=this.w;if(!e.config.drilldown||!e.config.drilldown.enabled)return;const i=this._downAt;if(this._downAt=null,i&&Math.hypot(t.clientX-i.x,t.clientY-i.y)>4)return;const r=t.target;if(!r||"function"!=typeof r.closest)return;if(r.closest(".apexcharts-drilldown-target"))return;if(r.closest(".apexcharts-legend, .apexcharts-toolbar, .apexcharts-breadcrumb, .apexcharts-menu, .apexcharts-tooltip"))return;const s=e.interact.capturedSeriesIndex,n=e.interact.capturedDataPointIndex;if(null==s||null==n||s<0||n<0)return;if(!this._isPointBasedSeries(e.config.series[s]))return;const o=this._pointAt(s,n);return o&&"object"==typeof o&&null!=o.drilldown?this.drillDown(o.drilldown,o,{seriesIndex:s,dataPointIndex:n}):void 0}_isClickThroughMark(t){return!(!t.classList||!t.classList.contains("no-pointer-events"))&&(!!t.classList.contains("apexcharts-marker")&&!("function"==typeof t.closest&&t.closest(".apexcharts-tooltip")))}_drillMarkers(t){const e=this.w,i=e.config.drilldown,r=Array.isArray(e.config.markers&&e.config.markers.discrete)?e.config.markers.discrete.filter(t=>!t||!t[x]):[],s=i&&i.marker||{};if(!1===s.show||!Array.isArray(t))return r;const n=[];return t.forEach((t,e)=>{if(!this._seriesNeedsDrillMarker(e,t))return;const i=t&&Array.isArray(t.data)?t.data:null;i&&i.forEach((t,i)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const r={seriesIndex:e,dataPointIndex:i,[x]:!0};void 0!==s.size&&(r.size=s.size),void 0!==s.shape&&(r.shape=s.shape),void 0!==s.fillColor&&(r.fillColor=s.fillColor),void 0!==s.strokeColor&&(r.strokeColor=s.strokeColor),n.push(r)})}),r.concat(n)}_seriesNeedsDrillMarker(t,e){if(!this._isPointBasedSeries(e))return!1;const i=this.w.config.markers&&this.w.config.markers.size,r=Array.isArray(i)?i[t]:i;return!(Number(r)>0)}_isPointBasedSeries(t){const e=t&&t.type||this.w.config.chart.type;return"line"===e||"area"===e}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>d.default});
|
|
5
|
+
"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(e,i,r)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,l=(t,e)=>{for(var i in e||(e={}))s.call(e,i)&&o(t,i,e[i]);if(r)for(var i of r(e))n.call(e,i)&&o(t,i,e[i]);return t},a=(t,r)=>e(t,i(r));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function c(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const d=c(require("apexcharts/core")),h=d.__apex_Utils,p=d.__apex_Environment_Environment,u=d.__apex_BrowserAPIs_BrowserAPIs;function f(t,e,i,r){var s;const n=null==(s=null==e?void 0:e.dimensions)?void 0:s.dimHelpers,o=n?n.getTitleSubtitleCoords("title").height+n.getTitleSubtitleCoords("subtitle").height:0,l=i.getBoundingClientRect().height||18,a=r&&r.offsetY||0,c=function(t,e){const i=t.layout.translateY||0,r=t.dom.elWrap;if(!r)return i;const s=t.dom.baseEl.querySelectorAll(".apexcharts-yaxis-label");if(!s.length)return i;const n=r.getBoundingClientRect().top,o=e.getBoundingClientRect();let l=i;for(let t=0;t<s.length;t++){const e=s[t].getBoundingClientRect();e.height&&(e.left>=o.right||e.right<=o.left||(l=Math.min(l,e.top-n)))}return l}(t,i);if(c-o>=l+1)return i.style.top=`${c-l-1+a}px`,!0;i.style.top=`${o+a}px`;const d="dark"===t.config.theme.mode;return i.style.background=d?"rgba(20,24,30,0.82)":"rgba(255,255,255,0.86)",i.style.borderRadius="4px",!1}const w="http://www.w3.org/1999/xhtml";class g{constructor(t,e,i){this.w=t,this.ctx=e,this.drilldown=i}render(t){if(!p.isBrowser())return;const e=this.w,i=e.dom.elWrap;if(!i)return;const r=i.querySelector(".apexcharts-breadcrumb[aria-label^=Drill]");r&&r.parentNode&&r.parentNode.removeChild(r);const s=e.config.drilldown&&e.config.drilldown.breadcrumb;if(!s||!1===s.show)return;if(0===this.drilldown.depth)return;const n=u.createElementNS(w,"nav");n.setAttribute("class","apexcharts-breadcrumb"),n.setAttribute("aria-label","Drilldown breadcrumb"),this._position(n,s);const o=null!=s.separator?s.separator:" / ";t.forEach((e,i)=>{if(i>0){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-separator"),t.setAttribute("aria-hidden","true"),t.textContent=o,n.appendChild(t)}const r=this._label(e,i);if(i===t.length-1){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-item apexcharts-breadcrumb-current"),t.setAttribute("aria-current","page"),t.textContent=r,n.appendChild(t)}else{const t=u.createElementNS(w,"button");if(t.setAttribute("type","button"),t.setAttribute("class","apexcharts-breadcrumb-item"),0===i){const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-arrow"),e.setAttribute("aria-hidden","true"),e.textContent="\u2190",t.appendChild(e)}const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-label"),e.textContent=r,t.appendChild(e),t.addEventListener("click",()=>this.drilldown.drillToLevel(i)),n.appendChild(t)}}),i.appendChild(n),this.w.globals.axisCharts&&f(this.w,this.ctx,n,s),this._avoidChromeOverlap(n)}_avoidChromeOverlap(t){const e=this.w,i=[".apexcharts-title-text",".apexcharts-subtitle-text"].map(t=>e.dom.baseEl.querySelector(t)).filter(t=>null!==t);if(!i.length)return;const r=e.dom.elWrap.getBoundingClientRect().top;for(let e=0;e<i.length+1;e++){const e=t.getBoundingClientRect(),s=i.find(t=>{const i=t.getBoundingClientRect();return e.left<i.right&&e.right>i.left&&e.top<i.bottom&&e.bottom>i.top});if(!s)break;t.style.top=s.getBoundingClientRect().bottom-r+4+"px"}}_label(t,e){const i=this.w.config.drilldown.breadcrumb;let r;if(0===e)r=null!=i.rootLabel?i.rootLabel:"All";else{const e=(this.w.config.drilldown.series||[]).find(e=>e&&e.id===t);r=e&&e.name||String(t)}return"function"==typeof i.formatter?i.formatter(r,{index:e,depth:this.drilldown.depth}):r}_position(t,e){const i=e.offsetX||0,r=e.offsetY||0;t.style.position="absolute",t.style.top=r+"px","top-right"===e.position?t.style.right=3-i+"px":t.style.left=i+"px"}}const b="http://www.w3.org/1999/xhtml",_="apexcharts-drilldown-loading";class m{constructor(t){this.w=t,this.el=null}_cfg(){const t=this.w.config.drilldown,e=t&&t.loading;return!1===e?{show:!1}:e||{}}show(){if(!p.isBrowser())return;const t=this._cfg();if(!1===t.show)return;const e=this.w.dom.elWrap;if(!e)return;this.hide();const i=u.createElementNS(b,"div");i.setAttribute("class",_),i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-label",t.text||"Loading");const r=u.createElementNS(b,"div");if(r.setAttribute("class",`${_}-spinner`),r.setAttribute("aria-hidden","true"),i.appendChild(r),t.text){const e=u.createElementNS(b,"span");e.setAttribute("class",`${_}-text`),e.textContent=t.text,i.appendChild(e)}e.appendChild(i),this.el=i}hide(){const t=this.w.dom.elWrap;if(t){const e=t.querySelectorAll(`.${_}`);for(let t=0;t<e.length;t++){const i=e[t];i.parentNode&&i.parentNode.removeChild(i)}}else this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el);this.el=null}}const x="__apexDrilldownMarker";d.default.registerFeatures({drilldown:class{constructor(t,e){this.w=t,this.ctx=e,this.stack=[],this.rootSnapshot=null,this._wired=!1,this._asyncCache=new Map,this._pending=null,this._warnedUnreachable=!1,this._warnedNoSliceOffset=!1,this.breadcrumb=new g(t,e,this),this.loading=new m(t),this._onPointSelect=this._onPointSelect.bind(this),this._afterRender=this._afterRender.bind(this),this._onPlotDown=this._onPlotDown.bind(this),this._onPlotClick=this._onPlotClick.bind(this),this._downAt=null,this._plotClickWired=null,this.init()}init(){const t=this.w;t.config.drilldown&&t.config.drilldown.enabled&&(this._wired||(this._wired=!0,this.ctx.addEventListener("dataPointSelection",this._onPointSelect),this.ctx.addEventListener("mounted",this._afterRender),this.ctx.addEventListener("updated",this._afterRender),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series))))}get path(){return["root",...this.stack.map(t=>t.id)]}get depth(){return this.stack.length}drillDown(t,e,i){const r=this._resolveChild(t);return r?this._drillInto(r,e,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(t,e,i):(console.warn(`ApexCharts: drilldown id "${t}" not found in chart.drilldown.series, and no onDrillDown resolver is set.`),Promise.resolve(this.ctx))}drillUp(){return this.drillToLevel(this.stack.length-1)}drillToRoot(){return this.drillToLevel(0)}drillToLevel(t){const e=this.stack.length;if(t<0||t>=e)return Promise.resolve(this.ctx);const i=this.path[this.path.length-1],r=0===t?this.rootSnapshot:this.stack[t].restore;this.stack=this.stack.slice(0,t);const s=this.path[this.path.length-1];return this._apply(this._viewFromSnapshot(r),"up",{from:i,to:s})}_resolveChild(t){const e=this.w.config.drilldown&&this.w.config.drilldown.series;return Array.isArray(e)&&e.find(e=>e&&e.id===t)||null}_drillInto(t,e,i){if(this.stack.length>=32)return console.warn("ApexCharts: drilldown max depth (32) reached."),Promise.resolve(this.ctx);this.rootSnapshot||(this.rootSnapshot=this._snapshot());const r=this.path[this.path.length-1],s={id:t.id,name:t.name,restore:this._snapshot()};return this.stack.push(s),this._apply(this._viewFromChild(t),"down",{from:r,to:t.id,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex}).catch(e=>{throw this.stack[this.stack.length-1]===s&&this.stack.pop(),this._fire("drillDownError",{id:t.id,error:e}),e})}_drillDownAsync(t,e,i){const r=this.w.config.drilldown.onDrillDown,s=this._cacheGet(t);if(s)return this._drillInto(s,e,i);if(this._pending)return this._pending;let n;this.loading.show();try{n=r({id:t,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex})}catch(e){return this.loading.hide(),this._fire("drillDownError",{id:t,error:e}),Promise.resolve(this.ctx)}const o=()=>{this._pending=null,this.loading.hide()},c=Promise.resolve(n).then(r=>{if(o(),this._isDead())return this.ctx;if(!r||!r.data)return this._fire("drillDownError",{id:t,error:new Error(`drilldown: onDrillDown resolved without a drillable level for id "${t}" (expected an object with a \`data\` array).`)}),this.ctx;const s=null!=r.id?r:a(l({},r),{id:t});return this._cacheSet(t,s),this._drillInto(s,e,i)},e=>(o(),this._isDead()||this._fire("drillDownError",{id:t,error:e}),this.ctx));return this._pending=c,c}_isDead(){const t=this.w;return!t||!t.globals||!0===t.globals.isDestroyed}_cacheEnabled(){const t=this.w.config.drilldown;return!(!t||!1===t.cache)}_cacheGet(t){return this._cacheEnabled()&&null!=t&&this._asyncCache.get(t)||null}_cacheSet(t,e){this._cacheEnabled()&&null!=t&&this._asyncCache.set(t,e)}clearCache(t){return null==t?this._asyncCache.clear():this._asyncCache.delete(t),this.ctx}_snapshot(){const t=this.w.config,e=this._overrideFields(),i={series:this._uncollapseSeries(h.clone(t.series))};return Array.isArray(t.labels)&&t.labels.length&&(i.labels=h.clone(t.labels)),i.chart={type:t.chart.type,stacked:t.chart.stacked},e.has("xaxis")&&(i.xaxis=h.clone(t.xaxis)),e.has("yaxis")&&(i.yaxis=h.clone(t.yaxis)),e.has("colors")&&(i.colors=t.colors?h.clone(t.colors):void 0),e.has("plotOptions")&&(i.plotOptions=h.clone(t.plotOptions)),e.has("fill")&&(i.fill=h.clone(t.fill)),e.has("legend")&&(i.legend=h.clone(t.legend)),i}_uncollapseSeries(t){const e=this.w,i=e.globals,r=[...i.collapsedSeries||[],...i.ancillaryCollapsedSeries||[]];if(!r.length)return t;const s=e.config.chart.type,n=("pie"===s||"donut"===s||"polarArea"===s)&&1===t.length&&t[0]&&"object"==typeof t[0]&&Array.isArray(t[0].data)?t[0].data:t;for(const e of r){const r=e.index;i.axisCharts?t[r]&&(t[r].data=Array.isArray(e.data)?e.data.slice():e.data):n[r]&&"object"==typeof n[r]?n[r].y=e.data:void 0!==n[r]&&(n[r]=e.data)}return t}_overrideFields(){const t=new Set,e=this.w.config.drilldown&&this.w.config.drilldown.series||[];for(const i of e)i&&(i.xaxis&&t.add("xaxis"),i.yaxis&&t.add("yaxis"),i.colors&&t.add("colors"),i.plotOptions&&t.add("plotOptions"),i.fill&&t.add("fill"),i.legend&&t.add("legend"));return t}_copyOptionalViewFields(t,e){e.xaxis&&(t.xaxis=e.xaxis),e.yaxis&&(t.yaxis=e.yaxis),e.colors&&(t.colors=e.colors),e.plotOptions&&(t.plotOptions=e.plotOptions),e.fill&&(t.fill=e.fill),e.legend&&(t.legend=e.legend)}_viewFromChild(t){const e={};Array.isArray(t.series)?e.series=t.series:e.series=[{name:t.name||"",data:t.data}];const i={};return t.chart&&t.chart.type&&(i.type=t.chart.type),t.chart&&null!=t.chart.stacked&&(i.stacked=t.chart.stacked),Object.keys(i).length&&(e.chart=i),this._copyOptionalViewFields(e,t),e}_viewFromSnapshot(t){const e={series:t.series,chart:t.chart};return t.labels&&t.labels.length&&(e.labels=t.labels),this._copyOptionalViewFields(e,t),e}_apply(t,e,i){var r;const s=this.w;s.interact.selectedDataPoints=[],s.globals.collapsedSeries=[],s.globals.collapsedSeriesIndices=[],s.globals.ancillaryCollapsedSeries=[],s.globals.ancillaryCollapsedSeriesIndices=[],s.globals.allSeriesCollapsed=!1,s.globals.risingSeries=[],t.markers=a(l({},t.markers||{}),{discrete:this._drillMarkers(t.series)});const n=(!s.config.drilldown.animation||!1!==s.config.drilldown.animation.enabled)&&!1!==s.config.chart.animations.enabled;"down"===e&&this._fire("drillDownStart",i),null==(r=this.ctx.highlightFilter)||r.drillView(t);const o=e=>this.ctx.updateOptions(t,!1,e,!1,!1),c=()=>(this._fire("down"===e?"drillDownEnd":"drillUp",i),this.ctx);if(n&&this._zoomEnabled()){const t=this._triggerOrigin(i);if(t)return this._zoomDrill(t,e,()=>o(!1)).then(c)}return o(n).then(c)}_zoomEnabled(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation;return!(!t||!t.zoomFromPoint)}_svgNode(){const t=this.w.dom&&this.w.dom.Paper;return t&&t.node?t.node:null}_markGroup(){const t=this._svgNode();return t&&"function"==typeof t.querySelector?t.querySelector(".apexcharts-plot-series, .apexcharts-heatmap, .apexcharts-treemap"):null}_triggerOrigin(t){if(!p.isBrowser())return null;const e=this._svgNode(),i=this._markGroup();if(!e||!i||"function"!=typeof i.animate||"function"!=typeof e.getBoundingClientRect)return null;const r=e.getBoundingClientRect();let s=null;if(t&&null!=t.seriesIndex&&null!=t.dataPointIndex&&this.w.dom.baseEl&&(s=this.w.dom.baseEl.querySelector(`[index="${t.seriesIndex}"][j="${t.dataPointIndex}"]`)),s&&"function"==typeof s.getBoundingClientRect){const t=s.getBoundingClientRect();return{x:t.left+t.width/2-r.left,y:t.top+t.height/2-r.top}}const n=i.getBoundingClientRect();return{x:n.left+n.width/2-r.left,y:n.top+n.height/2-r.top}}_zoomDrill(t,e,i){return r=this,s=null,n=function*(){const r=this._zoomDuration(),s="down"===e,n=Math.round(.55*r),o=s?"scale(1.03)":"scale(0.97)",l=s?"scaleX(0.55) scaleY(0.85)":"scale(1.04)",a=e=>{e.style.transformBox="view-box",e.style.transformOrigin=`${t.x}px ${t.y}px`},c=this._markGroup();let d=null;if(c){a(c),d=c.animate([{transform:"scale(1)",opacity:1},{transform:o,opacity:0}],{duration:n,easing:"ease-in",fill:"forwards"});try{yield d.finished}catch(t){}}yield i();const h=this._markGroup();if(h){a(h),h.style.opacity="0",h.style.transform=l,d&&c===h&&d.cancel();const t=h.animate([{transform:l,opacity:0},{transform:"scale(1)",opacity:1}],{duration:r,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"});try{yield t.finished}catch(t){}(p=h).style.transform="",p.style.opacity="",p.style.transformOrigin="",p.style.transformBox="",t.cancel()}var p},new Promise((t,e)=>{var i=t=>{try{l(n.next(t))}catch(t){e(t)}},o=t=>{try{l(n.throw(t))}catch(t){e(t)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,o);l((n=n.apply(r,s)).next())});var r,s,n}_zoomDuration(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation,e=t&&"number"==typeof t.speed?t.speed:260;return Math.max(80,e)}_fire(t,e){const i=this.w.config.chart.events&&this.w.config.chart.events[t];"function"==typeof i&&i(e,this.ctx,this.w),this.ctx.events.fireEvent(t,[e,this.ctx,this.w])}_onPointSelect(t,e,i){if(!i||this._retired())return;const r=this._pointAt(i.seriesIndex,i.dataPointIndex);return r&&"object"==typeof r&&null!=r.drilldown?this.drillDown(r.drilldown,r,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(null,r,i):void 0}_pointAt(t,e){const i=this.w.config.series;if(!Array.isArray(i)||null==t||null==e)return null;const r=i[t];return r&&Array.isArray(r.data)&&null!=r.data[e]?r.data[e]:null}_retired(){return this.ctx.drilldown!==this&&(Promise.resolve().then(()=>{const t=this.ctx.events;t&&(t.removeEventListener("dataPointSelection",this._onPointSelect),t.removeEventListener("mounted",this._afterRender),t.removeEventListener("updated",this._afterRender))}),!0)}_afterRender(){const t=this.w;this._retired()||t.config.drilldown&&t.config.drilldown.enabled&&(this._markDrillableTargets(),this._wirePlotClick(),this.breadcrumb.render(this.path),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series)))}_markDrillableTargets(){if(!p.isBrowser())return;const t=this.w,e=t.dom.baseEl,i=t.config.series;if(!e||!Array.isArray(i))return;let r=0;i.forEach((t,i)=>{const s=t&&Array.isArray(t.data)?t.data:null;s&&s.forEach((t,s)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const n=e.querySelectorAll(`[index="${i}"][j="${s}"]`);n.length||r++,n.forEach(t=>{this._isClickThroughMark(t)&&t.classList.remove("no-pointer-events"),t.classList.add("apexcharts-drilldown-target")})})}),r&&!this._warnedUnreachable&&(this._warnedUnreachable=!0,console.warn(`ApexCharts: ${r} drillable point(s) have no clickable mark, so clicking them cannot do anything. Leave \`drilldown.marker\` on, or give the series markers of its own (\`markers.size > 0\`).`))}warnSliceOffsetDisabled(){this._warnedNoSliceOffset||(this._warnedNoSliceOffset=!0,console.warn("ApexCharts: `plotOptions.pie.expandOnClick` is not available in a drilldown pie/donut, so it was ignored. A slice click navigates, and a slice that slid out would be discarded by the drill it just triggered."))}_wirePlotClick(){if(!p.isBrowser())return;const t=this.w.dom.baseEl;t&&this._plotClickWired!==t&&(this._plotClickWired&&(this._plotClickWired.removeEventListener("mousedown",this._onPlotDown),this._plotClickWired.removeEventListener("click",this._onPlotClick)),t.addEventListener("mousedown",this._onPlotDown),t.addEventListener("click",this._onPlotClick),this._plotClickWired=t)}_onPlotDown(t){this._downAt={x:t.clientX,y:t.clientY}}_onPlotClick(t){const e=this.w;if(!e.config.drilldown||!e.config.drilldown.enabled)return;const i=this._downAt;if(this._downAt=null,i&&Math.hypot(t.clientX-i.x,t.clientY-i.y)>4)return;const r=t.target;if(!r||"function"!=typeof r.closest)return;if(r.closest(".apexcharts-drilldown-target"))return;if(r.closest(".apexcharts-legend, .apexcharts-toolbar, .apexcharts-breadcrumb, .apexcharts-menu, .apexcharts-tooltip"))return;const s=e.interact.capturedSeriesIndex,n=e.interact.capturedDataPointIndex;if(null==s||null==n||s<0||n<0)return;if(!this._isPointBasedSeries(e.config.series[s]))return;const o=this._pointAt(s,n);return o&&"object"==typeof o&&null!=o.drilldown?this.drillDown(o.drilldown,o,{seriesIndex:s,dataPointIndex:n}):void 0}_isClickThroughMark(t){return!(!t.classList||!t.classList.contains("no-pointer-events"))&&(!!t.classList.contains("apexcharts-marker")&&!("function"==typeof t.closest&&t.closest(".apexcharts-tooltip")))}_drillMarkers(t){const e=this.w,i=e.config.drilldown,r=Array.isArray(e.config.markers&&e.config.markers.discrete)?e.config.markers.discrete.filter(t=>!t||!t[x]):[],s=i&&i.marker||{};if(!1===s.show||!Array.isArray(t))return r;const n=[];return t.forEach((t,e)=>{if(!this._seriesNeedsDrillMarker(e,t))return;const i=t&&Array.isArray(t.data)?t.data:null;i&&i.forEach((t,i)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const r={seriesIndex:e,dataPointIndex:i,[x]:!0};void 0!==s.size&&(r.size=s.size),void 0!==s.shape&&(r.shape=s.shape),void 0!==s.fillColor&&(r.fillColor=s.fillColor),void 0!==s.strokeColor&&(r.strokeColor=s.strokeColor),n.push(r)})}),r.concat(n)}_seriesNeedsDrillMarker(t,e){if(!this._isPointBasedSeries(e))return!1;const i=this.w.config.markers&&this.w.config.markers.size,r=Array.isArray(i)?i[t]:i;return!(Number(r)>0)}_isPointBasedSeries(t){const e=t&&t.type||this.w.config.chart.type;return"line"===e||"area"===e}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>d.default});
|
|
@@ -38,7 +38,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
/*!
|
|
41
|
-
* ApexCharts v8.
|
|
41
|
+
* ApexCharts v8.3.0
|
|
42
42
|
* (c) 2018-2026 ApexCharts
|
|
43
43
|
*/
|
|
44
44
|
import * as _core from "apexcharts/core";
|
|
@@ -102,7 +102,9 @@ class Breadcrumb {
|
|
|
102
102
|
const w = this.w;
|
|
103
103
|
const elWrap = w.dom.elWrap;
|
|
104
104
|
if (!elWrap) return;
|
|
105
|
-
const existing = elWrap.querySelector(
|
|
105
|
+
const existing = elWrap.querySelector(
|
|
106
|
+
".apexcharts-breadcrumb[aria-label^=Drill]"
|
|
107
|
+
);
|
|
106
108
|
if (existing && existing.parentNode) {
|
|
107
109
|
existing.parentNode.removeChild(existing);
|
|
108
110
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v8.
|
|
2
|
+
* ApexCharts v8.3.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
!function(t){var e="undefined"!=typeof globalThis?globalThis:self,i=e.ApexCharts;if(i&&i.__internals)return t.call(e);if(i)throw new Error("ApexCharts: dist/features/drilldown.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 t.call(e);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/drilldown.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/drilldown.js",run:t,done:!1},s=e.__apexcharts_pending_addons__||(e.__apexcharts_pending_addons__=[]);s.push(r),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!r.done){var i=e.ApexCharts;if(i)if(i.__internals){r.done=!0;var n=s.indexOf(r);-1!==n&&s.splice(n,1);try{t.call(e),i.__drainsAddons||e.console.warn("ApexCharts: dist/features/drilldown.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(t){e.console.error("ApexCharts: dist/features/drilldown.js could not register with the ApexCharts script on this page: "+(t&&t.message))}}else e.console.error("ApexCharts: dist/features/drilldown.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 e.console.warn("ApexCharts: dist/features/drilldown.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 t,e;t=this,e=function(t){"use strict";var e=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(t,i,r)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r,a=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&l(t,i,e[i]);if(s)for(var i of s(e))o.call(e,i)&&l(t,i,e[i]);return t},d=(t,e)=>i(t,r(e));const c=globalThis.ApexCharts,h=globalThis.ApexCharts.__internals.__apex_Utils,p=globalThis.ApexCharts.__internals.__apex_Environment_Environment,u=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs;function f(t,e,i,r){var s;const n=null==(s=null==e?void 0:e.dimensions)?void 0:s.dimHelpers,o=n?n.getTitleSubtitleCoords("title").height+n.getTitleSubtitleCoords("subtitle").height:0,l=i.getBoundingClientRect().height||18,a=r&&r.offsetY||0,d=function(t,e){const i=t.layout.translateY||0,r=t.dom.elWrap;if(!r)return i;const s=t.dom.baseEl.querySelectorAll(".apexcharts-yaxis-label");if(!s.length)return i;const n=r.getBoundingClientRect().top,o=e.getBoundingClientRect();let l=i;for(let t=0;t<s.length;t++){const e=s[t].getBoundingClientRect();e.height&&(e.left>=o.right||e.right<=o.left||(l=Math.min(l,e.top-n)))}return l}(t,i);if(d-o>=l+1)return i.style.top=`${d-l-1+a}px`,!0;i.style.top=`${o+a}px`;const c="dark"===t.config.theme.mode;return i.style.background=c?"rgba(20,24,30,0.82)":"rgba(255,255,255,0.86)",i.style.borderRadius="4px",!1}const w="http://www.w3.org/1999/xhtml";class g{constructor(t,e,i){this.w=t,this.ctx=e,this.drilldown=i}render(t){if(!p.isBrowser())return;const e=this.w,i=e.dom.elWrap;if(!i)return;const r=i.querySelector(".apexcharts-breadcrumb");r&&r.parentNode&&r.parentNode.removeChild(r);const s=e.config.drilldown&&e.config.drilldown.breadcrumb;if(!s||!1===s.show)return;if(0===this.drilldown.depth)return;const n=u.createElementNS(w,"nav");n.setAttribute("class","apexcharts-breadcrumb"),n.setAttribute("aria-label","Drilldown breadcrumb"),this._position(n,s);const o=null!=s.separator?s.separator:" / ";t.forEach((e,i)=>{if(i>0){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-separator"),t.setAttribute("aria-hidden","true"),t.textContent=o,n.appendChild(t)}const r=this._label(e,i);if(i===t.length-1){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-item apexcharts-breadcrumb-current"),t.setAttribute("aria-current","page"),t.textContent=r,n.appendChild(t)}else{const t=u.createElementNS(w,"button");if(t.setAttribute("type","button"),t.setAttribute("class","apexcharts-breadcrumb-item"),0===i){const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-arrow"),e.setAttribute("aria-hidden","true"),e.textContent="\u2190",t.appendChild(e)}const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-label"),e.textContent=r,t.appendChild(e),t.addEventListener("click",()=>this.drilldown.drillToLevel(i)),n.appendChild(t)}}),i.appendChild(n),this.w.globals.axisCharts&&f(this.w,this.ctx,n,s),this._avoidChromeOverlap(n)}_avoidChromeOverlap(t){const e=this.w,i=[".apexcharts-title-text",".apexcharts-subtitle-text"].map(t=>e.dom.baseEl.querySelector(t)).filter(t=>null!==t);if(!i.length)return;const r=e.dom.elWrap.getBoundingClientRect().top;for(let e=0;e<i.length+1;e++){const e=t.getBoundingClientRect(),s=i.find(t=>{const i=t.getBoundingClientRect();return e.left<i.right&&e.right>i.left&&e.top<i.bottom&&e.bottom>i.top});if(!s)break;t.style.top=s.getBoundingClientRect().bottom-r+4+"px"}}_label(t,e){const i=this.w.config.drilldown.breadcrumb;let r;if(0===e)r=null!=i.rootLabel?i.rootLabel:"All";else{const e=(this.w.config.drilldown.series||[]).find(e=>e&&e.id===t);r=e&&e.name||String(t)}return"function"==typeof i.formatter?i.formatter(r,{index:e,depth:this.drilldown.depth}):r}_position(t,e){const i=e.offsetX||0,r=e.offsetY||0;t.style.position="absolute",t.style.top=r+"px","top-right"===e.position?t.style.right=3-i+"px":t.style.left=i+"px"}}const x="http://www.w3.org/1999/xhtml",_="apexcharts-drilldown-loading";class m{constructor(t){this.w=t,this.el=null}_cfg(){const t=this.w.config.drilldown,e=t&&t.loading;return!1===e?{show:!1}:e||{}}show(){if(!p.isBrowser())return;const t=this._cfg();if(!1===t.show)return;const e=this.w.dom.elWrap;if(!e)return;this.hide();const i=u.createElementNS(x,"div");i.setAttribute("class",_),i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-label",t.text||"Loading");const r=u.createElementNS(x,"div");if(r.setAttribute("class",`${_}-spinner`),r.setAttribute("aria-hidden","true"),i.appendChild(r),t.text){const e=u.createElementNS(x,"span");e.setAttribute("class",`${_}-text`),e.textContent=t.text,i.appendChild(e)}e.appendChild(i),this.el=i}hide(){const t=this.w.dom.elWrap;if(t){const e=t.querySelectorAll(`.${_}`);for(let t=0;t<e.length;t++){const i=e[t];i.parentNode&&i.parentNode.removeChild(i)}}else this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el);this.el=null}}const b="__apexDrilldownMarker";c.registerFeatures({drilldown:class{constructor(t,e){this.w=t,this.ctx=e,this.stack=[],this.rootSnapshot=null,this._wired=!1,this._asyncCache=new Map,this._pending=null,this._warnedUnreachable=!1,this._warnedNoSliceOffset=!1,this.breadcrumb=new g(t,e,this),this.loading=new m(t),this._onPointSelect=this._onPointSelect.bind(this),this._afterRender=this._afterRender.bind(this),this._onPlotDown=this._onPlotDown.bind(this),this._onPlotClick=this._onPlotClick.bind(this),this._downAt=null,this._plotClickWired=null,this.init()}init(){const t=this.w;t.config.drilldown&&t.config.drilldown.enabled&&(this._wired||(this._wired=!0,this.ctx.addEventListener("dataPointSelection",this._onPointSelect),this.ctx.addEventListener("mounted",this._afterRender),this.ctx.addEventListener("updated",this._afterRender),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series))))}get path(){return["root",...this.stack.map(t=>t.id)]}get depth(){return this.stack.length}drillDown(t,e,i){const r=this._resolveChild(t);return r?this._drillInto(r,e,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(t,e,i):(console.warn(`ApexCharts: drilldown id "${t}" not found in chart.drilldown.series, and no onDrillDown resolver is set.`),Promise.resolve(this.ctx))}drillUp(){return this.drillToLevel(this.stack.length-1)}drillToRoot(){return this.drillToLevel(0)}drillToLevel(t){const e=this.stack.length;if(t<0||t>=e)return Promise.resolve(this.ctx);const i=this.path[this.path.length-1],r=0===t?this.rootSnapshot:this.stack[t].restore;this.stack=this.stack.slice(0,t);const s=this.path[this.path.length-1];return this._apply(this._viewFromSnapshot(r),"up",{from:i,to:s})}_resolveChild(t){const e=this.w.config.drilldown&&this.w.config.drilldown.series;return Array.isArray(e)&&e.find(e=>e&&e.id===t)||null}_drillInto(t,e,i){if(this.stack.length>=32)return console.warn("ApexCharts: drilldown max depth (32) reached."),Promise.resolve(this.ctx);this.rootSnapshot||(this.rootSnapshot=this._snapshot());const r=this.path[this.path.length-1],s={id:t.id,name:t.name,restore:this._snapshot()};return this.stack.push(s),this._apply(this._viewFromChild(t),"down",{from:r,to:t.id,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex}).catch(e=>{throw this.stack[this.stack.length-1]===s&&this.stack.pop(),this._fire("drillDownError",{id:t.id,error:e}),e})}_drillDownAsync(t,e,i){const r=this.w.config.drilldown.onDrillDown,s=this._cacheGet(t);if(s)return this._drillInto(s,e,i);if(this._pending)return this._pending;let n;this.loading.show();try{n=r({id:t,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex})}catch(e){return this.loading.hide(),this._fire("drillDownError",{id:t,error:e}),Promise.resolve(this.ctx)}const o=()=>{this._pending=null,this.loading.hide()},l=Promise.resolve(n).then(r=>{if(o(),this._isDead())return this.ctx;if(!r||!r.data)return this._fire("drillDownError",{id:t,error:new Error(`drilldown: onDrillDown resolved without a drillable level for id "${t}" (expected an object with a \`data\` array).`)}),this.ctx;const s=null!=r.id?r:d(a({},r),{id:t});return this._cacheSet(t,s),this._drillInto(s,e,i)},e=>(o(),this._isDead()||this._fire("drillDownError",{id:t,error:e}),this.ctx));return this._pending=l,l}_isDead(){const t=this.w;return!t||!t.globals||!0===t.globals.isDestroyed}_cacheEnabled(){const t=this.w.config.drilldown;return!(!t||!1===t.cache)}_cacheGet(t){return this._cacheEnabled()&&null!=t&&this._asyncCache.get(t)||null}_cacheSet(t,e){this._cacheEnabled()&&null!=t&&this._asyncCache.set(t,e)}clearCache(t){return null==t?this._asyncCache.clear():this._asyncCache.delete(t),this.ctx}_snapshot(){const t=this.w.config,e=this._overrideFields(),i={series:this._uncollapseSeries(h.clone(t.series))};return Array.isArray(t.labels)&&t.labels.length&&(i.labels=h.clone(t.labels)),i.chart={type:t.chart.type,stacked:t.chart.stacked},e.has("xaxis")&&(i.xaxis=h.clone(t.xaxis)),e.has("yaxis")&&(i.yaxis=h.clone(t.yaxis)),e.has("colors")&&(i.colors=t.colors?h.clone(t.colors):void 0),e.has("plotOptions")&&(i.plotOptions=h.clone(t.plotOptions)),e.has("fill")&&(i.fill=h.clone(t.fill)),e.has("legend")&&(i.legend=h.clone(t.legend)),i}_uncollapseSeries(t){const e=this.w,i=e.globals,r=[...i.collapsedSeries||[],...i.ancillaryCollapsedSeries||[]];if(!r.length)return t;const s=e.config.chart.type,n=("pie"===s||"donut"===s||"polarArea"===s)&&1===t.length&&t[0]&&"object"==typeof t[0]&&Array.isArray(t[0].data)?t[0].data:t;for(const e of r){const r=e.index;i.axisCharts?t[r]&&(t[r].data=Array.isArray(e.data)?e.data.slice():e.data):n[r]&&"object"==typeof n[r]?n[r].y=e.data:void 0!==n[r]&&(n[r]=e.data)}return t}_overrideFields(){const t=new Set,e=this.w.config.drilldown&&this.w.config.drilldown.series||[];for(const i of e)i&&(i.xaxis&&t.add("xaxis"),i.yaxis&&t.add("yaxis"),i.colors&&t.add("colors"),i.plotOptions&&t.add("plotOptions"),i.fill&&t.add("fill"),i.legend&&t.add("legend"));return t}_copyOptionalViewFields(t,e){e.xaxis&&(t.xaxis=e.xaxis),e.yaxis&&(t.yaxis=e.yaxis),e.colors&&(t.colors=e.colors),e.plotOptions&&(t.plotOptions=e.plotOptions),e.fill&&(t.fill=e.fill),e.legend&&(t.legend=e.legend)}_viewFromChild(t){const e={};Array.isArray(t.series)?e.series=t.series:e.series=[{name:t.name||"",data:t.data}];const i={};return t.chart&&t.chart.type&&(i.type=t.chart.type),t.chart&&null!=t.chart.stacked&&(i.stacked=t.chart.stacked),Object.keys(i).length&&(e.chart=i),this._copyOptionalViewFields(e,t),e}_viewFromSnapshot(t){const e={series:t.series,chart:t.chart};return t.labels&&t.labels.length&&(e.labels=t.labels),this._copyOptionalViewFields(e,t),e}_apply(t,e,i){var r;const s=this.w;s.interact.selectedDataPoints=[],s.globals.collapsedSeries=[],s.globals.collapsedSeriesIndices=[],s.globals.ancillaryCollapsedSeries=[],s.globals.ancillaryCollapsedSeriesIndices=[],s.globals.allSeriesCollapsed=!1,s.globals.risingSeries=[],t.markers=d(a({},t.markers||{}),{discrete:this._drillMarkers(t.series)});const n=(!s.config.drilldown.animation||!1!==s.config.drilldown.animation.enabled)&&!1!==s.config.chart.animations.enabled;"down"===e&&this._fire("drillDownStart",i),null==(r=this.ctx.highlightFilter)||r.drillView(t);const o=e=>this.ctx.updateOptions(t,!1,e,!1,!1),l=()=>(this._fire("down"===e?"drillDownEnd":"drillUp",i),this.ctx);if(n&&this._zoomEnabled()){const t=this._triggerOrigin(i);if(t)return this._zoomDrill(t,e,()=>o(!1)).then(l)}return o(n).then(l)}_zoomEnabled(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation;return!(!t||!t.zoomFromPoint)}_svgNode(){const t=this.w.dom&&this.w.dom.Paper;return t&&t.node?t.node:null}_markGroup(){const t=this._svgNode();return t&&"function"==typeof t.querySelector?t.querySelector(".apexcharts-plot-series, .apexcharts-heatmap, .apexcharts-treemap"):null}_triggerOrigin(t){if(!p.isBrowser())return null;const e=this._svgNode(),i=this._markGroup();if(!e||!i||"function"!=typeof i.animate||"function"!=typeof e.getBoundingClientRect)return null;const r=e.getBoundingClientRect();let s=null;if(t&&null!=t.seriesIndex&&null!=t.dataPointIndex&&this.w.dom.baseEl&&(s=this.w.dom.baseEl.querySelector(`[index="${t.seriesIndex}"][j="${t.dataPointIndex}"]`)),s&&"function"==typeof s.getBoundingClientRect){const t=s.getBoundingClientRect();return{x:t.left+t.width/2-r.left,y:t.top+t.height/2-r.top}}const n=i.getBoundingClientRect();return{x:n.left+n.width/2-r.left,y:n.top+n.height/2-r.top}}_zoomDrill(t,e,i){return r=this,s=null,n=function*(){const r=this._zoomDuration(),s="down"===e,n=Math.round(.55*r),o=s?"scale(1.03)":"scale(0.97)",l=s?"scaleX(0.55) scaleY(0.85)":"scale(1.04)",a=e=>{e.style.transformBox="view-box",e.style.transformOrigin=`${t.x}px ${t.y}px`},d=this._markGroup();let c=null;if(d){a(d),c=d.animate([{transform:"scale(1)",opacity:1},{transform:o,opacity:0}],{duration:n,easing:"ease-in",fill:"forwards"});try{yield c.finished}catch(t){}}yield i();const h=this._markGroup();if(h){a(h),h.style.opacity="0",h.style.transform=l,c&&d===h&&c.cancel();const t=h.animate([{transform:l,opacity:0},{transform:"scale(1)",opacity:1}],{duration:r,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"});try{yield t.finished}catch(t){}(p=h).style.transform="",p.style.opacity="",p.style.transformOrigin="",p.style.transformBox="",t.cancel()}var p},new Promise((t,e)=>{var i=t=>{try{l(n.next(t))}catch(t){e(t)}},o=t=>{try{l(n.throw(t))}catch(t){e(t)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,o);l((n=n.apply(r,s)).next())});var r,s,n}_zoomDuration(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation,e=t&&"number"==typeof t.speed?t.speed:260;return Math.max(80,e)}_fire(t,e){const i=this.w.config.chart.events&&this.w.config.chart.events[t];"function"==typeof i&&i(e,this.ctx,this.w),this.ctx.events.fireEvent(t,[e,this.ctx,this.w])}_onPointSelect(t,e,i){if(!i||this._retired())return;const r=this._pointAt(i.seriesIndex,i.dataPointIndex);return r&&"object"==typeof r&&null!=r.drilldown?this.drillDown(r.drilldown,r,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(null,r,i):void 0}_pointAt(t,e){const i=this.w.config.series;if(!Array.isArray(i)||null==t||null==e)return null;const r=i[t];return r&&Array.isArray(r.data)&&null!=r.data[e]?r.data[e]:null}_retired(){return this.ctx.drilldown!==this&&(Promise.resolve().then(()=>{const t=this.ctx.events;t&&(t.removeEventListener("dataPointSelection",this._onPointSelect),t.removeEventListener("mounted",this._afterRender),t.removeEventListener("updated",this._afterRender))}),!0)}_afterRender(){const t=this.w;this._retired()||t.config.drilldown&&t.config.drilldown.enabled&&(this._markDrillableTargets(),this._wirePlotClick(),this.breadcrumb.render(this.path),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series)))}_markDrillableTargets(){if(!p.isBrowser())return;const t=this.w,e=t.dom.baseEl,i=t.config.series;if(!e||!Array.isArray(i))return;let r=0;i.forEach((t,i)=>{const s=t&&Array.isArray(t.data)?t.data:null;s&&s.forEach((t,s)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const n=e.querySelectorAll(`[index="${i}"][j="${s}"]`);n.length||r++,n.forEach(t=>{this._isClickThroughMark(t)&&t.classList.remove("no-pointer-events"),t.classList.add("apexcharts-drilldown-target")})})}),r&&!this._warnedUnreachable&&(this._warnedUnreachable=!0,console.warn(`ApexCharts: ${r} drillable point(s) have no clickable mark, so clicking them cannot do anything. Leave \`drilldown.marker\` on, or give the series markers of its own (\`markers.size > 0\`).`))}warnSliceOffsetDisabled(){this._warnedNoSliceOffset||(this._warnedNoSliceOffset=!0,console.warn("ApexCharts: `plotOptions.pie.expandOnClick` is not available in a drilldown pie/donut, so it was ignored. A slice click navigates, and a slice that slid out would be discarded by the drill it just triggered."))}_wirePlotClick(){if(!p.isBrowser())return;const t=this.w.dom.baseEl;t&&this._plotClickWired!==t&&(this._plotClickWired&&(this._plotClickWired.removeEventListener("mousedown",this._onPlotDown),this._plotClickWired.removeEventListener("click",this._onPlotClick)),t.addEventListener("mousedown",this._onPlotDown),t.addEventListener("click",this._onPlotClick),this._plotClickWired=t)}_onPlotDown(t){this._downAt={x:t.clientX,y:t.clientY}}_onPlotClick(t){const e=this.w;if(!e.config.drilldown||!e.config.drilldown.enabled)return;const i=this._downAt;if(this._downAt=null,i&&Math.hypot(t.clientX-i.x,t.clientY-i.y)>4)return;const r=t.target;if(!r||"function"!=typeof r.closest)return;if(r.closest(".apexcharts-drilldown-target"))return;if(r.closest(".apexcharts-legend, .apexcharts-toolbar, .apexcharts-breadcrumb, .apexcharts-menu, .apexcharts-tooltip"))return;const s=e.interact.capturedSeriesIndex,n=e.interact.capturedDataPointIndex;if(null==s||null==n||s<0||n<0)return;if(!this._isPointBasedSeries(e.config.series[s]))return;const o=this._pointAt(s,n);return o&&"object"==typeof o&&null!=o.drilldown?this.drillDown(o.drilldown,o,{seriesIndex:s,dataPointIndex:n}):void 0}_isClickThroughMark(t){return!(!t.classList||!t.classList.contains("no-pointer-events")||!t.classList.contains("apexcharts-marker")||"function"==typeof t.closest&&t.closest(".apexcharts-tooltip"))}_drillMarkers(t){const e=this.w,i=e.config.drilldown,r=Array.isArray(e.config.markers&&e.config.markers.discrete)?e.config.markers.discrete.filter(t=>!t||!t[b]):[],s=i&&i.marker||{};if(!1===s.show||!Array.isArray(t))return r;const n=[];return t.forEach((t,e)=>{if(!this._seriesNeedsDrillMarker(e,t))return;const i=t&&Array.isArray(t.data)?t.data:null;i&&i.forEach((t,i)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const r={seriesIndex:e,dataPointIndex:i,[b]:!0};void 0!==s.size&&(r.size=s.size),void 0!==s.shape&&(r.shape=s.shape),void 0!==s.fillColor&&(r.fillColor=s.fillColor),void 0!==s.strokeColor&&(r.strokeColor=s.strokeColor),n.push(r)})}),r.concat(n)}_seriesNeedsDrillMarker(t,e){if(!this._isPointBasedSeries(e))return!1;const i=this.w.config.markers&&this.w.config.markers.size,r=Array.isArray(i)?i[t]:i;return!(Number(r)>0)}_isPointBasedSeries(t){const e=t&&t.type||this.w.config.chart.type;return"line"===e||"area"===e}}}),t.default=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexDrilldown={})});
|
|
5
|
+
!function(t){var e="undefined"!=typeof globalThis?globalThis:self,i=e.ApexCharts;if(i&&i.__internals)return t.call(e);if(i)throw new Error("ApexCharts: dist/features/drilldown.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 t.call(e);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/drilldown.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/drilldown.js",run:t,done:!1},s=e.__apexcharts_pending_addons__||(e.__apexcharts_pending_addons__=[]);s.push(r),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!r.done){var i=e.ApexCharts;if(i)if(i.__internals){r.done=!0;var n=s.indexOf(r);-1!==n&&s.splice(n,1);try{t.call(e),i.__drainsAddons||e.console.warn("ApexCharts: dist/features/drilldown.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(t){e.console.error("ApexCharts: dist/features/drilldown.js could not register with the ApexCharts script on this page: "+(t&&t.message))}}else e.console.error("ApexCharts: dist/features/drilldown.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 e.console.warn("ApexCharts: dist/features/drilldown.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 t,e;t=this,e=function(t){"use strict";var e=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(t,i,r)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r,a=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&l(t,i,e[i]);if(s)for(var i of s(e))o.call(e,i)&&l(t,i,e[i]);return t},d=(t,e)=>i(t,r(e));const c=globalThis.ApexCharts,h=globalThis.ApexCharts.__internals.__apex_Utils,p=globalThis.ApexCharts.__internals.__apex_Environment_Environment,u=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs;function f(t,e,i,r){var s;const n=null==(s=null==e?void 0:e.dimensions)?void 0:s.dimHelpers,o=n?n.getTitleSubtitleCoords("title").height+n.getTitleSubtitleCoords("subtitle").height:0,l=i.getBoundingClientRect().height||18,a=r&&r.offsetY||0,d=function(t,e){const i=t.layout.translateY||0,r=t.dom.elWrap;if(!r)return i;const s=t.dom.baseEl.querySelectorAll(".apexcharts-yaxis-label");if(!s.length)return i;const n=r.getBoundingClientRect().top,o=e.getBoundingClientRect();let l=i;for(let t=0;t<s.length;t++){const e=s[t].getBoundingClientRect();e.height&&(e.left>=o.right||e.right<=o.left||(l=Math.min(l,e.top-n)))}return l}(t,i);if(d-o>=l+1)return i.style.top=`${d-l-1+a}px`,!0;i.style.top=`${o+a}px`;const c="dark"===t.config.theme.mode;return i.style.background=c?"rgba(20,24,30,0.82)":"rgba(255,255,255,0.86)",i.style.borderRadius="4px",!1}const w="http://www.w3.org/1999/xhtml";class g{constructor(t,e,i){this.w=t,this.ctx=e,this.drilldown=i}render(t){if(!p.isBrowser())return;const e=this.w,i=e.dom.elWrap;if(!i)return;const r=i.querySelector(".apexcharts-breadcrumb[aria-label^=Drill]");r&&r.parentNode&&r.parentNode.removeChild(r);const s=e.config.drilldown&&e.config.drilldown.breadcrumb;if(!s||!1===s.show)return;if(0===this.drilldown.depth)return;const n=u.createElementNS(w,"nav");n.setAttribute("class","apexcharts-breadcrumb"),n.setAttribute("aria-label","Drilldown breadcrumb"),this._position(n,s);const o=null!=s.separator?s.separator:" / ";t.forEach((e,i)=>{if(i>0){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-separator"),t.setAttribute("aria-hidden","true"),t.textContent=o,n.appendChild(t)}const r=this._label(e,i);if(i===t.length-1){const t=u.createElementNS(w,"span");t.setAttribute("class","apexcharts-breadcrumb-item apexcharts-breadcrumb-current"),t.setAttribute("aria-current","page"),t.textContent=r,n.appendChild(t)}else{const t=u.createElementNS(w,"button");if(t.setAttribute("type","button"),t.setAttribute("class","apexcharts-breadcrumb-item"),0===i){const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-arrow"),e.setAttribute("aria-hidden","true"),e.textContent="\u2190",t.appendChild(e)}const e=u.createElementNS(w,"span");e.setAttribute("class","apexcharts-breadcrumb-label"),e.textContent=r,t.appendChild(e),t.addEventListener("click",()=>this.drilldown.drillToLevel(i)),n.appendChild(t)}}),i.appendChild(n),this.w.globals.axisCharts&&f(this.w,this.ctx,n,s),this._avoidChromeOverlap(n)}_avoidChromeOverlap(t){const e=this.w,i=[".apexcharts-title-text",".apexcharts-subtitle-text"].map(t=>e.dom.baseEl.querySelector(t)).filter(t=>null!==t);if(!i.length)return;const r=e.dom.elWrap.getBoundingClientRect().top;for(let e=0;e<i.length+1;e++){const e=t.getBoundingClientRect(),s=i.find(t=>{const i=t.getBoundingClientRect();return e.left<i.right&&e.right>i.left&&e.top<i.bottom&&e.bottom>i.top});if(!s)break;t.style.top=s.getBoundingClientRect().bottom-r+4+"px"}}_label(t,e){const i=this.w.config.drilldown.breadcrumb;let r;if(0===e)r=null!=i.rootLabel?i.rootLabel:"All";else{const e=(this.w.config.drilldown.series||[]).find(e=>e&&e.id===t);r=e&&e.name||String(t)}return"function"==typeof i.formatter?i.formatter(r,{index:e,depth:this.drilldown.depth}):r}_position(t,e){const i=e.offsetX||0,r=e.offsetY||0;t.style.position="absolute",t.style.top=r+"px","top-right"===e.position?t.style.right=3-i+"px":t.style.left=i+"px"}}const x="http://www.w3.org/1999/xhtml",_="apexcharts-drilldown-loading";class m{constructor(t){this.w=t,this.el=null}_cfg(){const t=this.w.config.drilldown,e=t&&t.loading;return!1===e?{show:!1}:e||{}}show(){if(!p.isBrowser())return;const t=this._cfg();if(!1===t.show)return;const e=this.w.dom.elWrap;if(!e)return;this.hide();const i=u.createElementNS(x,"div");i.setAttribute("class",_),i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-label",t.text||"Loading");const r=u.createElementNS(x,"div");if(r.setAttribute("class",`${_}-spinner`),r.setAttribute("aria-hidden","true"),i.appendChild(r),t.text){const e=u.createElementNS(x,"span");e.setAttribute("class",`${_}-text`),e.textContent=t.text,i.appendChild(e)}e.appendChild(i),this.el=i}hide(){const t=this.w.dom.elWrap;if(t){const e=t.querySelectorAll(`.${_}`);for(let t=0;t<e.length;t++){const i=e[t];i.parentNode&&i.parentNode.removeChild(i)}}else this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el);this.el=null}}const b="__apexDrilldownMarker";c.registerFeatures({drilldown:class{constructor(t,e){this.w=t,this.ctx=e,this.stack=[],this.rootSnapshot=null,this._wired=!1,this._asyncCache=new Map,this._pending=null,this._warnedUnreachable=!1,this._warnedNoSliceOffset=!1,this.breadcrumb=new g(t,e,this),this.loading=new m(t),this._onPointSelect=this._onPointSelect.bind(this),this._afterRender=this._afterRender.bind(this),this._onPlotDown=this._onPlotDown.bind(this),this._onPlotClick=this._onPlotClick.bind(this),this._downAt=null,this._plotClickWired=null,this.init()}init(){const t=this.w;t.config.drilldown&&t.config.drilldown.enabled&&(this._wired||(this._wired=!0,this.ctx.addEventListener("dataPointSelection",this._onPointSelect),this.ctx.addEventListener("mounted",this._afterRender),this.ctx.addEventListener("updated",this._afterRender),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series))))}get path(){return["root",...this.stack.map(t=>t.id)]}get depth(){return this.stack.length}drillDown(t,e,i){const r=this._resolveChild(t);return r?this._drillInto(r,e,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(t,e,i):(console.warn(`ApexCharts: drilldown id "${t}" not found in chart.drilldown.series, and no onDrillDown resolver is set.`),Promise.resolve(this.ctx))}drillUp(){return this.drillToLevel(this.stack.length-1)}drillToRoot(){return this.drillToLevel(0)}drillToLevel(t){const e=this.stack.length;if(t<0||t>=e)return Promise.resolve(this.ctx);const i=this.path[this.path.length-1],r=0===t?this.rootSnapshot:this.stack[t].restore;this.stack=this.stack.slice(0,t);const s=this.path[this.path.length-1];return this._apply(this._viewFromSnapshot(r),"up",{from:i,to:s})}_resolveChild(t){const e=this.w.config.drilldown&&this.w.config.drilldown.series;return Array.isArray(e)&&e.find(e=>e&&e.id===t)||null}_drillInto(t,e,i){if(this.stack.length>=32)return console.warn("ApexCharts: drilldown max depth (32) reached."),Promise.resolve(this.ctx);this.rootSnapshot||(this.rootSnapshot=this._snapshot());const r=this.path[this.path.length-1],s={id:t.id,name:t.name,restore:this._snapshot()};return this.stack.push(s),this._apply(this._viewFromChild(t),"down",{from:r,to:t.id,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex}).catch(e=>{throw this.stack[this.stack.length-1]===s&&this.stack.pop(),this._fire("drillDownError",{id:t.id,error:e}),e})}_drillDownAsync(t,e,i){const r=this.w.config.drilldown.onDrillDown,s=this._cacheGet(t);if(s)return this._drillInto(s,e,i);if(this._pending)return this._pending;let n;this.loading.show();try{n=r({id:t,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex})}catch(e){return this.loading.hide(),this._fire("drillDownError",{id:t,error:e}),Promise.resolve(this.ctx)}const o=()=>{this._pending=null,this.loading.hide()},l=Promise.resolve(n).then(r=>{if(o(),this._isDead())return this.ctx;if(!r||!r.data)return this._fire("drillDownError",{id:t,error:new Error(`drilldown: onDrillDown resolved without a drillable level for id "${t}" (expected an object with a \`data\` array).`)}),this.ctx;const s=null!=r.id?r:d(a({},r),{id:t});return this._cacheSet(t,s),this._drillInto(s,e,i)},e=>(o(),this._isDead()||this._fire("drillDownError",{id:t,error:e}),this.ctx));return this._pending=l,l}_isDead(){const t=this.w;return!t||!t.globals||!0===t.globals.isDestroyed}_cacheEnabled(){const t=this.w.config.drilldown;return!(!t||!1===t.cache)}_cacheGet(t){return this._cacheEnabled()&&null!=t&&this._asyncCache.get(t)||null}_cacheSet(t,e){this._cacheEnabled()&&null!=t&&this._asyncCache.set(t,e)}clearCache(t){return null==t?this._asyncCache.clear():this._asyncCache.delete(t),this.ctx}_snapshot(){const t=this.w.config,e=this._overrideFields(),i={series:this._uncollapseSeries(h.clone(t.series))};return Array.isArray(t.labels)&&t.labels.length&&(i.labels=h.clone(t.labels)),i.chart={type:t.chart.type,stacked:t.chart.stacked},e.has("xaxis")&&(i.xaxis=h.clone(t.xaxis)),e.has("yaxis")&&(i.yaxis=h.clone(t.yaxis)),e.has("colors")&&(i.colors=t.colors?h.clone(t.colors):void 0),e.has("plotOptions")&&(i.plotOptions=h.clone(t.plotOptions)),e.has("fill")&&(i.fill=h.clone(t.fill)),e.has("legend")&&(i.legend=h.clone(t.legend)),i}_uncollapseSeries(t){const e=this.w,i=e.globals,r=[...i.collapsedSeries||[],...i.ancillaryCollapsedSeries||[]];if(!r.length)return t;const s=e.config.chart.type,n=("pie"===s||"donut"===s||"polarArea"===s)&&1===t.length&&t[0]&&"object"==typeof t[0]&&Array.isArray(t[0].data)?t[0].data:t;for(const e of r){const r=e.index;i.axisCharts?t[r]&&(t[r].data=Array.isArray(e.data)?e.data.slice():e.data):n[r]&&"object"==typeof n[r]?n[r].y=e.data:void 0!==n[r]&&(n[r]=e.data)}return t}_overrideFields(){const t=new Set,e=this.w.config.drilldown&&this.w.config.drilldown.series||[];for(const i of e)i&&(i.xaxis&&t.add("xaxis"),i.yaxis&&t.add("yaxis"),i.colors&&t.add("colors"),i.plotOptions&&t.add("plotOptions"),i.fill&&t.add("fill"),i.legend&&t.add("legend"));return t}_copyOptionalViewFields(t,e){e.xaxis&&(t.xaxis=e.xaxis),e.yaxis&&(t.yaxis=e.yaxis),e.colors&&(t.colors=e.colors),e.plotOptions&&(t.plotOptions=e.plotOptions),e.fill&&(t.fill=e.fill),e.legend&&(t.legend=e.legend)}_viewFromChild(t){const e={};Array.isArray(t.series)?e.series=t.series:e.series=[{name:t.name||"",data:t.data}];const i={};return t.chart&&t.chart.type&&(i.type=t.chart.type),t.chart&&null!=t.chart.stacked&&(i.stacked=t.chart.stacked),Object.keys(i).length&&(e.chart=i),this._copyOptionalViewFields(e,t),e}_viewFromSnapshot(t){const e={series:t.series,chart:t.chart};return t.labels&&t.labels.length&&(e.labels=t.labels),this._copyOptionalViewFields(e,t),e}_apply(t,e,i){var r;const s=this.w;s.interact.selectedDataPoints=[],s.globals.collapsedSeries=[],s.globals.collapsedSeriesIndices=[],s.globals.ancillaryCollapsedSeries=[],s.globals.ancillaryCollapsedSeriesIndices=[],s.globals.allSeriesCollapsed=!1,s.globals.risingSeries=[],t.markers=d(a({},t.markers||{}),{discrete:this._drillMarkers(t.series)});const n=(!s.config.drilldown.animation||!1!==s.config.drilldown.animation.enabled)&&!1!==s.config.chart.animations.enabled;"down"===e&&this._fire("drillDownStart",i),null==(r=this.ctx.highlightFilter)||r.drillView(t);const o=e=>this.ctx.updateOptions(t,!1,e,!1,!1),l=()=>(this._fire("down"===e?"drillDownEnd":"drillUp",i),this.ctx);if(n&&this._zoomEnabled()){const t=this._triggerOrigin(i);if(t)return this._zoomDrill(t,e,()=>o(!1)).then(l)}return o(n).then(l)}_zoomEnabled(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation;return!(!t||!t.zoomFromPoint)}_svgNode(){const t=this.w.dom&&this.w.dom.Paper;return t&&t.node?t.node:null}_markGroup(){const t=this._svgNode();return t&&"function"==typeof t.querySelector?t.querySelector(".apexcharts-plot-series, .apexcharts-heatmap, .apexcharts-treemap"):null}_triggerOrigin(t){if(!p.isBrowser())return null;const e=this._svgNode(),i=this._markGroup();if(!e||!i||"function"!=typeof i.animate||"function"!=typeof e.getBoundingClientRect)return null;const r=e.getBoundingClientRect();let s=null;if(t&&null!=t.seriesIndex&&null!=t.dataPointIndex&&this.w.dom.baseEl&&(s=this.w.dom.baseEl.querySelector(`[index="${t.seriesIndex}"][j="${t.dataPointIndex}"]`)),s&&"function"==typeof s.getBoundingClientRect){const t=s.getBoundingClientRect();return{x:t.left+t.width/2-r.left,y:t.top+t.height/2-r.top}}const n=i.getBoundingClientRect();return{x:n.left+n.width/2-r.left,y:n.top+n.height/2-r.top}}_zoomDrill(t,e,i){return r=this,s=null,n=function*(){const r=this._zoomDuration(),s="down"===e,n=Math.round(.55*r),o=s?"scale(1.03)":"scale(0.97)",l=s?"scaleX(0.55) scaleY(0.85)":"scale(1.04)",a=e=>{e.style.transformBox="view-box",e.style.transformOrigin=`${t.x}px ${t.y}px`},d=this._markGroup();let c=null;if(d){a(d),c=d.animate([{transform:"scale(1)",opacity:1},{transform:o,opacity:0}],{duration:n,easing:"ease-in",fill:"forwards"});try{yield c.finished}catch(t){}}yield i();const h=this._markGroup();if(h){a(h),h.style.opacity="0",h.style.transform=l,c&&d===h&&c.cancel();const t=h.animate([{transform:l,opacity:0},{transform:"scale(1)",opacity:1}],{duration:r,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"});try{yield t.finished}catch(t){}(p=h).style.transform="",p.style.opacity="",p.style.transformOrigin="",p.style.transformBox="",t.cancel()}var p},new Promise((t,e)=>{var i=t=>{try{l(n.next(t))}catch(t){e(t)}},o=t=>{try{l(n.throw(t))}catch(t){e(t)}},l=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,o);l((n=n.apply(r,s)).next())});var r,s,n}_zoomDuration(){const t=this.w.config.drilldown&&this.w.config.drilldown.animation,e=t&&"number"==typeof t.speed?t.speed:260;return Math.max(80,e)}_fire(t,e){const i=this.w.config.chart.events&&this.w.config.chart.events[t];"function"==typeof i&&i(e,this.ctx,this.w),this.ctx.events.fireEvent(t,[e,this.ctx,this.w])}_onPointSelect(t,e,i){if(!i||this._retired())return;const r=this._pointAt(i.seriesIndex,i.dataPointIndex);return r&&"object"==typeof r&&null!=r.drilldown?this.drillDown(r.drilldown,r,i):"function"==typeof this.w.config.drilldown.onDrillDown?this._drillDownAsync(null,r,i):void 0}_pointAt(t,e){const i=this.w.config.series;if(!Array.isArray(i)||null==t||null==e)return null;const r=i[t];return r&&Array.isArray(r.data)&&null!=r.data[e]?r.data[e]:null}_retired(){return this.ctx.drilldown!==this&&(Promise.resolve().then(()=>{const t=this.ctx.events;t&&(t.removeEventListener("dataPointSelection",this._onPointSelect),t.removeEventListener("mounted",this._afterRender),t.removeEventListener("updated",this._afterRender))}),!0)}_afterRender(){const t=this.w;this._retired()||t.config.drilldown&&t.config.drilldown.enabled&&(this._markDrillableTargets(),this._wirePlotClick(),this.breadcrumb.render(this.path),t.config.markers&&(t.config.markers.discrete=this._drillMarkers(t.config.series)))}_markDrillableTargets(){if(!p.isBrowser())return;const t=this.w,e=t.dom.baseEl,i=t.config.series;if(!e||!Array.isArray(i))return;let r=0;i.forEach((t,i)=>{const s=t&&Array.isArray(t.data)?t.data:null;s&&s.forEach((t,s)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const n=e.querySelectorAll(`[index="${i}"][j="${s}"]`);n.length||r++,n.forEach(t=>{this._isClickThroughMark(t)&&t.classList.remove("no-pointer-events"),t.classList.add("apexcharts-drilldown-target")})})}),r&&!this._warnedUnreachable&&(this._warnedUnreachable=!0,console.warn(`ApexCharts: ${r} drillable point(s) have no clickable mark, so clicking them cannot do anything. Leave \`drilldown.marker\` on, or give the series markers of its own (\`markers.size > 0\`).`))}warnSliceOffsetDisabled(){this._warnedNoSliceOffset||(this._warnedNoSliceOffset=!0,console.warn("ApexCharts: `plotOptions.pie.expandOnClick` is not available in a drilldown pie/donut, so it was ignored. A slice click navigates, and a slice that slid out would be discarded by the drill it just triggered."))}_wirePlotClick(){if(!p.isBrowser())return;const t=this.w.dom.baseEl;t&&this._plotClickWired!==t&&(this._plotClickWired&&(this._plotClickWired.removeEventListener("mousedown",this._onPlotDown),this._plotClickWired.removeEventListener("click",this._onPlotClick)),t.addEventListener("mousedown",this._onPlotDown),t.addEventListener("click",this._onPlotClick),this._plotClickWired=t)}_onPlotDown(t){this._downAt={x:t.clientX,y:t.clientY}}_onPlotClick(t){const e=this.w;if(!e.config.drilldown||!e.config.drilldown.enabled)return;const i=this._downAt;if(this._downAt=null,i&&Math.hypot(t.clientX-i.x,t.clientY-i.y)>4)return;const r=t.target;if(!r||"function"!=typeof r.closest)return;if(r.closest(".apexcharts-drilldown-target"))return;if(r.closest(".apexcharts-legend, .apexcharts-toolbar, .apexcharts-breadcrumb, .apexcharts-menu, .apexcharts-tooltip"))return;const s=e.interact.capturedSeriesIndex,n=e.interact.capturedDataPointIndex;if(null==s||null==n||s<0||n<0)return;if(!this._isPointBasedSeries(e.config.series[s]))return;const o=this._pointAt(s,n);return o&&"object"==typeof o&&null!=o.drilldown?this.drillDown(o.drilldown,o,{seriesIndex:s,dataPointIndex:n}):void 0}_isClickThroughMark(t){return!(!t.classList||!t.classList.contains("no-pointer-events")||!t.classList.contains("apexcharts-marker")||"function"==typeof t.closest&&t.closest(".apexcharts-tooltip"))}_drillMarkers(t){const e=this.w,i=e.config.drilldown,r=Array.isArray(e.config.markers&&e.config.markers.discrete)?e.config.markers.discrete.filter(t=>!t||!t[b]):[],s=i&&i.marker||{};if(!1===s.show||!Array.isArray(t))return r;const n=[];return t.forEach((t,e)=>{if(!this._seriesNeedsDrillMarker(e,t))return;const i=t&&Array.isArray(t.data)?t.data:null;i&&i.forEach((t,i)=>{if(!t||"object"!=typeof t||null==t.drilldown)return;const r={seriesIndex:e,dataPointIndex:i,[b]:!0};void 0!==s.size&&(r.size=s.size),void 0!==s.shape&&(r.shape=s.shape),void 0!==s.fillColor&&(r.fillColor=s.fillColor),void 0!==s.strokeColor&&(r.strokeColor=s.strokeColor),n.push(r)})}),r.concat(n)}_seriesNeedsDrillMarker(t,e){if(!this._isPointBasedSeries(e))return!1;const i=this.w.config.markers&&this.w.config.markers.size,r=Array.isArray(i)?i[t]:i;return!(Number(r)>0)}_isPointBasedSeries(t){const e=t&&t.type||this.w.config.chart.type;return"line"===e||"area"===e}}}),t.default=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexDrilldown={})});
|
|
@@ -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,r=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(r,t,n)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,o=(e,r)=>{for(var t in r||(r={}))l.call(r,t)&&s(e,t,r[t]);if(n)for(var t of n(r))a.call(r,t)&&s(e,t,r[t]);return e},i=(e,n)=>r(e,t(n));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function u(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}return r.default=e,Object.freeze(r)}const c=u(require("apexcharts/core")),d=c.__apex_Utils;function f(e,r){const t=(r.collapsedSeries||[]).concat(r.ancillaryCollapsedSeries||[]);return e.map((e,r)=>{const s=e||{},{hidden:u}=s,c=((e,r)=>{var t={};for(var s in e)l.call(e,s)&&r.indexOf(s)<0&&(t[s]=e[s]);if(null!=e&&n)for(var s of n(e))r.indexOf(s)<0&&a.call(e,s)&&(t[s]=e[s]);return t})(s,["hidden"]);let d=c.data;if(Array.isArray(d)&&!d.length){const e=t.find(e=>e.index===r);e&&Array.isArray(e.data)&&(d=e.data)}return i(o({},c),{data:Array.isArray(d)?d.slice():d})})}function p(e,r,t){const n=t&&void 0!==t[r]?t[r]:r+1;return null==e?{x:n,y:null,rest:{}}:Array.isArray(e)?{x:void 0!==e[0]?e[0]:n,y:e[1],rest:{}}:"object"==typeof e?{x:void 0!==e.x?e.x:n,y:e.y,rest:e}:{x:n,y:e,rest:{}}}function y(e,r){var t;const n=r.config,l=r.globals;if(!Array.isArray(e))return e;l.dumbbellRawSeries||(l.dumbbellRawSeries=f(e,l));const a=l.dumbbellRawSeries,s=a.some(e=>function(e){for(let r=0;r<e.length;r++){const t=e[r],n=Array.isArray(t)?t[1]:t&&"object"==typeof t?t.y:t;if(Array.isArray(n)&&2===n.length)return!0}return!1}(Array.isArray(null==e?void 0:e.data)?e.data:[]));if(s)return r.dumbbellData={form:"pairs",names:[],values:[],order:[],carrier:0,hidden:[]},e;const u=null==(t=n.xaxis)?void 0:t.categories,c=function(e){return(e.collapsedSeriesIndices||[]).concat(e.ancillaryCollapsedSeriesIndices||[])}(l),{xs:y,rows:b,byX:h}=function(e,r){var t;const n=[],l=[],a=new Map,s=[];for(let i=0;i<e.length;i++){const u=Array.isArray(null==(t=e[i])?void 0:t.data)?e[i].data:[],c=new Map;for(let e=0;e<u.length;e++){const{x:t,y:s,rest:i}=p(u[e],e,r),f=t instanceof Date?t.getTime():t;a.has(f)||(a.set(f,n.length),n.push(t),l.push(o({},i)));const y=a.get(f);c.set(y,d.parseNumber(s))}s.push(c)}return{xs:n,rows:l,byX:s}}(a,u),g=[],m=[],x=[];for(let e=0;e<a.length;e++)-1===c.indexOf(e)&&x.push(e);const v=[];for(let e=0;e<y.length;e++){const r=[];for(let t=0;t<a.length;t++){const n=h[t].has(e)?h[t].get(e):null;r.push(null!=n&&isFinite(n)?n:null)}g.push(r);let t=null,n=null,l=-1,s=-1;for(let e=0;e<x.length;e++){const a=x[e],o=r[a];null!==o&&((null===t||o<t)&&(t=o,l=a),(null===n||o>n)&&(n=o,s=a))}null!==t&&null!==n?(m.push([l,s]),v.push(i(o({},b[e]),{x:y[e],y:[t,n]}))):(m.push(null),v.push(i(o({},b[e]),{x:y[e],y:null})))}r.dumbbellData={form:"series",names:a.map((e,r)=>{var t;return null!=(t=null==e?void 0:e.name)?t:`Series ${r+1}`}),values:g,order:m,carrier:x.length?x[0]:0,hidden:a.map((e,r)=>r).filter(e=>-1!==c.indexOf(e))};const O=r.dumbbellData.carrier;return a.map((e,r)=>i(o({},e),{data:r===O&&x.length?v:[]}))}const b="__apexcharts_series_transforms__";var h,g;globalThis[b]||(globalThis[b]={}),h="dumbbell","function"==typeof(g=y)?globalThis[b][h]=g:console.warn(`ApexCharts: registerSeriesTransform("${h}") expects a function (series, w) => series.`),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>c.default}),exports.dumbbellTransform=y;
|
|
@@ -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 r="undefined"!=typeof globalThis?globalThis:self,t=r.ApexCharts;if(t&&t.__internals)return e.call(r);if(t)throw new Error("ApexCharts: dist/features/dumbbell.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(r);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/features/dumbbell.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/dumbbell.js",run:e,done:!1},a=r.__apexcharts_pending_addons__||(r.__apexcharts_pending_addons__=[]);a.push(s),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!s.done){var t=r.ApexCharts;if(t)if(t.__internals){s.done=!0;var n=a.indexOf(s);-1!==n&&a.splice(n,1);try{e.call(r),t.__drainsAddons||r.console.warn("ApexCharts: dist/features/dumbbell.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){r.console.error("ApexCharts: dist/features/dumbbell.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else r.console.error("ApexCharts: dist/features/dumbbell.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 r.console.warn("ApexCharts: dist/features/dumbbell.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,r;e=this,r=function(e){"use strict";var r=Object.defineProperty,t=Object.defineProperties,s=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(e,t,s)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,i=(e,r)=>{for(var t in r||(r={}))n.call(r,t)&&l(e,t,r[t]);if(a)for(var t of a(r))o.call(r,t)&&l(e,t,r[t]);return e},d=(e,r)=>t(e,s(r));const c=globalThis.ApexCharts,u=globalThis.ApexCharts.__internals.__apex_Utils;function p(e,r){const t=(r.collapsedSeries||[]).concat(r.ancillaryCollapsedSeries||[]);return e.map((e,r)=>{const s=e||{},{hidden:l}=s,c=((e,r)=>{var t={};for(var s in e)n.call(e,s)&&r.indexOf(s)<0&&(t[s]=e[s]);if(null!=e&&a)for(var s of a(e))r.indexOf(s)<0&&o.call(e,s)&&(t[s]=e[s]);return t})(s,["hidden"]);let u=c.data;if(Array.isArray(u)&&!u.length){const e=t.find(e=>e.index===r);e&&Array.isArray(e.data)&&(u=e.data)}return d(i({},c),{data:Array.isArray(u)?u.slice():u})})}function h(e,r,t){const s=t&&void 0!==t[r]?t[r]:r+1;return null==e?{x:s,y:null,rest:{}}:Array.isArray(e)?{x:void 0!==e[0]?e[0]:s,y:e[1],rest:{}}:"object"==typeof e?{x:void 0!==e.x?e.x:s,y:e.y,rest:e}:{x:s,y:e,rest:{}}}function f(e,r){var t;const s=r.config,a=r.globals;if(!Array.isArray(e))return e;a.dumbbellRawSeries||(a.dumbbellRawSeries=p(e,a));const n=a.dumbbellRawSeries,o=n.some(e=>function(e){for(let r=0;r<e.length;r++){const t=e[r],s=Array.isArray(t)?t[1]:t&&"object"==typeof t?t.y:t;if(Array.isArray(s)&&2===s.length)return!0}return!1}(Array.isArray(null==e?void 0:e.data)?e.data:[]));if(o)return r.dumbbellData={form:"pairs",names:[],values:[],order:[],carrier:0,hidden:[]},e;const l=null==(t=s.xaxis)?void 0:t.categories,c=function(e){return(e.collapsedSeriesIndices||[]).concat(e.ancillaryCollapsedSeriesIndices||[])}(a),{xs:f,rows:b,byX:x}=function(e,r){var t;const s=[],a=[],n=new Map,o=[];for(let l=0;l<e.length;l++){const d=Array.isArray(null==(t=e[l])?void 0:t.data)?e[l].data:[],c=new Map;for(let e=0;e<d.length;e++){const{x:t,y:o,rest:l}=h(d[e],e,r),p=t instanceof Date?t.getTime():t;n.has(p)||(n.set(p,s.length),s.push(t),a.push(i({},l)));const f=n.get(p);c.set(f,u.parseNumber(o))}o.push(c)}return{xs:s,rows:a,byX:o}}(n,l),y=[],g=[],m=[];for(let e=0;e<n.length;e++)-1===c.indexOf(e)&&m.push(e);const A=[];for(let e=0;e<f.length;e++){const r=[];for(let t=0;t<n.length;t++){const s=x[t].has(e)?x[t].get(e):null;r.push(null!=s&&isFinite(s)?s:null)}y.push(r);let t=null,s=null,a=-1,o=-1;for(let e=0;e<m.length;e++){const n=m[e],l=r[n];null!==l&&((null===t||l<t)&&(t=l,a=n),(null===s||l>s)&&(s=l,o=n))}null!==t&&null!==s?(g.push([a,o]),A.push(d(i({},b[e]),{x:f[e],y:[t,s]}))):(g.push(null),A.push(d(i({},b[e]),{x:f[e],y:null})))}r.dumbbellData={form:"series",names:n.map((e,r)=>{var t;return null!=(t=null==e?void 0:e.name)?t:`Series ${r+1}`}),values:y,order:g,carrier:m.length?m[0]:0,hidden:n.map((e,r)=>r).filter(e=>-1!==c.indexOf(e))};const _=r.dumbbellData.carrier;return n.map((e,r)=>d(i({},e),{data:r===_&&m.length?A:[]}))}const b="__apexcharts_series_transforms__";var x,y;globalThis[b]||(globalThis[b]={}),x="dumbbell","function"==typeof(y=f)?globalThis[b][x]=y:console.warn(`ApexCharts: registerSeriesTransform("${x}") expects a function (series, w) => series.`),e.default=c,e.dumbbellTransform=f,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).ApexDumbbell={})});
|
|
@@ -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 s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const t=e(require("apexcharts/core")),r=t.__apex_axes_AxesUtils,s=t.__apex_Series,a=t.__apex_Utils,i=t.__apex_Environment_Environment,n=t.__apex_BrowserAPIs_BrowserAPIs,l=t.__apex_math_SVGNS;t.default.registerFeatures({exports:class{constructor(e,t){this.w=e,this.ctx=t}svgStringToNode(e){return(new DOMParser).parseFromString(e,"image/svg+xml").documentElement}scaleSvgNode(e,t){const r=parseFloat(e.getAttributeNS(null,"width")),s=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",r*t),e.setAttributeNS(null,"height",s*t),e.setAttributeNS(null,"viewBox","0 0 "+r+" "+s)}inlineCanvasLayers(e){const t=this.w.dom.elWrap.querySelectorAll(".apexcharts-series-canvas");if(!t.length)return;const r=e.querySelectorAll(".apexcharts-canvas-series");for(let e=0;e<t.length&&e<r.length;e++){let s;try{s=t[e].toDataURL()}catch(e){continue}const a=r[e],i=document.createElementNS(l,"image");i.setAttribute("x",a.getAttribute("x")||"0"),i.setAttribute("y",a.getAttribute("y")||"0"),i.setAttribute("width",a.getAttribute("width")||"0"),i.setAttribute("height",a.getAttribute("height")||"0"),i.setAttribute("href",s),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),a.parentNode&&a.parentNode.replaceChild(i,a)}}queryStyleable(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))}setStyleDefaults(e,t){Object.keys(t).forEach(r=>{""===e.style.getPropertyValue(r)&&e.style.setProperty(r,t[r])})}applyExportStyles(e){const t=this.w;this.queryStyleable(e,"style").forEach(e=>e.remove()),this.queryStyleable(e,[".apexcharts-tooltip",".apexcharts-toolbar",".apexcharts-xaxistooltip",".apexcharts-yaxistooltip",".apexcharts-xcrosshairs",".apexcharts-ycrosshairs",".apexcharts-zoom-rect",".apexcharts-selection-rect"].join(", ")).forEach(e=>{e.style.setProperty("display","none","important")}),this.queryStyleable(e,".apexcharts-flip-y").forEach(e=>{this.setStyleDefaults(e,{transform:"scaleY(-1) translateY(-100%)","transform-origin":"top","transform-box":"fill-box"})}),this.queryStyleable(e,".apexcharts-flip-x").forEach(e=>{this.setStyleDefaults(e,{transform:"scaleX(-1)","transform-origin":"center","transform-box":"fill-box"})}),t.config.legend.show&&t.dom.elLegendWrap&&t.dom.elLegendWrap.children.length&&(this.queryStyleable(e,".apexcharts-legend").forEach(e=>{this.setStyleDefaults(e,{display:"flex",overflow:"auto",padding:"0 10px"});const t=e.classList,r=t.contains("apx-legend-position-left")||t.contains("apx-legend-position-right"),s=t.contains("apx-legend-position-top")||t.contains("apx-legend-position-bottom");t.contains("apexcharts-legend-group-horizontal")&&this.setStyleDefaults(e,{"flex-direction":"column"}),r&&this.setStyleDefaults(e,{"flex-direction":"column",bottom:"0"}),s&&this.setStyleDefaults(e,{"flex-wrap":"wrap"}),r||s&&t.contains("apexcharts-align-left")?this.setStyleDefaults(e,{"justify-content":"flex-start","align-items":"flex-start"}):s&&t.contains("apexcharts-align-center")?this.setStyleDefaults(e,{"justify-content":"center","align-items":"center"}):s&&t.contains("apexcharts-align-right")&&this.setStyleDefaults(e,{"justify-content":"flex-end","align-items":"flex-end"})}),this.queryStyleable(e,".apexcharts-legend-group").forEach(e=>{this.setStyleDefaults(e,{display:"flex"})}),this.queryStyleable(e,".apexcharts-legend-group-vertical").forEach(e=>{this.setStyleDefaults(e,{"flex-direction":"column-reverse"})}),this.queryStyleable(e,".apexcharts-legend-series").forEach(e=>{this.setStyleDefaults(e,{cursor:e.classList.contains("apexcharts-no-click")?"auto":"pointer","line-height":"normal",display:"flex","align-items":"center"})}),this.queryStyleable(e,".apexcharts-legend-text").forEach(e=>{this.setStyleDefaults(e,{position:"relative","font-size":"14px"})}),this.queryStyleable(e,".apexcharts-legend-marker").forEach(e=>{this.setStyleDefaults(e,{position:"relative",display:"flex","align-items":"center","justify-content":"center",cursor:"pointer","margin-right":"1px"})}),this.queryStyleable(e,".apexcharts-inactive-legend").forEach(e=>{this.setStyleDefaults(e,{opacity:"0.45"})}),this.queryStyleable(e,".apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series").forEach(e=>{e.style.setProperty("display","none","important")}))}resolveExportBackground(){const e=this.w,t=e.config.chart.background;return t&&"transparent"!==t?t:"dark"===e.config.theme.mode?"#343A3F":"#fff"}collectFontFamilies(){const e=new Set,t=this.w;if(!i.isBrowser()||!t.dom.elWrap)return e;const r=this.queryStyleable(t.dom.elWrap,"text, tspan, .apexcharts-legend-text, .apexcharts-title-text, .apexcharts-subtitle-text");return[t.dom.elWrap,...r].forEach(t=>{const r=n.getComputedStyle(t),s=r&&r.fontFamily;s&&s.split(",").forEach(t=>{const r=t.trim().replace(/^['"]|['"]$/g,"");r&&e.add(r.toLowerCase())})}),e}collectFontFaceRules(){if(!i.isBrowser())return Promise.resolve([]);const e=[],t=[],r=(t,r)=>{(t.match(/@font-face\s*\{[^}]*\}/gi)||[]).forEach(t=>{const s=t.match(/font-family\s*:\s*([^;}]+)/i);if(!s)return;const a=s[1].trim().replace(/^['"]|['"]$/g,"");e.push({family:a.toLowerCase(),css:t,base:r})})},s=(e,t)=>{Array.from(e).forEach(e=>{5===e.type?e.cssText&&r(e.cssText,t):e.styleSheet?a(e.styleSheet):e.cssRules&&s(e.cssRules,t)})},a=e=>{let a=null;try{a=e.cssRules}catch(e){}a?s(a,e.href||document.baseURI):e.href&&t.push(fetch(e.href).then(e=>e.ok?e.text():"").then(t=>r(t,e.href)).catch(()=>{}))};return Array.from(document.styleSheets||[]).forEach(a),Promise.all(t).then(()=>e)}embedFonts(e){const t=this.w;if(!i.isBrowser()||!t.config.chart.toolbar.export.embedFonts||"function"!=typeof fetch)return Promise.resolve();const r=this.collectFontFamilies();return r.size?this.collectFontFaceRules().then(e=>{const t=e.filter(e=>r.has(e.family));return t.length?Promise.all(t.map(e=>this.inlineFontFaceUrls(e.css,e.base).catch(()=>null))):Promise.resolve([])}).then(t=>{const r=(t||[]).filter(Boolean).join("\n");if(!r)return;const s=document.createElementNS(l,"style");s.textContent=r,e.insertBefore(s,e.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(e,t){const r=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let a;for(;null!==(a=s.exec(e));)a[2].startsWith("data:")||r.push(a[2]);return r.length?Promise.all(r.map(e=>this.fetchAsDataUri(t?new URL(e,t).href:e).then(t=>({url:e,dataUri:t})).catch(()=>({url:e,dataUri:null})))).then(t=>{let r=e,s=0;return t.forEach(({url:e,dataUri:t})=>{t&&(r=r.split(e).join(t),s++)}),s?r:null}):Promise.resolve(e.includes("data:")?e:null)}fetchAsDataUri(e){return"function"!=typeof fetch||"function"!=typeof btoa?Promise.reject(new Error("fetch unavailable")):fetch(e).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);const r=t.headers.get("content-type")||"application/octet-stream";return t.arrayBuffer().then(e=>{const t=new Uint8Array(e);let s="";for(let e=0;e<t.length;e+=32768)s+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${r};base64,${btoa(s)}`})})}getSvgString(e){return new Promise(t=>{var r,s,a;const i=this.w;let n=e||i.config.chart.toolbar.export.scale||i.config.chart.toolbar.export.width/i.globals.svgWidth;n||(n=1);const l=i.globals.svgWidth*n,o=i.globals.svgHeight*n;null==(r=i.globals.layoutTween)||r.finish(),null==(s=i.globals.circleTween)||s.finish(),null==(a=i.globals.highlightTween)||a.finish(),[...i.globals.chromeTweens||[]].forEach(e=>e());const c=i.dom.elWrap.cloneNode(!0);c.style.width=l+"px",c.style.height=o+"px",this.inlineCanvasLayers(c),this.applyExportStyles(c);const h=(new XMLSerializer).serializeToString(c);let g=`\n <svg xmlns="http://www.w3.org/2000/svg"\n version="1.1"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n class="apexcharts-svg"\n xmlns:data="ApexChartsNS"\n transform="translate(0, 0)"\n width="${i.globals.svgWidth}px" height="${i.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${l}px; height:${o}px;">\n ${h}\n </div>\n </foreignObject>\n </svg>\n `;const u=this.svgStringToNode(g);1!==n&&this.scaleSvgNode(u,n),Promise.all([this.convertImagesToBase64(u),this.embedFonts(u)]).then(()=>{g=(new XMLSerializer).serializeToString(u),t(g.replace(/ /g," "))})})}convertImagesToBase64(e){const t="http://www.w3.org/1999/xlink",r=e.getElementsByTagName("image"),s=Array.from(r).map(e=>{const r=e.getAttributeNS(t,"href"),s=e.getAttribute("href"),a=r||s;if(!a||a.startsWith("data:"))return Promise.resolve();const i=a=>{r&&e.setAttributeNS(t,"href",a),!s&&r||e.setAttribute("href",a)};return this.fetchAsDataUri(a).then(i).catch(()=>this.getBase64FromUrl(a).then(i).catch(e=>{console.error("Error converting image to base64:",e)}))});return Promise.all(s)}getBase64FromUrl(e){return i.isSSR()?Promise.resolve(e):new Promise((t,r)=>{const s=new Image;s.crossOrigin="Anonymous",s.onload=()=>{const e=document.createElement("canvas");e.width=s.width,e.height=s.height;const r=e.getContext("2d");r&&r.drawImage(s,0,0),t(e.toDataURL())},s.onerror=r,s.src=e})}svgUrl(){return new Promise(e=>{this.getSvgString().then(t=>{const r=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(r))})})}dataURI(e){return i.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const r=this.w,s=()=>{console.warn("ApexCharts: the PNG export could not be rendered"),t({imgURI:""})},a=e?e.scale||e.width/r.globals.svgWidth:1,i=document.createElement("canvas");i.width=r.globals.svgWidth*a,i.height=parseInt(r.dom.elWrap.style.height,10)*a;const n=this.resolveExportBackground(),l=i.getContext("2d");if(!l)return s();l.fillStyle=n,l.fillRect(0,0,i.width,i.height),this.getSvgString(a).then(e=>{const r="data:image/svg+xml,"+encodeURIComponent(e),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{try{l.drawImage(a,0,0);const e=i;if(e.msToBlob){const r=e.msToBlob();t({blob:r})}else{const e=i.toDataURL("image/png");t({imgURI:e})}}catch(e){s()}},a.onerror=s,a.src=r}).catch(s)})}exportToSVG(){this.svgUrl().then(e=>{this.triggerDownload(e,this.w.config.chart.toolbar.export.svg.filename,".svg")})}exportToPng(){const e=this.w.config.chart.toolbar.export.scale,t=this.w.config.chart.toolbar.export.width,r=e?{scale:e}:t?{width:t}:void 0;this.dataURI(r).then(({imgURI:e,blob:t})=>{t?navigator.msSaveOrOpenBlob(t,this.w.globals.chartID+".png"):e&&this.triggerDownload(e,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:e,fileName:t,columnDelimiter:i=",",lineDelimiter:n="\n"}){const l=this.w,o=l.globals,c=l.config.chart.toolbar.export.csv,h=!e&&(o.streamgraphRawSeries||o.waterfallRawSeries||o.dumbbellRawSeries);e||(e=h||l.config.series);const g=new Set(h&&h===o.dumbbellRawSeries?l.dumbbellData.hidden:o.collapsedSeriesIndices),u=[],f=[],p="datetime"===l.config.xaxis.type,m=l.config.xaxis.labels.datetimeUTC,d=e=>{if(null==e||a.isNumber(e))return e;const t=String(e);return/^[=+\-@\t\r]/.test(t)&&isNaN(+t)?`'${t}`:t},x=e=>p&&String(e).length>=10&&!isNaN(new Date(e).getTime()),y=(e,t)=>{const r=new Date(e);if(m||r.setTime(r.getTime()-6e4*r.getTimezoneOffset()),t)return r.toISOString().slice(0,23).replace("T"," ").replace(".000","");const[s,a,i,n]=r.toUTCString().split(" ");return`${s.slice(0,3)} ${i} ${a} ${n}`},b=(e,t)=>"function"==typeof c.categoryFormatter?c.categoryFormatter(e):null==e?"":x(e)?y(e,t):a.isNumber(e)?e:d(String(e).split(i).join("")),w=e=>"function"==typeof c.valueFormatter?c.valueFormatter(e):d(e),S=new r(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),v=e=>{let t="";if(o.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(o.isBarHorizontal){const r=l.formatters.yLabelFormatters[0],a=new s(this.ctx.w).getActiveConfigSeriesIndex();t=r(l.labelData.labels[e],{seriesIndex:a,dataPointIndex:e,w:l})}else t=S.getLabel(l.labelData.labels,l.labelData.timescaleLabels,0,e).text;p&&(l.config.xaxis.categories.length?t=l.config.xaxis.categories[e]:l.config.labels.length&&(t=l.config.labels[e]))}else t=l.config.labels[e];return Array.isArray(t)?t.join(" "):t},A=l.candleData,D=l.rangeData,E=l.violinData,C=e.length>1,P=e.map((e,t)=>{const r=h?"":e.type||l.config.chart.type,s="candlestick"===r?{open:A.seriesCandleO,high:A.seriesCandleH,low:A.seriesCandleL,close:A.seriesCandleC}:"boxPlot"===r?{minimum:A.seriesCandleO,q1:A.seriesCandleH,median:A.seriesCandleM,q3:A.seriesCandleL,maximum:A.seriesCandleC}:"rangeBar"===r||"rangeArea"===r?{minimum:D.seriesRangeStart,maximum:D.seriesRangeEnd}:"violin"===r?{minimum:E.seriesViolinMin,maximum:E.seriesViolinMax,observations:E.seriesViolinPoints}:null,a=String(e.name||`series-${t}`).split(i).join("")||`series-${t}`,n=s?Object.keys(s):[a];return{head:s&&C?n.map(e=>`${a} ${e}`):n,cells:r=>{var a;const i=g.has(t);if(!s){const t=i||null==(a=e.data)?void 0:a[r];return[w(t&&"object"==typeof t?Array.isArray(t)?t[1]:t.y:t)]}return Object.values(s).map(e=>{var s;const a=i||null==(s=null==e?void 0:e[t])?void 0:s[r];return w(Array.isArray(a)?a.length:a)})}}});if(o.axisCharts)if(u.push([c.headerCategory,...P.flatMap(e=>e.head)].join(i)),o.allSeriesHasEqualX||l.config.xaxis.categories.length||l.config.labels.length){const t=Math.max(0,...e.map(e=>{var t;return(null==(t=e.data)?void 0:t.length)||0}));for(let r=0;r<t;r++){let t=v(r);if(null!==t){if(!t){const s=e.map(e=>{var t;return null==(t=e.data)?void 0:t[r]}).find(e=>null!=e);t=null==s?"":Array.isArray(s)?s[0]:s.x}f.push([t,...P.flatMap(e=>e.cells(r))])}}}else{const t=new Map;e.forEach((e,r)=>{var s;null==(s=null==e?void 0:e.data)||s.forEach((e,s)=>{if(!e||"object"!=typeof e)return;const a=Array.isArray(e)?e[0]:e.x,i=String(a);let n=t.get(i);n||(n={cat:a,values:P.map(e=>e.head.map(()=>""))},t.set(i,n)),n.values[r]=P[r].cells(s)})}),Array.from(t.values()).sort((e,t)=>{const r="string"==typeof e.cat;return r!==("string"==typeof t.cat)?r?1:-1:r?l.axisFlags.isXNumeric?e.cat<t.cat?-1:1:0:e.cat-t.cat}).forEach(({cat:e,values:t})=>f.push([e,...t.flat()]))}else u.push([c.headerCategory,c.headerValue].join(i)),e.forEach((e,t)=>{u.push([b(l.labelData.labels[t]),w(g.has(t)?"":l.seriesData.series[t])].join(i))});const U=f.map(e=>e[0]).filter(x),j=new Set(U.map(e=>y(e))).size<U.length;f.forEach(e=>u.push([b(e[0],j),...e.slice(1)].join(i))),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+u.join(n)),t||c.filename,".csv")}triggerDownload(e,t,r){if(i.isSSR())return;const s=document.createElement("a");s.href=e,s.download=(t||this.w.globals.chartID)+r,document.body.appendChild(s),s.click(),document.body.removeChild(s)}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
package/dist/features/exports.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/exports.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/exports.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/exports.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/exports.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/exports.js could not register with the ApexCharts script on this page: "+(e&&e.message))}}else t.console.error("ApexCharts: dist/features/exports.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/exports.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_axes_AxesUtils,r=globalThis.ApexCharts.__internals.__apex_Series,a=globalThis.ApexCharts.__internals.__apex_Utils,n=globalThis.ApexCharts.__internals.__apex_Environment_Environment,i=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,o=globalThis.ApexCharts.__internals,l=o.__apex_math_SVGNS;o.__apex_math_Point,o.__apex_math_Matrix,o.__apex_math_Box,t.registerFeatures({exports:class{constructor(e,t){this.w=e,this.ctx=t}svgStringToNode(e){return(new DOMParser).parseFromString(e,"image/svg+xml").documentElement}scaleSvgNode(e,t){const s=parseFloat(e.getAttributeNS(null,"width")),r=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",s*t),e.setAttributeNS(null,"height",r*t),e.setAttributeNS(null,"viewBox","0 0 "+s+" "+r)}inlineCanvasLayers(e){const t=this.w.dom.elWrap.querySelectorAll(".apexcharts-series-canvas");if(!t.length)return;const s=e.querySelectorAll(".apexcharts-canvas-series");for(let e=0;e<t.length&&e<s.length;e++){let r;try{r=t[e].toDataURL()}catch(e){continue}const a=s[e],n=document.createElementNS(l,"image");n.setAttribute("x",a.getAttribute("x")||"0"),n.setAttribute("y",a.getAttribute("y")||"0"),n.setAttribute("width",a.getAttribute("width")||"0"),n.setAttribute("height",a.getAttribute("height")||"0"),n.setAttribute("href",r),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),a.parentNode&&a.parentNode.replaceChild(n,a)}}queryStyleable(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))}setStyleDefaults(e,t){Object.keys(t).forEach(s=>{""===e.style.getPropertyValue(s)&&e.style.setProperty(s,t[s])})}applyExportStyles(e){const t=this.w;this.queryStyleable(e,"style").forEach(e=>e.remove()),this.queryStyleable(e,[".apexcharts-tooltip",".apexcharts-toolbar",".apexcharts-xaxistooltip",".apexcharts-yaxistooltip",".apexcharts-xcrosshairs",".apexcharts-ycrosshairs",".apexcharts-zoom-rect",".apexcharts-selection-rect"].join(", ")).forEach(e=>{e.style.setProperty("display","none","important")}),this.queryStyleable(e,".apexcharts-flip-y").forEach(e=>{this.setStyleDefaults(e,{transform:"scaleY(-1) translateY(-100%)","transform-origin":"top","transform-box":"fill-box"})}),this.queryStyleable(e,".apexcharts-flip-x").forEach(e=>{this.setStyleDefaults(e,{transform:"scaleX(-1)","transform-origin":"center","transform-box":"fill-box"})}),t.config.legend.show&&t.dom.elLegendWrap&&t.dom.elLegendWrap.children.length&&(this.queryStyleable(e,".apexcharts-legend").forEach(e=>{this.setStyleDefaults(e,{display:"flex",overflow:"auto",padding:"0 10px"});const t=e.classList,s=t.contains("apx-legend-position-left")||t.contains("apx-legend-position-right"),r=t.contains("apx-legend-position-top")||t.contains("apx-legend-position-bottom");t.contains("apexcharts-legend-group-horizontal")&&this.setStyleDefaults(e,{"flex-direction":"column"}),s&&this.setStyleDefaults(e,{"flex-direction":"column",bottom:"0"}),r&&this.setStyleDefaults(e,{"flex-wrap":"wrap"}),s||r&&t.contains("apexcharts-align-left")?this.setStyleDefaults(e,{"justify-content":"flex-start","align-items":"flex-start"}):r&&t.contains("apexcharts-align-center")?this.setStyleDefaults(e,{"justify-content":"center","align-items":"center"}):r&&t.contains("apexcharts-align-right")&&this.setStyleDefaults(e,{"justify-content":"flex-end","align-items":"flex-end"})}),this.queryStyleable(e,".apexcharts-legend-group").forEach(e=>{this.setStyleDefaults(e,{display:"flex"})}),this.queryStyleable(e,".apexcharts-legend-group-vertical").forEach(e=>{this.setStyleDefaults(e,{"flex-direction":"column-reverse"})}),this.queryStyleable(e,".apexcharts-legend-series").forEach(e=>{this.setStyleDefaults(e,{cursor:e.classList.contains("apexcharts-no-click")?"auto":"pointer","line-height":"normal",display:"flex","align-items":"center"})}),this.queryStyleable(e,".apexcharts-legend-text").forEach(e=>{this.setStyleDefaults(e,{position:"relative","font-size":"14px"})}),this.queryStyleable(e,".apexcharts-legend-marker").forEach(e=>{this.setStyleDefaults(e,{position:"relative",display:"flex","align-items":"center","justify-content":"center",cursor:"pointer","margin-right":"1px"})}),this.queryStyleable(e,".apexcharts-inactive-legend").forEach(e=>{this.setStyleDefaults(e,{opacity:"0.45"})}),this.queryStyleable(e,".apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series").forEach(e=>{e.style.setProperty("display","none","important")}))}resolveExportBackground(){const e=this.w,t=e.config.chart.background;return t&&"transparent"!==t?t:"dark"===e.config.theme.mode?"#343A3F":"#fff"}collectFontFamilies(){const e=new Set,t=this.w;if(!n.isBrowser()||!t.dom.elWrap)return e;const s=this.queryStyleable(t.dom.elWrap,"text, tspan, .apexcharts-legend-text, .apexcharts-title-text, .apexcharts-subtitle-text");return[t.dom.elWrap,...s].forEach(t=>{const s=i.getComputedStyle(t),r=s&&s.fontFamily;r&&r.split(",").forEach(t=>{const s=t.trim().replace(/^['"]|['"]$/g,"");s&&e.add(s.toLowerCase())})}),e}collectFontFaceRules(){if(!n.isBrowser())return Promise.resolve([]);const e=[],t=[],s=(t,s)=>{(t.match(/@font-face\s*\{[^}]*\}/gi)||[]).forEach(t=>{const r=t.match(/font-family\s*:\s*([^;}]+)/i);if(!r)return;const a=r[1].trim().replace(/^['"]|['"]$/g,"");e.push({family:a.toLowerCase(),css:t,base:s})})},r=(e,t)=>{Array.from(e).forEach(e=>{5===e.type?e.cssText&&s(e.cssText,t):e.styleSheet?a(e.styleSheet):e.cssRules&&r(e.cssRules,t)})},a=e=>{let a=null;try{a=e.cssRules}catch(e){}a?r(a,e.href||document.baseURI):e.href&&t.push(fetch(e.href).then(e=>e.ok?e.text():"").then(t=>s(t,e.href)).catch(()=>{}))};return Array.from(document.styleSheets||[]).forEach(a),Promise.all(t).then(()=>e)}embedFonts(e){const t=this.w;if(!n.isBrowser()||!t.config.chart.toolbar.export.embedFonts||"function"!=typeof fetch)return Promise.resolve();const s=this.collectFontFamilies();return s.size?this.collectFontFaceRules().then(e=>{const t=e.filter(e=>s.has(e.family));return t.length?Promise.all(t.map(e=>this.inlineFontFaceUrls(e.css,e.base).catch(()=>null))):Promise.resolve([])}).then(t=>{const s=(t||[]).filter(Boolean).join("\n");if(!s)return;const r=document.createElementNS(l,"style");r.textContent=s,e.insertBefore(r,e.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(e,t){const s=[],r=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let a;for(;null!==(a=r.exec(e));)a[2].startsWith("data:")||s.push(a[2]);return s.length?Promise.all(s.map(e=>this.fetchAsDataUri(t?new URL(e,t).href:e).then(t=>({url:e,dataUri:t})).catch(()=>({url:e,dataUri:null})))).then(t=>{let s=e,r=0;return t.forEach(({url:e,dataUri:t})=>{t&&(s=s.split(e).join(t),r++)}),r?s:null}):Promise.resolve(e.includes("data:")?e:null)}fetchAsDataUri(e){return"function"!=typeof fetch||"function"!=typeof btoa?Promise.reject(new Error("fetch unavailable")):fetch(e).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status} for ${e}`);const s=t.headers.get("content-type")||"application/octet-stream";return t.arrayBuffer().then(e=>{const t=new Uint8Array(e);let r="";for(let e=0;e<t.length;e+=32768)r+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${s};base64,${btoa(r)}`})})}getSvgString(e){return new Promise(t=>{var s,r,a;const n=this.w;let i=e||n.config.chart.toolbar.export.scale||n.config.chart.toolbar.export.width/n.globals.svgWidth;i||(i=1);const o=n.globals.svgWidth*i,l=n.globals.svgHeight*i;null==(s=n.globals.layoutTween)||s.finish(),null==(r=n.globals.circleTween)||r.finish(),null==(a=n.globals.highlightTween)||a.finish(),[...n.globals.chromeTweens||[]].forEach(e=>e());const c=n.dom.elWrap.cloneNode(!0);c.style.width=o+"px",c.style.height=l+"px",this.inlineCanvasLayers(c),this.applyExportStyles(c);const h=(new XMLSerializer).serializeToString(c);let p=`\n <svg xmlns="http://www.w3.org/2000/svg"\n version="1.1"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n class="apexcharts-svg"\n xmlns:data="ApexChartsNS"\n transform="translate(0, 0)"\n width="${n.globals.svgWidth}px" height="${n.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${o}px; height:${l}px;">\n ${h}\n </div>\n </foreignObject>\n </svg>\n `;const g=this.svgStringToNode(p);1!==i&&this.scaleSvgNode(g,i),Promise.all([this.convertImagesToBase64(g),this.embedFonts(g)]).then(()=>{p=(new XMLSerializer).serializeToString(g),t(p.replace(/ /g," "))})})}convertImagesToBase64(e){const t="http://www.w3.org/1999/xlink",s=e.getElementsByTagName("image"),r=Array.from(s).map(e=>{const s=e.getAttributeNS(t,"href"),r=e.getAttribute("href"),a=s||r;if(!a||a.startsWith("data:"))return Promise.resolve();const n=a=>{s&&e.setAttributeNS(t,"href",a),!r&&s||e.setAttribute("href",a)};return this.fetchAsDataUri(a).then(n).catch(()=>this.getBase64FromUrl(a).then(n).catch(e=>{console.error("Error converting image to base64:",e)}))});return Promise.all(r)}getBase64FromUrl(e){return n.isSSR()?Promise.resolve(e):new Promise((t,s)=>{const r=new Image;r.crossOrigin="Anonymous",r.onload=()=>{const e=document.createElement("canvas");e.width=r.width,e.height=r.height;const s=e.getContext("2d");s&&s.drawImage(r,0,0),t(e.toDataURL())},r.onerror=s,r.src=e})}svgUrl(){return new Promise(e=>{this.getSvgString().then(t=>{const s=new Blob([t],{type:"image/svg+xml;charset=utf-8"});e(URL.createObjectURL(s))})})}dataURI(e){return n.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const s=this.w,r=()=>{console.warn("ApexCharts: the PNG export could not be rendered"),t({imgURI:""})},a=e?e.scale||e.width/s.globals.svgWidth:1,n=document.createElement("canvas");n.width=s.globals.svgWidth*a,n.height=parseInt(s.dom.elWrap.style.height,10)*a;const i=this.resolveExportBackground(),o=n.getContext("2d");if(!o)return r();o.fillStyle=i,o.fillRect(0,0,n.width,n.height),this.getSvgString(a).then(e=>{const s="data:image/svg+xml,"+encodeURIComponent(e),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{try{o.drawImage(a,0,0);const e=n;if(e.msToBlob){const s=e.msToBlob();t({blob:s})}else{const e=n.toDataURL("image/png");t({imgURI:e})}}catch(e){r()}},a.onerror=r,a.src=s}).catch(r)})}exportToSVG(){this.svgUrl().then(e=>{this.triggerDownload(e,this.w.config.chart.toolbar.export.svg.filename,".svg")})}exportToPng(){const e=this.w.config.chart.toolbar.export.scale,t=this.w.config.chart.toolbar.export.width,s=e?{scale:e}:t?{width:t}:void 0;this.dataURI(s).then(({imgURI:e,blob:t})=>{t?navigator.msSaveOrOpenBlob(t,this.w.globals.chartID+".png"):e&&this.triggerDownload(e,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:e,fileName:t,columnDelimiter:n=",",lineDelimiter:i="\n"}){const o=this.w,l=o.globals,c=o.config.chart.toolbar.export.csv,h=!e&&(l.streamgraphRawSeries||l.waterfallRawSeries||l.dumbbellRawSeries);e||(e=h||o.config.series);const p=new Set(h&&h===l.dumbbellRawSeries?o.dumbbellData.hidden:l.collapsedSeriesIndices),g=[],d=[],f="datetime"===o.config.xaxis.type,u=o.config.xaxis.labels.datetimeUTC,m=e=>{if(null==e||a.isNumber(e))return e;const t=String(e);return/^[=+\-@\t\r]/.test(t)&&isNaN(+t)?`'${t}`:t},x=e=>f&&String(e).length>=10&&!isNaN(new Date(e).getTime()),y=(e,t)=>{const s=new Date(e);if(u||s.setTime(s.getTime()-6e4*s.getTimezoneOffset()),t)return s.toISOString().slice(0,23).replace("T"," ").replace(".000","");const[r,a,n,i]=s.toUTCString().split(" ");return`${r.slice(0,3)} ${n} ${a} ${i}`},b=(e,t)=>"function"==typeof c.categoryFormatter?c.categoryFormatter(e):null==e?"":x(e)?y(e,t):a.isNumber(e)?e:m(String(e).split(n).join("")),w=e=>"function"==typeof c.valueFormatter?c.valueFormatter(e):m(e),S=new s(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),v=e=>{let t="";if(l.axisCharts){if("category"===o.config.xaxis.type||o.config.xaxis.convertedCatToNumeric)if(l.isBarHorizontal){const s=o.formatters.yLabelFormatters[0],a=new r(this.ctx.w).getActiveConfigSeriesIndex();t=s(o.labelData.labels[e],{seriesIndex:a,dataPointIndex:e,w:o})}else t=S.getLabel(o.labelData.labels,o.labelData.timescaleLabels,0,e).text;f&&(o.config.xaxis.categories.length?t=o.config.xaxis.categories[e]:o.config.labels.length&&(t=o.config.labels[e]))}else t=o.config.labels[e];return Array.isArray(t)?t.join(" "):t},A=o.candleData,_=o.rangeData,C=o.violinData,E=e.length>1,j=e.map((e,t)=>{const s=h?"":e.type||o.config.chart.type,r="candlestick"===s?{open:A.seriesCandleO,high:A.seriesCandleH,low:A.seriesCandleL,close:A.seriesCandleC}:"boxPlot"===s?{minimum:A.seriesCandleO,q1:A.seriesCandleH,median:A.seriesCandleM,q3:A.seriesCandleL,maximum:A.seriesCandleC}:"rangeBar"===s||"rangeArea"===s?{minimum:_.seriesRangeStart,maximum:_.seriesRangeEnd}:"violin"===s?{minimum:C.seriesViolinMin,maximum:C.seriesViolinMax,observations:C.seriesViolinPoints}:null,a=String(e.name||`series-${t}`).split(n).join("")||`series-${t}`,i=r?Object.keys(r):[a];return{head:r&&E?i.map(e=>`${a} ${e}`):i,cells:s=>{var a;const n=p.has(t);if(!r){const t=n||null==(a=e.data)?void 0:a[s];return[w(t&&"object"==typeof t?Array.isArray(t)?t[1]:t.y:t)]}return Object.values(r).map(e=>{var r;const a=n||null==(r=null==e?void 0:e[t])?void 0:r[s];return w(Array.isArray(a)?a.length:a)})}}});if(l.axisCharts)if(g.push([c.headerCategory,...j.flatMap(e=>e.head)].join(n)),l.allSeriesHasEqualX||o.config.xaxis.categories.length||o.config.labels.length){const t=Math.max(0,...e.map(e=>{var t;return(null==(t=e.data)?void 0:t.length)||0}));for(let s=0;s<t;s++){let t=v(s);if(null!==t){if(!t){const r=e.map(e=>{var t;return null==(t=e.data)?void 0:t[s]}).find(e=>null!=e);t=null==r?"":Array.isArray(r)?r[0]:r.x}d.push([t,...j.flatMap(e=>e.cells(s))])}}}else{const t=new Map;e.forEach((e,s)=>{var r;null==(r=null==e?void 0:e.data)||r.forEach((e,r)=>{if(!e||"object"!=typeof e)return;const a=Array.isArray(e)?e[0]:e.x,n=String(a);let i=t.get(n);i||(i={cat:a,values:j.map(e=>e.head.map(()=>""))},t.set(n,i)),i.values[s]=j[s].cells(r)})}),Array.from(t.values()).sort((e,t)=>{const s="string"==typeof e.cat;return s!==("string"==typeof t.cat)?s?1:-1:s?o.axisFlags.isXNumeric?e.cat<t.cat?-1:1:0:e.cat-t.cat}).forEach(({cat:e,values:t})=>d.push([e,...t.flat()]))}else g.push([c.headerCategory,c.headerValue].join(n)),e.forEach((e,t)=>{g.push([b(o.labelData.labels[t]),w(p.has(t)?"":o.seriesData.series[t])].join(n))});const D=d.map(e=>e[0]).filter(x),T=new Set(D.map(e=>y(e))).size<D.length;d.forEach(e=>g.push([b(e[0],T),...e.slice(1)].join(n))),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+g.join(i)),t||c.filename,".csv")}triggerDownload(e,t,s){if(n.isSSR())return;const r=document.createElement("a");r.href=e,r.download=(t||this.w.globals.chartID)+s,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}}),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).ApexExports={})});
|