apexcharts 7.2.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +30 -11
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +545 -463
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.esm.js +1149 -801
- package/dist/apexcharts.js +684 -254
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +684 -254
- package/dist/area.common.js +1 -1
- package/dist/area.esm.js +1 -1
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +20 -10
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +20 -10
- package/dist/bubble.common.js +1 -1
- package/dist/bubble.esm.js +1 -1
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +20 -10
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +20 -10
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +545 -463
- package/dist/donut.common.js +1 -1
- package/dist/donut.esm.js +1 -1
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +20 -10
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +364 -26
- package/dist/features/annotations.common.js +1 -1
- package/dist/features/annotations.esm.js +1 -1
- package/dist/features/annotations.js +1 -1
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +1 -1
- package/dist/features/drilldown.esm.js +1 -1
- package/dist/features/drilldown.js +1 -1
- package/dist/features/dumbbell.common.js +1 -1
- package/dist/features/dumbbell.esm.js +1 -1
- package/dist/features/dumbbell.js +1 -1
- package/dist/features/exports.common.js +2 -2
- package/dist/features/exports.esm.js +12 -14
- package/dist/features/exports.js +2 -2
- package/dist/features/facet.common.js +1 -1
- package/dist/features/facet.esm.js +1 -1
- package/dist/features/facet.js +1 -1
- package/dist/features/history.common.js +1 -1
- package/dist/features/history.esm.js +1 -1
- package/dist/features/history.js +1 -1
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +2 -2
- package/dist/features/keyboard.esm.js +14 -1
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +1 -1
- package/dist/features/legend.esm.js +1 -1
- package/dist/features/legend.js +1 -1
- package/dist/features/link.common.js +1 -1
- package/dist/features/link.esm.js +38 -38
- package/dist/features/link.js +1 -1
- package/dist/features/marks.common.js +1 -1
- package/dist/features/marks.esm.js +1 -1
- package/dist/features/marks.js +1 -1
- package/dist/features/measure.common.js +1 -1
- package/dist/features/measure.esm.js +1 -1
- package/dist/features/measure.js +1 -1
- package/dist/features/morph.common.js +1 -1
- package/dist/features/morph.esm.js +1 -1
- package/dist/features/morph.js +1 -1
- package/dist/features/perspectives.common.js +1 -1
- package/dist/features/perspectives.esm.js +11 -11
- package/dist/features/perspectives.js +1 -1
- package/dist/features/raincloud.common.js +1 -1
- package/dist/features/raincloud.esm.js +1 -1
- package/dist/features/raincloud.js +1 -1
- package/dist/features/renderer-canvas.common.js +1 -1
- package/dist/features/renderer-canvas.esm.js +1 -1
- package/dist/features/renderer-canvas.js +1 -1
- package/dist/features/stats.common.js +1 -1
- package/dist/features/stats.esm.js +1 -1
- package/dist/features/stats.js +1 -1
- package/dist/features/storyboard.common.js +1 -1
- package/dist/features/storyboard.esm.js +11 -11
- package/dist/features/storyboard.js +1 -1
- package/dist/features/streamgraph.common.js +1 -1
- package/dist/features/streamgraph.esm.js +1 -1
- package/dist/features/streamgraph.js +1 -1
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +172 -25
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +1 -1
- package/dist/features/trellis.esm.js +1 -1
- package/dist/features/trellis.js +1 -1
- package/dist/features/waterfall.common.js +1 -1
- package/dist/features/waterfall.esm.js +1 -1
- package/dist/features/waterfall.js +1 -1
- package/dist/features/weave.common.js +2 -2
- package/dist/features/weave.esm.js +180 -2
- package/dist/features/weave.js +2 -2
- package/dist/heatmap.common.js +1 -1
- package/dist/heatmap.esm.js +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +20 -10
- package/dist/line.common.js +1 -1
- package/dist/line.esm.js +1 -1
- package/dist/line.js +1 -1
- package/dist/pictograms.common.js +1 -1
- package/dist/pictograms.esm.js +1 -1
- package/dist/pictograms.js +1 -1
- package/dist/pie.common.js +1 -1
- package/dist/pie.esm.js +1 -1
- package/dist/pie.js +1 -1
- package/dist/polarArea.common.js +1 -1
- package/dist/polarArea.esm.js +1 -1
- package/dist/radar.common.js +1 -1
- package/dist/radar.esm.js +1 -1
- package/dist/radar.js +1 -1
- package/dist/radialBar.common.js +1 -1
- package/dist/radialBar.esm.js +1 -1
- package/dist/radialBar.js +1 -1
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +20 -10
- package/dist/rangeArea.common.js +1 -1
- package/dist/rangeArea.esm.js +1 -1
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +20 -10
- package/dist/scatter.common.js +1 -1
- package/dist/scatter.esm.js +1 -1
- package/dist/streamgraph.common.js +1 -1
- package/dist/streamgraph.esm.js +1 -1
- package/dist/sunburst.common.js +1 -1
- package/dist/sunburst.esm.js +1 -1
- package/dist/sunburst.js +1 -1
- package/dist/treemap.common.js +1 -1
- package/dist/treemap.esm.js +1 -1
- package/dist/treemap.js +1 -1
- package/dist/unit-shapes.common.js +1 -1
- package/dist/unit-shapes.esm.js +1 -1
- package/dist/unit-shapes.js +1 -1
- package/dist/unit.common.js +1 -1
- package/dist/unit.esm.js +79 -79
- package/dist/unit.js +1 -1
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +20 -10
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +20 -10
- package/package.json +2 -2
- package/src/apexcharts.js +39 -15
- package/src/charts/common/bar/Helpers.js +31 -12
- package/src/modules/Data.js +8 -2
- package/src/modules/Exports.js +14 -12
- package/src/modules/Formatters.js +24 -1
- package/src/modules/Range.js +28 -1
- package/src/modules/Toolbar.js +112 -2
- package/src/modules/ZoomPanSelection.js +85 -7
- package/src/modules/accessibility/KeyboardNavigation.js +14 -0
- package/src/modules/axes/YAxis.js +12 -15
- package/src/modules/helpers/UpdateHelpers.js +25 -8
- package/src/modules/settings/Globals.js +5 -10
- package/src/modules/settings/Options.js +15 -0
- package/src/modules/weave/PluginAPI.js +57 -1
- package/src/modules/weave/WeaveHost.js +148 -0
- package/src/ssr/DOMShim.js +50 -0
- package/src/types/internal.d.ts +1 -1
- package/src/utils/Utils.js +6 -9
- package/types/apexcharts.d.ts +17 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function e(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const 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;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,i=n.dom.baseEl&&n.dom.baseEl.querySelector(".apexcharts-grid");if(!i)return null;const s=i.getBoundingClientRect();if(!s.width||!s.height)return null;const o=e=>e<0?0:e>1?1:e,r=o((e-s.left)/s.width),a=o((t-s.top)/s.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,s=this._doc();if(!i||!s)return;const o=this._clientToData(e,t),r=n.globals,a={x:o?o.x:null,y:o?o.y:null,seriesIndex:r.capturedSeriesIndex>=0?r.capturedSeriesIndex:null,dataPointIndex:r.capturedDataPointIndex>=0?r.capturedDataPointIndex:null,clientX:e,clientY:t},l=this._resolveItems(a);if(!l.length)return;this._items=l;const c=s.createElement("div");c.className="apexcharts-context-menu",c.setAttribute("role","menu"),c.style.position="absolute",c.style.visibility="hidden",l.forEach((e,t)=>{const n=s.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)}),i.appendChild(c),this.menu=c;const h=i.getBoundingClientRect();let u=e-h.left,d=t-h.top;const x=c.offsetWidth,f=c.offsetHeight,m=Math.max(0,i.clientWidth-x),_=Math.max(0,i.clientHeight-f);u>m&&(u=m),d>_&&(d=_),c.style.left=Math.max(0,u)+"px",c.style.top=Math.max(0,d)+"px",c.style.visibility="visible",s.addEventListener("mousedown",this._onDocDown,!0),s.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 v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexContextMenu={})}(this,function(e){"use strict";const t=globalThis.ApexCharts,n=globalThis.ApexCharts.__internals.__apex_Environment_Environment,i=globalThis.ApexCharts.__internals.__apex_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,i=n.dom.baseEl&&n.dom.baseEl.querySelector(".apexcharts-grid");if(!i)return null;const s=i.getBoundingClientRect();if(!s.width||!s.height)return null;const o=e=>e<0?0:e>1?1:e,r=o((e-s.left)/s.width),a=o((t-s.top)/s.height),l=n.globals.minX+r*(n.globals.maxX-n.globals.minX),h=n.globals.yAxisScale&&n.globals.yAxisScale[0],c=h&&isFinite(h.niceMin)?h.niceMin:n.globals.minY,u=h&&isFinite(h.niceMax)?h.niceMax:n.globals.maxY;return{x:l,y:u-a*(u-c)}}_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,s=this._doc();if(!i||!s)return;const o=this._clientToData(e,t),r=n.globals,a={x:o?o.x:null,y:o?o.y:null,seriesIndex:r.capturedSeriesIndex>=0?r.capturedSeriesIndex:null,dataPointIndex:r.capturedDataPointIndex>=0?r.capturedDataPointIndex:null,clientX:e,clientY:t},l=this._resolveItems(a);if(!l.length)return;this._items=l;const h=s.createElement("div");h.className="apexcharts-context-menu",h.setAttribute("role","menu"),h.style.position="absolute",h.style.visibility="hidden",l.forEach((e,t)=>{const n=s.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 c=i.getBoundingClientRect();let u=e-c.left,d=t-c.top;const x=h.offsetWidth,f=h.offsetHeight,_=Math.max(0,i.clientWidth-x),m=Math.max(0,i.clientHeight-f);u>_&&(u=_),d>m&&(d=m),h.style.left=Math.max(0,u)+"px",h.style.top=Math.max(0,d)+"px",h.style.visibility="visible",s.addEventListener("mousedown",this._onDocDown,!0),s.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"}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";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,u=d.__apex_Environment_Environment,p=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 g="http://www.w3.org/1999/xhtml";class w{constructor(t,e,i){this.w=t,this.ctx=e,this.drilldown=i}render(t){if(!u.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=p.createElementNS(g,"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=p.createElementNS(g,"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=p.createElementNS(g,"span");t.setAttribute("class","apexcharts-breadcrumb-item apexcharts-breadcrumb-current"),t.setAttribute("aria-current","page"),t.textContent=r,n.appendChild(t)}else{const t=p.createElementNS(g,"button");if(t.setAttribute("type","button"),t.setAttribute("class","apexcharts-breadcrumb-item"),0===i){const e=p.createElementNS(g,"span");e.setAttribute("class","apexcharts-breadcrumb-arrow"),e.setAttribute("aria-hidden","true"),e.textContent="\u2190",t.appendChild(e)}const e=p.createElementNS(g,"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 y{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(!u.isBrowser())return;const t=this._cfg();if(!1===t.show)return;const e=this.w.dom.elWrap;if(!e)return;this.hide();const i=p.createElementNS(b,"div");i.setAttribute("class",_),i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-label",t.text||"Loading");const r=p.createElementNS(b,"div");if(r.setAttribute("class",`${_}-spinner`),r.setAttribute("aria-hidden","true"),i.appendChild(r),t.text){const e=p.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 m="__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 w(t,e,this),this.loading=new y(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):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 Promise.resolve(this.ctx);this.rootSnapshot||(this.rootSnapshot=this._snapshot());const r=this.path[this.path.length-1];return this.stack.push({id:t.id,name:t.name,restore:this._snapshot()}),this._apply(this._viewFromChild(t),"down",{from:r,to:t.id,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex})}_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){const r=this.w;r.interact.selectedDataPoints=[],r.globals.collapsedSeries=[],r.globals.collapsedSeriesIndices=[],r.globals.ancillaryCollapsedSeries=[],r.globals.ancillaryCollapsedSeriesIndices=[],r.globals.allSeriesCollapsed=!1,r.globals.risingSeries=[],t.markers=a(l({},t.markers||{}),{discrete:this._drillMarkers(t.series)});const s=(!r.config.drilldown.animation||!1!==r.config.drilldown.animation.enabled)&&!1!==r.config.chart.animations.enabled;"down"===e&&this._fire("drillDownStart",i);const n=e=>this.ctx.updateOptions(t,!1,e,!1,!1),o=()=>(this._fire("down"===e?"drillDownEnd":"drillUp",i),this.ctx);if(s&&this._zoomEnabled()){const t=this._triggerOrigin(i);if(t)return this._zoomDrill(t,e,()=>n(!1)).then(o)}return n(s).then(o)}_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(!u.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){}(u=h).style.transform="",u.style.opacity="",u.style.transformOrigin="",u.style.transformBox="",t.cancel()}var u},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)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}_afterRender(){const t=this.w;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(!u.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)}warnSliceOffsetDisabled(){this._warnedNoSliceOffset||(this._warnedNoSliceOffset=!0)}_wirePlotClick(){if(!u.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[m]):[],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,[m]:!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});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(t,e){"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={})}(this,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},c=(t,e)=>i(t,r(e));const d=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,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 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.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];return this.stack.push({id:t.id,name:t.name,restore:this._snapshot()}),this._apply(this._viewFromChild(t),"down",{from:r,to:t.id,point:e,seriesIndex:i&&i.seriesIndex,dataPointIndex:i&&i.dataPointIndex})}_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:c(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){const r=this.w;r.interact.selectedDataPoints=[],r.globals.collapsedSeries=[],r.globals.collapsedSeriesIndices=[],r.globals.ancillaryCollapsedSeries=[],r.globals.ancillaryCollapsedSeriesIndices=[],r.globals.allSeriesCollapsed=!1,r.globals.risingSeries=[],t.markers=c(a({},t.markers||{}),{discrete:this._drillMarkers(t.series)});const s=(!r.config.drilldown.animation||!1!==r.config.drilldown.animation.enabled)&&!1!==r.config.chart.animations.enabled;"down"===e&&this._fire("drillDownStart",i);const n=e=>this.ctx.updateOptions(t,!1,e,!1,!1),o=()=>(this._fire("down"===e?"drillDownEnd":"drillUp",i),this.ctx);if(s&&this._zoomEnabled()){const t=this._triggerOrigin(i);if(t)return this._zoomDrill(t,e,()=>n(!1)).then(o)}return n(s).then(o)}_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)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}_afterRender(){const t=this.w;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}}}),t.default=d,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";var e=Object.defineProperty,r=Object.defineProperties,t=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(r,t,l)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):r[t]=l,s=(e,r)=>{for(var t in r||(r={}))n.call(r,t)&&o(e,t,r[t]);if(l)for(var t of l(r))a.call(r,t)&&o(e,t,r[t]);return e},u=(e,l)=>r(e,t(l));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function i(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 l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,l.get?l:{enumerable:!0,get:()=>e[t]})}return r.default=e,Object.freeze(r)}const c=i(require("apexcharts/core")),d=c.__apex_Utils;function f(e,r,t){const l=t&&void 0!==t[r]?t[r]:r+1;return null==e?{x:l,y:null,rest:{}}:Array.isArray(e)?{x:void 0!==e[0]?e[0]:l,y:e[1],rest:{}}:"object"==typeof e?{x:void 0!==e.x?e.x:l,y:e.y,rest:e}:{x:l,y:e,rest:{}}}function b(e,r){var t;const l=r.config,n=r.globals;if(!Array.isArray(e))return e;n.dumbbellRawSeries||(n.dumbbellRawSeries=e.map(e=>u(s({},e),{data:Array.isArray(null==e?void 0:e.data)?e.data.slice():null==e?void 0:e.data})));const a=n.dumbbellRawSeries,o=a.some(e=>function(e){for(let r=0;r<e.length;r++){const t=e[r],l=Array.isArray(t)?t[1]:t&&"object"==typeof t?t.y:t;if(Array.isArray(l)&&2===l.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 i=null==(t=l.xaxis)?void 0:t.categories,c=n.collapsedSeriesIndices||[],{xs:b,rows:p,byX:y}=function(e,r){var t;const l=[],n=[],a=new Map,o=[];for(let u=0;u<e.length;u++){const i=Array.isArray(null==(t=e[u])?void 0:t.data)?e[u].data:[],c=new Map;for(let e=0;e<i.length;e++){const{x:t,y:o,rest:u}=f(i[e],e,r),b=t instanceof Date?t.getTime():t;a.has(b)||(a.set(b,l.length),l.push(t),n.push(s({},u)));const p=a.get(b);c.set(p,d.parseNumber(o))}o.push(c)}return{xs:l,rows:n,byX:o}}(a,i),g=[],h=[],m=[];for(let e=0;e<a.length;e++)-1===c.indexOf(e)&&m.push(e);const v=[];for(let e=0;e<b.length;e++){const r=[];for(let t=0;t<a.length;t++){const l=y[t].has(e)?y[t].get(e):null;r.push(null!=l&&isFinite(l)?l:null)}g.push(r);let t=null,l=null,n=-1,o=-1;for(let e=0;e<m.length;e++){const a=m[e],s=r[a];null!==s&&((null===t||s<t)&&(t=s,n=a),(null===l||s>l)&&(l=s,o=a))}null!==t&&null!==l?(h.push([n,o]),v.push(u(s({},p[e]),{x:b[e],y:[t,l]}))):(h.push(null),v.push(u(s({},p[e]),{x:b[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:h,carrier:m.length?m[0]:0,hidden:a.map((e,r)=>r).filter(e=>-1!==c.indexOf(e))};const x=r.dumbbellData.carrier;return a.map((e,r)=>u(s({},e),{data:r===x&&m.length?v:[]}))}const p="__apexcharts_series_transforms__";var y,g;globalThis[p]||(globalThis[p]={}),y="dumbbell","function"==typeof(g=b)&&(globalThis[p][y]=g),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>c.default}),exports.dumbbellTransform=b;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e,r){"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={})}(this,function(e){"use strict";var r=Object.defineProperty,t=Object.defineProperties,l=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(e,t,l)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,i=(e,r)=>{for(var t in r||(r={}))s.call(r,t)&&o(e,t,r[t]);if(n)for(var t of n(r))a.call(r,t)&&o(e,t,r[t]);return e},u=(e,r)=>t(e,l(r));const c=globalThis.ApexCharts,d=globalThis.ApexCharts.__internals.__apex_Utils;function f(e,r,t){const l=t&&void 0!==t[r]?t[r]:r+1;return null==e?{x:l,y:null,rest:{}}:Array.isArray(e)?{x:void 0!==e[0]?e[0]:l,y:e[1],rest:{}}:"object"==typeof e?{x:void 0!==e.x?e.x:l,y:e.y,rest:e}:{x:l,y:e,rest:{}}}function p(e,r){var t;const l=r.config,n=r.globals;if(!Array.isArray(e))return e;n.dumbbellRawSeries||(n.dumbbellRawSeries=e.map(e=>u(i({},e),{data:Array.isArray(null==e?void 0:e.data)?e.data.slice():null==e?void 0:e.data})));const s=n.dumbbellRawSeries,a=s.some(e=>function(e){for(let r=0;r<e.length;r++){const t=e[r],l=Array.isArray(t)?t[1]:t&&"object"==typeof t?t.y:t;if(Array.isArray(l)&&2===l.length)return!0}return!1}(Array.isArray(null==e?void 0:e.data)?e.data:[]));if(a)return r.dumbbellData={form:"pairs",names:[],values:[],order:[],carrier:0,hidden:[]},e;const o=null==(t=l.xaxis)?void 0:t.categories,c=n.collapsedSeriesIndices||[],{xs:p,rows:b,byX:y}=function(e,r){var t;const l=[],n=[],s=new Map,a=[];for(let o=0;o<e.length;o++){const u=Array.isArray(null==(t=e[o])?void 0:t.data)?e[o].data:[],c=new Map;for(let e=0;e<u.length;e++){const{x:t,y:a,rest:o}=f(u[e],e,r),p=t instanceof Date?t.getTime():t;s.has(p)||(s.set(p,l.length),l.push(t),n.push(i({},o)));const b=s.get(p);c.set(b,d.parseNumber(a))}a.push(c)}return{xs:l,rows:n,byX:a}}(s,o),h=[],g=[],m=[];for(let e=0;e<s.length;e++)-1===c.indexOf(e)&&m.push(e);const x=[];for(let e=0;e<p.length;e++){const r=[];for(let t=0;t<s.length;t++){const l=y[t].has(e)?y[t].get(e):null;r.push(null!=l&&isFinite(l)?l:null)}h.push(r);let t=null,l=null,n=-1,a=-1;for(let e=0;e<m.length;e++){const s=m[e],o=r[s];null!==o&&((null===t||o<t)&&(t=o,n=s),(null===l||o>l)&&(l=o,a=s))}null!==t&&null!==l?(g.push([n,a]),x.push(u(i({},b[e]),{x:p[e],y:[t,l]}))):(g.push(null),x.push(u(i({},b[e]),{x:p[e],y:null})))}r.dumbbellData={form:"series",names:s.map((e,r)=>{var t;return null!=(t=null==e?void 0:e.name)?t:`Series ${r+1}`}),values:h,order:g,carrier:m.length?m[0]:0,hidden:s.map((e,r)=>r).filter(e=>-1!==c.indexOf(e))};const v=r.dumbbellData.carrier;return s.map((e,r)=>u(i({},e),{data:r===v&&m.length?x:[]}))}const b="__apexcharts_series_transforms__";var y,h;globalThis[b]||(globalThis[b]={}),y="dumbbell","function"==typeof(h=p)?globalThis[b][y]=h:console.warn(`ApexCharts: registerSeriesTransform("${y}") expects a function (series, w) => series.`),e.default=c,e.dumbbellTransform=p,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
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 s in e)if("default"!==s){const a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>e[s]})}return t.default=e,Object.freeze(t)}const t=e(require("apexcharts/core")),s=t.__apex_axes_AxesUtils,a=t.__apex_Data,r=t.__apex_Series,o=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 s=parseFloat(e.getAttributeNS(null,"width")),a=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",s*t),e.setAttributeNS(null,"height",a*t),e.setAttributeNS(null,"viewBox","0 0 "+s+" "+a)}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 a;try{a=t[e].toDataURL()}catch(e){continue}const r=s[e],o=document.createElementNS(l,"image");o.setAttribute("x",r.getAttribute("x")||"0"),o.setAttribute("y",r.getAttribute("y")||"0"),o.setAttribute("width",r.getAttribute("width")||"0"),o.setAttribute("height",r.getAttribute("height")||"0"),o.setAttribute("href",a),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),r.parentNode&&r.parentNode.replaceChild(o,r)}}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"),a=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"}),a&&this.setStyleDefaults(e,{"flex-wrap":"wrap"}),s||a&&t.contains("apexcharts-align-left")?this.setStyleDefaults(e,{"justify-content":"flex-start","align-items":"flex-start"}):a&&t.contains("apexcharts-align-center")?this.setStyleDefaults(e,{"justify-content":"center","align-items":"center"}):a&&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 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=n.getComputedStyle(t),a=s&&s.fontFamily;a&&a.split(",").forEach(t=>{const s=t.trim().replace(/^['"]|['"]$/g,"");s&&e.add(s.toLowerCase())})}),e}collectFontFaceRules(){if(!i.isBrowser())return Promise.resolve([]);const e=[],t=[],s=t=>{(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})})};return Array.from(document.styleSheets||[]).forEach(e=>{let a=null;try{a=e.cssRules}catch(e){a=null}a?Array.from(a).forEach(e=>{5===e.type&&e.cssText&&s(e.cssText)}):e.href&&t.push(fetch(e.href).then(e=>e.ok?e.text():"").then(s).catch(()=>{}))}),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 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).catch(()=>null))):Promise.resolve([])}).then(t=>{const s=(t||[]).filter(Boolean).join("\n");if(!s)return;const a=document.createElementNS(l,"style");a.textContent=s,e.insertBefore(a,e.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(e){const t=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let a;for(;null!==(a=s.exec(e));)a[2].startsWith("data:")||t.push(a[2]);return t.length?Promise.all(t.map(e=>this.fetchAsDataUri(e).then(t=>({url:e,dataUri:t})).catch(()=>({url:e,dataUri:null})))).then(t=>{let s=e,a=0;return t.forEach(({url:e,dataUri:t})=>{t&&(s=s.split(e).join(t),a++)}),a?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 a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${s};base64,${btoa(a)}`})})}getSvgString(e){return new Promise(t=>{const s=this.w;let a=e||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;a||(a=1);const r=s.globals.svgWidth*a,o=s.globals.svgHeight*a,i=s.dom.elWrap.cloneNode(!0);i.style.width=r+"px",i.style.height=o+"px",this.inlineCanvasLayers(i),this.applyExportStyles(i);const n=(new XMLSerializer).serializeToString(i);let l=`\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="${s.globals.svgWidth}px" height="${s.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px; height:${o}px;">\n ${n}\n </div>\n </foreignObject>\n </svg>\n `;const c=this.svgStringToNode(l);1!==a&&this.scaleSvgNode(c,a),Promise.all([this.convertImagesToBase64(c),this.embedFonts(c)]).then(()=>{l=(new XMLSerializer).serializeToString(c),t(l.replace(/ /g," "))})})}convertImagesToBase64(e){const t="http://www.w3.org/1999/xlink",s=e.getElementsByTagName("image"),a=Array.from(s).map(e=>{const s=e.getAttributeNS(t,"href"),a=e.getAttribute("href"),r=s||a;if(!r||r.startsWith("data:"))return Promise.resolve();const o=r=>{s&&e.setAttributeNS(t,"href",r),!a&&s||e.setAttribute("href",r)};return this.fetchAsDataUri(r).then(o).catch(()=>this.getBase64FromUrl(r).then(o).catch(e=>{}))});return Promise.all(a)}getBase64FromUrl(e){return i.isSSR()?Promise.resolve(e):new Promise((t,s)=>{const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const s=e.getContext("2d");s&&s.drawImage(a,0,0),t(e.toDataURL())},a.onerror=s,a.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 i.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const s=this.w,a=e?e.scale||e.width/s.globals.svgWidth:1,r=document.createElement("canvas");r.width=s.globals.svgWidth*a,r.height=parseInt(s.dom.elWrap.style.height,10)*a;const o=this.resolveExportBackground(),i=r.getContext("2d");i&&(i.fillStyle=o,i.fillRect(0,0,r.width,r.height),this.getSvgString(a).then(e=>{const s="data:image/svg+xml,"+encodeURIComponent(e),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{i.drawImage(a,0,0);const e=r;if(e.msToBlob){const s=e.msToBlob();t({blob:s})}else{const e=r.toDataURL("image/png");t({imgURI:e})}},a.src=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,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"):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;e||(e=l.config.series);let c=[];const h=[];let g="";const p=l.seriesData.series.map((e,t)=>-1===l.globals.collapsedSeriesIndices.indexOf(t)?e:[]),u=e=>{if(null==e||o.isNumber(e))return e;const t=String(e);return/^[=+\-@\t\r]/.test(t)?`'${t}`:t},f=e=>"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(e):"datetime"===l.config.xaxis.type&&String(e).length>=10?new Date(e).toDateString():o.isNumber(e)?e:u(e.split(i).join("")),d=e=>"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(e):u(e),m=Math.max(...e.map(e=>e.data?e.data.length:0)),x=new a(this.w),y=new s(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),b=e=>{let t="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){const s=l.formatters.yLabelFormatters[0],a=new r(this.ctx.w).getActiveConfigSeriesIndex();t=s(l.labelData.labels[e],{seriesIndex:a,dataPointIndex:e,w:l})}else t=y.getLabel(l.labelData.labels,l.labelData.timescaleLabels,0,e).text;"datetime"===l.config.xaxis.type&&(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 null===t?"nullvalue":(Array.isArray(t)&&(t=t.join(" ")),o.isNumber(t)?t:t.split(i).join(""))},w=(t,s)=>{var a,r,o,n,g,u;if(c.length&&0===s&&h.push(c.join(i)),t.data){const y=t.data.length?t.data:[...Array(m)].map(()=>"");for(let m=0;m<y.length;m++){c=[];let y=b(m);if("nullvalue"!==y){if(y||(x.isFormatXY()?y=e[s].data[m].x:x.isFormat2DArray()&&(y=e[s].data[m]?e[s].data[m][0]:"")),0===s){c.push(f(y));for(let t=0;t<l.seriesData.series.length;t++){const s=x.isFormatXY()?null==(a=e[t].data[m])?void 0:a.y:p[t][m];c.push(d(s))}}("candlestick"===l.config.chart.type||t.type&&"candlestick"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),("boxPlot"===l.config.chart.type||t.type&&"boxPlot"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleM[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),"rangeBar"===l.config.chart.type&&(c.pop(),c.push(l.rangeData.seriesRangeStart[s][m]),c.push(l.rangeData.seriesRangeEnd[s][m])),("violin"===l.config.chart.type||t.type&&"violin"===t.type)&&(c.pop(),c.push(null==(r=l.violinData.seriesViolinMin[s])?void 0:r[m]),c.push(null==(o=l.violinData.seriesViolinMax[s])?void 0:o[m]),c.push(null!=(u=null==(g=null==(n=l.violinData.seriesViolinPoints[s])?void 0:n[m])?void 0:g.length)?u:0)),c.length&&h.push(c.join(i))}}}};c.push(l.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===l.config.chart.type?(c.push("minimum"),c.push("q1"),c.push("median"),c.push("q3"),c.push("maximum")):"candlestick"===l.config.chart.type?(c.push("open"),c.push("high"),c.push("low"),c.push("close")):"rangeBar"===l.config.chart.type?(c.push("minimum"),c.push("maximum")):"violin"===l.config.chart.type?(c.push("minimum"),c.push("maximum"),c.push("observations")):e.map((e,t)=>{const s=(e.name?e.name:`series-${t}`)+"";l.globals.axisCharts&&c.push(s.split(i).join("")?s.split(i).join(""):`series-${t}`)}),l.globals.axisCharts||(c.push(l.config.chart.toolbar.export.csv.headerValue),h.push(c.join(i))),l.globals.allSeriesHasEqualX||!l.globals.axisCharts||l.config.xaxis.categories.length||l.config.labels.length?e.map((e,t)=>{l.globals.axisCharts?w(e,t):(c=[],c.push(f(l.labelData.labels[t])),c.push(d(p[t])),h.push(c.join(i)))}):(()=>{const t=new Set,s={};e.forEach((a,r)=>{null==a||a.data.forEach(a=>{let o,i;if(x.isFormatXY())o=a.x,i=a.y;else{if(!x.isFormat2DArray())return;o=a[0],i=a[1]}s[o]||(s[o]=Array(e.length).fill("")),s[o][r]=d(i),t.add(o)})}),c.length&&h.push(c.join(i)),Array.from(t).sort().forEach(e=>{const t=s[e];h.push([f(e),...t].join(i))})})(),g+=h.join(n),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+g),t||l.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(e,t,s){if(i.isSSR())return;const a=document.createElement("a");a.href=e,a.download=(t||this.w.globals.chartID)+s,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
|
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 s in e)if("default"!==s){const a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>e[s]})}return t.default=e,Object.freeze(t)}const t=e(require("apexcharts/core")),s=t.__apex_axes_AxesUtils,a=t.__apex_Data,r=t.__apex_Series,o=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 s=parseFloat(e.getAttributeNS(null,"width")),a=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",s*t),e.setAttributeNS(null,"height",a*t),e.setAttributeNS(null,"viewBox","0 0 "+s+" "+a)}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 a;try{a=t[e].toDataURL()}catch(e){continue}const r=s[e],o=document.createElementNS(l,"image");o.setAttribute("x",r.getAttribute("x")||"0"),o.setAttribute("y",r.getAttribute("y")||"0"),o.setAttribute("width",r.getAttribute("width")||"0"),o.setAttribute("height",r.getAttribute("height")||"0"),o.setAttribute("href",a),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),r.parentNode&&r.parentNode.replaceChild(o,r)}}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"),a=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"}),a&&this.setStyleDefaults(e,{"flex-wrap":"wrap"}),s||a&&t.contains("apexcharts-align-left")?this.setStyleDefaults(e,{"justify-content":"flex-start","align-items":"flex-start"}):a&&t.contains("apexcharts-align-center")?this.setStyleDefaults(e,{"justify-content":"center","align-items":"center"}):a&&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 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=n.getComputedStyle(t),a=s&&s.fontFamily;a&&a.split(",").forEach(t=>{const s=t.trim().replace(/^['"]|['"]$/g,"");s&&e.add(s.toLowerCase())})}),e}collectFontFaceRules(){if(!i.isBrowser())return Promise.resolve([]);const e=[],t=[],s=t=>{(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})})};return Array.from(document.styleSheets||[]).forEach(e=>{let a=null;try{a=e.cssRules}catch(e){a=null}a?Array.from(a).forEach(e=>{5===e.type&&e.cssText&&s(e.cssText)}):e.href&&t.push(fetch(e.href).then(e=>e.ok?e.text():"").then(s).catch(()=>{}))}),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 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).catch(()=>null))):Promise.resolve([])}).then(t=>{const s=(t||[]).filter(Boolean).join("\n");if(!s)return;const a=document.createElementNS(l,"style");a.textContent=s,e.insertBefore(a,e.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(e){const t=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let a;for(;null!==(a=s.exec(e));)a[2].startsWith("data:")||t.push(a[2]);return t.length?Promise.all(t.map(e=>this.fetchAsDataUri(e).then(t=>({url:e,dataUri:t})).catch(()=>({url:e,dataUri:null})))).then(t=>{let s=e,a=0;return t.forEach(({url:e,dataUri:t})=>{t&&(s=s.split(e).join(t),a++)}),a?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 a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${s};base64,${btoa(a)}`})})}getSvgString(e){return new Promise(t=>{const s=this.w;let a=e||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;a||(a=1);const r=s.globals.svgWidth*a,o=s.globals.svgHeight*a,i=s.dom.elWrap.cloneNode(!0);i.style.width=r+"px",i.style.height=o+"px",this.inlineCanvasLayers(i),this.applyExportStyles(i);const n=(new XMLSerializer).serializeToString(i);let l=`\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="${s.globals.svgWidth}px" height="${s.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px; height:${o}px;">\n ${n}\n </div>\n </foreignObject>\n </svg>\n `;const c=this.svgStringToNode(l);1!==a&&this.scaleSvgNode(c,a),Promise.all([this.convertImagesToBase64(c),this.embedFonts(c)]).then(()=>{l=(new XMLSerializer).serializeToString(c),t(l.replace(/ /g," "))})})}convertImagesToBase64(e){const t="http://www.w3.org/1999/xlink",s=e.getElementsByTagName("image"),a=Array.from(s).map(e=>{const s=e.getAttributeNS(t,"href"),a=e.getAttribute("href"),r=s||a;if(!r||r.startsWith("data:"))return Promise.resolve();const o=r=>{s&&e.setAttributeNS(t,"href",r),!a&&s||e.setAttribute("href",r)};return this.fetchAsDataUri(r).then(o).catch(()=>this.getBase64FromUrl(r).then(o).catch(e=>{}))});return Promise.all(a)}getBase64FromUrl(e){return i.isSSR()?Promise.resolve(e):new Promise((t,s)=>{const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const s=e.getContext("2d");s&&s.drawImage(a,0,0),t(e.toDataURL())},a.onerror=s,a.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 i.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const s=this.w,a=e?e.scale||e.width/s.globals.svgWidth:1,r=document.createElement("canvas");r.width=s.globals.svgWidth*a,r.height=parseInt(s.dom.elWrap.style.height,10)*a;const o=this.resolveExportBackground(),i=r.getContext("2d");i&&(i.fillStyle=o,i.fillRect(0,0,r.width,r.height),this.getSvgString(a).then(e=>{const s="data:image/svg+xml,"+encodeURIComponent(e),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{i.drawImage(a,0,0);const e=r;if(e.msToBlob){const s=e.msToBlob();t({blob:s})}else{const e=r.toDataURL("image/png");t({imgURI:e})}},a.src=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,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"):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;e||(e=l.config.series);let c=[];const h=[];let g="";const p=l.seriesData.series.map((e,t)=>-1===l.globals.collapsedSeriesIndices.indexOf(t)?e:[]),u=e=>{if(null==e||o.isNumber(e))return e;const t=String(e);return/^[=+\-@\t\r]/.test(t)?`'${t}`:t},f=e=>"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(e):"datetime"===l.config.xaxis.type&&String(e).length>=10?new Date(e).toDateString():o.isNumber(e)?e:u(e.split(i).join("")),d=e=>"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(e):u(e),m=Math.max(...e.map(e=>e.data?e.data.length:0)),x=new a(this.w),y=new s(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),b=e=>{let t="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){const s=l.formatters.yLabelFormatters[0],a=new r(this.ctx.w).getActiveConfigSeriesIndex();t=s(l.labelData.labels[e],{seriesIndex:a,dataPointIndex:e,w:l})}else t=y.getLabel(l.labelData.labels,l.labelData.timescaleLabels,0,e).text;"datetime"===l.config.xaxis.type&&(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 null===t?"nullvalue":(Array.isArray(t)&&(t=t.join(" ")),o.isNumber(t)?t:t.split(i).join(""))},w=(t,s)=>{var a,r,o,n,g,u;if(c.length&&0===s&&h.push(c.join(i)),t.data){const y=t.data.length?t.data:[...Array(m)].map(()=>"");for(let m=0;m<y.length;m++){c=[];let y=b(m);if("nullvalue"!==y){if(y||(x.isFormatXY()?y=e[s].data[m].x:x.isFormat2DArray()&&(y=e[s].data[m]?e[s].data[m][0]:"")),0===s){c.push(f(y));for(let t=0;t<l.seriesData.series.length;t++){const s=x.isFormatXY()?null==(a=e[t].data[m])?void 0:a.y:p[t][m];c.push(d(s))}}("candlestick"===l.config.chart.type||t.type&&"candlestick"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),("boxPlot"===l.config.chart.type||t.type&&"boxPlot"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleM[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),"rangeBar"===l.config.chart.type&&(c.pop(),c.push(l.rangeData.seriesRangeStart[s][m]),c.push(l.rangeData.seriesRangeEnd[s][m])),("violin"===l.config.chart.type||t.type&&"violin"===t.type)&&(c.pop(),c.push(null==(r=l.violinData.seriesViolinMin[s])?void 0:r[m]),c.push(null==(o=l.violinData.seriesViolinMax[s])?void 0:o[m]),c.push(null!=(u=null==(g=null==(n=l.violinData.seriesViolinPoints[s])?void 0:n[m])?void 0:g.length)?u:0)),c.length&&h.push(c.join(i))}}}};c.push(l.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===l.config.chart.type?(c.push("minimum"),c.push("q1"),c.push("median"),c.push("q3"),c.push("maximum")):"candlestick"===l.config.chart.type?(c.push("open"),c.push("high"),c.push("low"),c.push("close")):"rangeBar"===l.config.chart.type?(c.push("minimum"),c.push("maximum")):"violin"===l.config.chart.type?(c.push("minimum"),c.push("maximum"),c.push("observations")):e.map((e,t)=>{const s=(e.name?e.name:`series-${t}`)+"";l.globals.axisCharts&&c.push(s.split(i).join("")?s.split(i).join(""):`series-${t}`)}),l.globals.axisCharts||(c.push(l.config.chart.toolbar.export.csv.headerValue),h.push(c.join(i))),l.globals.allSeriesHasEqualX||!l.globals.axisCharts||l.config.xaxis.categories.length||l.config.labels.length?e.map((e,t)=>{l.globals.axisCharts?w(e,t):(c=[],c.push(f(l.labelData.labels[t])),c.push(d(p[t])),h.push(c.join(i)))}):(()=>{const t=new Map;e.forEach((s,a)=>{null==s||s.data.forEach(s=>{let r,o;if(x.isFormatXY())r=s.x,o=s.y;else{if(!x.isFormat2DArray())return;r=s[0],o=s[1]}const i=String(r);let n=t.get(i);n||(n={cat:r,values:Array(e.length).fill("")},t.set(i,n)),n.values[a]=d(o)})}),c.length&&h.push(c.join(i)),Array.from(t.keys()).sort().forEach(e=>{const{cat:s,values:a}=t.get(e);h.push([f(s),...a].join(i))})})(),g+=h.join(n),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+g),t||l.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(e,t,s){if(i.isSSR())return;const a=document.createElement("a");a.href=e,a.download=(t||this.w.globals.chartID)+s,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
import * as _core from "apexcharts/core";
|
|
@@ -771,8 +771,7 @@ class Exports {
|
|
|
771
771
|
}
|
|
772
772
|
};
|
|
773
773
|
const handleUnequalXValues = () => {
|
|
774
|
-
const
|
|
775
|
-
const data = {};
|
|
774
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
776
775
|
series.forEach((s, sI) => {
|
|
777
776
|
s == null ? void 0 : s.data.forEach((dataItem) => {
|
|
778
777
|
let cat, value;
|
|
@@ -785,23 +784,22 @@ class Exports {
|
|
|
785
784
|
} else {
|
|
786
785
|
return;
|
|
787
786
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
787
|
+
const key = String(cat);
|
|
788
|
+
let row = byCategory.get(key);
|
|
789
|
+
if (!row) {
|
|
790
|
+
row = { cat, values: Array(series.length).fill("") };
|
|
791
|
+
byCategory.set(key, row);
|
|
793
792
|
}
|
|
794
|
-
|
|
795
|
-
categories.add(cat);
|
|
793
|
+
row.values[sI] = getFormattedValue(value);
|
|
796
794
|
});
|
|
797
795
|
});
|
|
798
796
|
if (columns.length) {
|
|
799
797
|
rows.push(columns.join(columnDelimiter));
|
|
800
798
|
}
|
|
801
|
-
Array.from(
|
|
802
|
-
const values = (
|
|
803
|
-
/** @type {
|
|
804
|
-
|
|
799
|
+
Array.from(byCategory.keys()).sort().forEach((key) => {
|
|
800
|
+
const { cat, values } = (
|
|
801
|
+
/** @type {{cat: any, values: string[]}} */
|
|
802
|
+
byCategory.get(key)
|
|
805
803
|
);
|
|
806
804
|
rows.push([getFormattedCategory(cat), ...values].join(columnDelimiter));
|
|
807
805
|
});
|
package/dist/features/exports.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexExports={})}(this,function(e){"use strict";const t=globalThis.ApexCharts,s=globalThis.ApexCharts.__internals.__apex_axes_AxesUtils,a=globalThis.ApexCharts.__internals.__apex_Data,r=globalThis.ApexCharts.__internals.__apex_Series,i=globalThis.ApexCharts.__internals.__apex_Utils,o=globalThis.ApexCharts.__internals.__apex_Environment_Environment,n=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,l=globalThis.ApexCharts.__internals,c=l.__apex_math_SVGNS;l.__apex_math_Point,l.__apex_math_Matrix,l.__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")),a=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",s*t),e.setAttributeNS(null,"height",a*t),e.setAttributeNS(null,"viewBox","0 0 "+s+" "+a)}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 a;try{a=t[e].toDataURL()}catch(e){continue}const r=s[e],i=document.createElementNS(c,"image");i.setAttribute("x",r.getAttribute("x")||"0"),i.setAttribute("y",r.getAttribute("y")||"0"),i.setAttribute("width",r.getAttribute("width")||"0"),i.setAttribute("height",r.getAttribute("height")||"0"),i.setAttribute("href",a),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),r.parentNode&&r.parentNode.replaceChild(i,r)}}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"),a=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"}),a&&this.setStyleDefaults(e,{"flex-wrap":"wrap"}),s||a&&t.contains("apexcharts-align-left")?this.setStyleDefaults(e,{"justify-content":"flex-start","align-items":"flex-start"}):a&&t.contains("apexcharts-align-center")?this.setStyleDefaults(e,{"justify-content":"center","align-items":"center"}):a&&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(!o.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=n.getComputedStyle(t),a=s&&s.fontFamily;a&&a.split(",").forEach(t=>{const s=t.trim().replace(/^['"]|['"]$/g,"");s&&e.add(s.toLowerCase())})}),e}collectFontFaceRules(){if(!o.isBrowser())return Promise.resolve([]);const e=[],t=[],s=t=>{(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})})};return Array.from(document.styleSheets||[]).forEach(e=>{let a=null;try{a=e.cssRules}catch(e){a=null}a?Array.from(a).forEach(e=>{5===e.type&&e.cssText&&s(e.cssText)}):e.href&&t.push(fetch(e.href).then(e=>e.ok?e.text():"").then(s).catch(()=>{}))}),Promise.all(t).then(()=>e)}embedFonts(e){const t=this.w;if(!o.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).catch(()=>null))):Promise.resolve([])}).then(t=>{const s=(t||[]).filter(Boolean).join("\n");if(!s)return;const a=document.createElementNS(c,"style");a.textContent=s,e.insertBefore(a,e.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(e){const t=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let a;for(;null!==(a=s.exec(e));)a[2].startsWith("data:")||t.push(a[2]);return t.length?Promise.all(t.map(e=>this.fetchAsDataUri(e).then(t=>({url:e,dataUri:t})).catch(()=>({url:e,dataUri:null})))).then(t=>{let s=e,a=0;return t.forEach(({url:e,dataUri:t})=>{t&&(s=s.split(e).join(t),a++)}),a?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 a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${s};base64,${btoa(a)}`})})}getSvgString(e){return new Promise(t=>{const s=this.w;let a=e||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;a||(a=1);const r=s.globals.svgWidth*a,i=s.globals.svgHeight*a,o=s.dom.elWrap.cloneNode(!0);o.style.width=r+"px",o.style.height=i+"px",this.inlineCanvasLayers(o),this.applyExportStyles(o);const n=(new XMLSerializer).serializeToString(o);let l=`\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="${s.globals.svgWidth}px" height="${s.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px; height:${i}px;">\n ${n}\n </div>\n </foreignObject>\n </svg>\n `;const c=this.svgStringToNode(l);1!==a&&this.scaleSvgNode(c,a),Promise.all([this.convertImagesToBase64(c),this.embedFonts(c)]).then(()=>{l=(new XMLSerializer).serializeToString(c),t(l.replace(/ /g," "))})})}convertImagesToBase64(e){const t="http://www.w3.org/1999/xlink",s=e.getElementsByTagName("image"),a=Array.from(s).map(e=>{const s=e.getAttributeNS(t,"href"),a=e.getAttribute("href"),r=s||a;if(!r||r.startsWith("data:"))return Promise.resolve();const i=r=>{s&&e.setAttributeNS(t,"href",r),!a&&s||e.setAttribute("href",r)};return this.fetchAsDataUri(r).then(i).catch(()=>this.getBase64FromUrl(r).then(i).catch(e=>{console.error("Error converting image to base64:",e)}))});return Promise.all(a)}getBase64FromUrl(e){return o.isSSR()?Promise.resolve(e):new Promise((t,s)=>{const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const s=e.getContext("2d");s&&s.drawImage(a,0,0),t(e.toDataURL())},a.onerror=s,a.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 o.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const s=this.w,a=e?e.scale||e.width/s.globals.svgWidth:1,r=document.createElement("canvas");r.width=s.globals.svgWidth*a,r.height=parseInt(s.dom.elWrap.style.height,10)*a;const i=this.resolveExportBackground(),o=r.getContext("2d");o&&(o.fillStyle=i,o.fillRect(0,0,r.width,r.height),this.getSvgString(a).then(e=>{const s="data:image/svg+xml,"+encodeURIComponent(e),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{o.drawImage(a,0,0);const e=r;if(e.msToBlob){const s=e.msToBlob();t({blob:s})}else{const e=r.toDataURL("image/png");t({imgURI:e})}},a.src=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,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"):this.triggerDownload(e,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:e,fileName:t,columnDelimiter:o=",",lineDelimiter:n="\n"}){const l=this.w;e||(e=l.config.series);let c=[];const h=[];let p="";const g=l.seriesData.series.map((e,t)=>-1===l.globals.collapsedSeriesIndices.indexOf(t)?e:[]),u=e=>{if(null==e||i.isNumber(e))return e;const t=String(e);return/^[=+\-@\t\r]/.test(t)?`'${t}`:t},f=e=>"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(e):"datetime"===l.config.xaxis.type&&String(e).length>=10?new Date(e).toDateString():i.isNumber(e)?e:u(e.split(o).join("")),d=e=>"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(e):u(e),m=Math.max(...e.map(e=>e.data?e.data.length:0)),x=new a(this.w),y=new s(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),b=e=>{let t="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){const s=l.formatters.yLabelFormatters[0],a=new r(this.ctx.w).getActiveConfigSeriesIndex();t=s(l.labelData.labels[e],{seriesIndex:a,dataPointIndex:e,w:l})}else t=y.getLabel(l.labelData.labels,l.labelData.timescaleLabels,0,e).text;"datetime"===l.config.xaxis.type&&(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 null===t?"nullvalue":(Array.isArray(t)&&(t=t.join(" ")),i.isNumber(t)?t:t.split(o).join(""))},w=(t,s)=>{var a,r,i,n,p,u;if(c.length&&0===s&&h.push(c.join(o)),t.data){const y=t.data.length?t.data:[...Array(m)].map(()=>"");for(let m=0;m<y.length;m++){c=[];let y=b(m);if("nullvalue"!==y){if(y||(x.isFormatXY()?y=e[s].data[m].x:x.isFormat2DArray()&&(y=e[s].data[m]?e[s].data[m][0]:"")),0===s){c.push(f(y));for(let t=0;t<l.seriesData.series.length;t++){const s=x.isFormatXY()?null==(a=e[t].data[m])?void 0:a.y:g[t][m];c.push(d(s))}}("candlestick"===l.config.chart.type||t.type&&"candlestick"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),("boxPlot"===l.config.chart.type||t.type&&"boxPlot"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleM[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),"rangeBar"===l.config.chart.type&&(c.pop(),c.push(l.rangeData.seriesRangeStart[s][m]),c.push(l.rangeData.seriesRangeEnd[s][m])),("violin"===l.config.chart.type||t.type&&"violin"===t.type)&&(c.pop(),c.push(null==(r=l.violinData.seriesViolinMin[s])?void 0:r[m]),c.push(null==(i=l.violinData.seriesViolinMax[s])?void 0:i[m]),c.push(null!=(u=null==(p=null==(n=l.violinData.seriesViolinPoints[s])?void 0:n[m])?void 0:p.length)?u:0)),c.length&&h.push(c.join(o))}}}};c.push(l.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===l.config.chart.type?(c.push("minimum"),c.push("q1"),c.push("median"),c.push("q3"),c.push("maximum")):"candlestick"===l.config.chart.type?(c.push("open"),c.push("high"),c.push("low"),c.push("close")):"rangeBar"===l.config.chart.type?(c.push("minimum"),c.push("maximum")):"violin"===l.config.chart.type?(c.push("minimum"),c.push("maximum"),c.push("observations")):e.map((e,t)=>{const s=(e.name?e.name:`series-${t}`)+"";l.globals.axisCharts&&c.push(s.split(o).join("")?s.split(o).join(""):`series-${t}`)}),l.globals.axisCharts||(c.push(l.config.chart.toolbar.export.csv.headerValue),h.push(c.join(o))),l.globals.allSeriesHasEqualX||!l.globals.axisCharts||l.config.xaxis.categories.length||l.config.labels.length?e.map((e,t)=>{l.globals.axisCharts?w(e,t):(c=[],c.push(f(l.labelData.labels[t])),c.push(d(g[t])),h.push(c.join(o)))}):(()=>{const t=new Set,s={};e.forEach((a,r)=>{null==a||a.data.forEach(a=>{let i,o;if(x.isFormatXY())i=a.x,o=a.y;else{if(!x.isFormat2DArray())return;i=a[0],o=a[1]}s[i]||(s[i]=Array(e.length).fill("")),s[i][r]=d(o),t.add(i)})}),c.length&&h.push(c.join(o)),Array.from(t).sort().forEach(e=>{const t=s[e];h.push([f(e),...t].join(o))})})(),p+=h.join(n),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+p),t||l.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(e,t,s){if(o.isSSR())return;const a=document.createElement("a");a.href=e,a.download=(t||this.w.globals.chartID)+s,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}}),e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
5
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexExports={})}(this,function(e){"use strict";const t=globalThis.ApexCharts,s=globalThis.ApexCharts.__internals.__apex_axes_AxesUtils,a=globalThis.ApexCharts.__internals.__apex_Data,r=globalThis.ApexCharts.__internals.__apex_Series,i=globalThis.ApexCharts.__internals.__apex_Utils,o=globalThis.ApexCharts.__internals.__apex_Environment_Environment,n=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,l=globalThis.ApexCharts.__internals,c=l.__apex_math_SVGNS;l.__apex_math_Point,l.__apex_math_Matrix,l.__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")),a=parseFloat(e.getAttributeNS(null,"height"));e.setAttributeNS(null,"width",s*t),e.setAttributeNS(null,"height",a*t),e.setAttributeNS(null,"viewBox","0 0 "+s+" "+a)}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 a;try{a=t[e].toDataURL()}catch(e){continue}const r=s[e],i=document.createElementNS(c,"image");i.setAttribute("x",r.getAttribute("x")||"0"),i.setAttribute("y",r.getAttribute("y")||"0"),i.setAttribute("width",r.getAttribute("width")||"0"),i.setAttribute("height",r.getAttribute("height")||"0"),i.setAttribute("href",a),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),r.parentNode&&r.parentNode.replaceChild(i,r)}}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"),a=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"}),a&&this.setStyleDefaults(e,{"flex-wrap":"wrap"}),s||a&&t.contains("apexcharts-align-left")?this.setStyleDefaults(e,{"justify-content":"flex-start","align-items":"flex-start"}):a&&t.contains("apexcharts-align-center")?this.setStyleDefaults(e,{"justify-content":"center","align-items":"center"}):a&&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(!o.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=n.getComputedStyle(t),a=s&&s.fontFamily;a&&a.split(",").forEach(t=>{const s=t.trim().replace(/^['"]|['"]$/g,"");s&&e.add(s.toLowerCase())})}),e}collectFontFaceRules(){if(!o.isBrowser())return Promise.resolve([]);const e=[],t=[],s=t=>{(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})})};return Array.from(document.styleSheets||[]).forEach(e=>{let a=null;try{a=e.cssRules}catch(e){a=null}a?Array.from(a).forEach(e=>{5===e.type&&e.cssText&&s(e.cssText)}):e.href&&t.push(fetch(e.href).then(e=>e.ok?e.text():"").then(s).catch(()=>{}))}),Promise.all(t).then(()=>e)}embedFonts(e){const t=this.w;if(!o.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).catch(()=>null))):Promise.resolve([])}).then(t=>{const s=(t||[]).filter(Boolean).join("\n");if(!s)return;const a=document.createElementNS(c,"style");a.textContent=s,e.insertBefore(a,e.firstChild)}).catch(()=>{}):Promise.resolve()}inlineFontFaceUrls(e){const t=[],s=/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi;let a;for(;null!==(a=s.exec(e));)a[2].startsWith("data:")||t.push(a[2]);return t.length?Promise.all(t.map(e=>this.fetchAsDataUri(e).then(t=>({url:e,dataUri:t})).catch(()=>({url:e,dataUri:null})))).then(t=>{let s=e,a=0;return t.forEach(({url:e,dataUri:t})=>{t&&(s=s.split(e).join(t),a++)}),a?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 a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode.apply(null,t.subarray(e,e+32768));return`data:${s};base64,${btoa(a)}`})})}getSvgString(e){return new Promise(t=>{const s=this.w;let a=e||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;a||(a=1);const r=s.globals.svgWidth*a,i=s.globals.svgHeight*a,o=s.dom.elWrap.cloneNode(!0);o.style.width=r+"px",o.style.height=i+"px",this.inlineCanvasLayers(o),this.applyExportStyles(o);const n=(new XMLSerializer).serializeToString(o);let l=`\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="${s.globals.svgWidth}px" height="${s.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px; height:${i}px;">\n ${n}\n </div>\n </foreignObject>\n </svg>\n `;const c=this.svgStringToNode(l);1!==a&&this.scaleSvgNode(c,a),Promise.all([this.convertImagesToBase64(c),this.embedFonts(c)]).then(()=>{l=(new XMLSerializer).serializeToString(c),t(l.replace(/ /g," "))})})}convertImagesToBase64(e){const t="http://www.w3.org/1999/xlink",s=e.getElementsByTagName("image"),a=Array.from(s).map(e=>{const s=e.getAttributeNS(t,"href"),a=e.getAttribute("href"),r=s||a;if(!r||r.startsWith("data:"))return Promise.resolve();const i=r=>{s&&e.setAttributeNS(t,"href",r),!a&&s||e.setAttribute("href",r)};return this.fetchAsDataUri(r).then(i).catch(()=>this.getBase64FromUrl(r).then(i).catch(e=>{console.error("Error converting image to base64:",e)}))});return Promise.all(a)}getBase64FromUrl(e){return o.isSSR()?Promise.resolve(e):new Promise((t,s)=>{const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{const e=document.createElement("canvas");e.width=a.width,e.height=a.height;const s=e.getContext("2d");s&&s.drawImage(a,0,0),t(e.toDataURL())},a.onerror=s,a.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 o.isSSR()?Promise.resolve({imgURI:""}):new Promise(t=>{const s=this.w,a=e?e.scale||e.width/s.globals.svgWidth:1,r=document.createElement("canvas");r.width=s.globals.svgWidth*a,r.height=parseInt(s.dom.elWrap.style.height,10)*a;const i=this.resolveExportBackground(),o=r.getContext("2d");o&&(o.fillStyle=i,o.fillRect(0,0,r.width,r.height),this.getSvgString(a).then(e=>{const s="data:image/svg+xml,"+encodeURIComponent(e),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{o.drawImage(a,0,0);const e=r;if(e.msToBlob){const s=e.msToBlob();t({blob:s})}else{const e=r.toDataURL("image/png");t({imgURI:e})}},a.src=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,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"):this.triggerDownload(e,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:e,fileName:t,columnDelimiter:o=",",lineDelimiter:n="\n"}){const l=this.w;e||(e=l.config.series);let c=[];const h=[];let p="";const g=l.seriesData.series.map((e,t)=>-1===l.globals.collapsedSeriesIndices.indexOf(t)?e:[]),u=e=>{if(null==e||i.isNumber(e))return e;const t=String(e);return/^[=+\-@\t\r]/.test(t)?`'${t}`:t},f=e=>"function"==typeof l.config.chart.toolbar.export.csv.categoryFormatter?l.config.chart.toolbar.export.csv.categoryFormatter(e):"datetime"===l.config.xaxis.type&&String(e).length>=10?new Date(e).toDateString():i.isNumber(e)?e:u(e.split(o).join("")),d=e=>"function"==typeof l.config.chart.toolbar.export.csv.valueFormatter?l.config.chart.toolbar.export.csv.valueFormatter(e):u(e),m=Math.max(...e.map(e=>e.data?e.data.length:0)),x=new a(this.w),y=new s(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),b=e=>{let t="";if(l.globals.axisCharts){if("category"===l.config.xaxis.type||l.config.xaxis.convertedCatToNumeric)if(l.globals.isBarHorizontal){const s=l.formatters.yLabelFormatters[0],a=new r(this.ctx.w).getActiveConfigSeriesIndex();t=s(l.labelData.labels[e],{seriesIndex:a,dataPointIndex:e,w:l})}else t=y.getLabel(l.labelData.labels,l.labelData.timescaleLabels,0,e).text;"datetime"===l.config.xaxis.type&&(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 null===t?"nullvalue":(Array.isArray(t)&&(t=t.join(" ")),i.isNumber(t)?t:t.split(o).join(""))},v=(t,s)=>{var a,r,i,n,p,u;if(c.length&&0===s&&h.push(c.join(o)),t.data){const y=t.data.length?t.data:[...Array(m)].map(()=>"");for(let m=0;m<y.length;m++){c=[];let y=b(m);if("nullvalue"!==y){if(y||(x.isFormatXY()?y=e[s].data[m].x:x.isFormat2DArray()&&(y=e[s].data[m]?e[s].data[m][0]:"")),0===s){c.push(f(y));for(let t=0;t<l.seriesData.series.length;t++){const s=x.isFormatXY()?null==(a=e[t].data[m])?void 0:a.y:g[t][m];c.push(d(s))}}("candlestick"===l.config.chart.type||t.type&&"candlestick"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),("boxPlot"===l.config.chart.type||t.type&&"boxPlot"===t.type)&&(c.pop(),c.push(l.candleData.seriesCandleO[s][m]),c.push(l.candleData.seriesCandleH[s][m]),c.push(l.candleData.seriesCandleM[s][m]),c.push(l.candleData.seriesCandleL[s][m]),c.push(l.candleData.seriesCandleC[s][m])),"rangeBar"===l.config.chart.type&&(c.pop(),c.push(l.rangeData.seriesRangeStart[s][m]),c.push(l.rangeData.seriesRangeEnd[s][m])),("violin"===l.config.chart.type||t.type&&"violin"===t.type)&&(c.pop(),c.push(null==(r=l.violinData.seriesViolinMin[s])?void 0:r[m]),c.push(null==(i=l.violinData.seriesViolinMax[s])?void 0:i[m]),c.push(null!=(u=null==(p=null==(n=l.violinData.seriesViolinPoints[s])?void 0:n[m])?void 0:p.length)?u:0)),c.length&&h.push(c.join(o))}}}};c.push(l.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===l.config.chart.type?(c.push("minimum"),c.push("q1"),c.push("median"),c.push("q3"),c.push("maximum")):"candlestick"===l.config.chart.type?(c.push("open"),c.push("high"),c.push("low"),c.push("close")):"rangeBar"===l.config.chart.type?(c.push("minimum"),c.push("maximum")):"violin"===l.config.chart.type?(c.push("minimum"),c.push("maximum"),c.push("observations")):e.map((e,t)=>{const s=(e.name?e.name:`series-${t}`)+"";l.globals.axisCharts&&c.push(s.split(o).join("")?s.split(o).join(""):`series-${t}`)}),l.globals.axisCharts||(c.push(l.config.chart.toolbar.export.csv.headerValue),h.push(c.join(o))),l.globals.allSeriesHasEqualX||!l.globals.axisCharts||l.config.xaxis.categories.length||l.config.labels.length?e.map((e,t)=>{l.globals.axisCharts?v(e,t):(c=[],c.push(f(l.labelData.labels[t])),c.push(d(g[t])),h.push(c.join(o)))}):(()=>{const t=new Map;e.forEach((s,a)=>{null==s||s.data.forEach(s=>{let r,i;if(x.isFormatXY())r=s.x,i=s.y;else{if(!x.isFormat2DArray())return;r=s[0],i=s[1]}const o=String(r);let n=t.get(o);n||(n={cat:r,values:Array(e.length).fill("")},t.set(o,n)),n.values[a]=d(i)})}),c.length&&h.push(c.join(o)),Array.from(t.keys()).sort().forEach(e=>{const{cat:s,values:a}=t.get(e);h.push([f(s),...a].join(o))})})(),p+=h.join(n),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+p),t||l.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(e,t,s){if(o.isSSR())return;const a=document.createElement("a");a.href=e,a.download=(t||this.w.globals.chartID)+s,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}}),e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function e(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const 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_Environment_Environment,s=t.__apex_BrowserAPIs_BrowserAPIs;class n{constructor(e,t){if(this.w=e,this.ctx=t,"os"!==e.config.theme.follow||!r.isBrowser())return;const s=this._ensureMedia();s&&(this._applyToConfig(s),this._ensureListeners(s))}_ensureMedia(){if(!this.ctx._osThemeMedia){const e=s.matchMedia("(prefers-color-scheme: dark)"),t=s.matchMedia("(prefers-contrast: more)");if(!e&&!t)return null;this.ctx._osThemeMedia={dark:e,contrast:t,handler:null}}return this.ctx._osThemeMedia}_applyToConfig(e){const t=this.w.config.theme;e.dark&&(t.mode=e.dark.matches?"dark":"light"),e.contrast&&e.contrast.matches&&(t.accessibility=t.accessibility||{},t.accessibility.colorBlindMode="highContrast")}_ensureListeners(e){if(e.handler)return;const t=this.ctx,r=()=>{const e=t._osThemeMedia;if(!e)return;const r={mode:e.dark&&e.dark.matches?"dark":"light"};e.contrast&&e.contrast.matches?r.accessibility={colorBlindMode:"highContrast"}:r.accessibility={colorBlindMode:""},t.updateOptions({theme:r},!1,!0,!1)};n._add(e.dark,r),n._add(e.contrast,r),e.handler=r}teardown(){const e=this.ctx._osThemeMedia;e&&(e.handler&&(n._remove(e.dark,e.handler),n._remove(e.contrast,e.handler)),this.ctx._osThemeMedia=null)}static _add(e,t){e&&("function"==typeof e.addEventListener?e.addEventListener("change",t):"function"==typeof e.addListener&&e.addListener(t))}static _remove(e,t){e&&("function"==typeof e.removeEventListener?e.removeEventListener("change",t):"function"==typeof e.removeListener&&e.removeListener(t))}}t.default.registerFeatures({osThemeWatcher:n}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>t.default});
|
package/dist/features/facet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ApexFacet={})}(this,function(e){"use strict";const t=globalThis.ApexCharts,s=globalThis.ApexCharts.__internals.__apex_Environment_Environment,n=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs;class i{constructor(e,t){if(this.w=e,this.ctx=t,"os"!==e.config.theme.follow||!s.isBrowser())return;const n=this._ensureMedia();n&&(this._applyToConfig(n),this._ensureListeners(n))}_ensureMedia(){if(!this.ctx._osThemeMedia){const e=n.matchMedia("(prefers-color-scheme: dark)"),t=n.matchMedia("(prefers-contrast: more)");if(!e&&!t)return null;this.ctx._osThemeMedia={dark:e,contrast:t,handler:null}}return this.ctx._osThemeMedia}_applyToConfig(e){const t=this.w.config.theme;e.dark&&(t.mode=e.dark.matches?"dark":"light"),e.contrast&&e.contrast.matches&&(t.accessibility=t.accessibility||{},t.accessibility.colorBlindMode="highContrast")}_ensureListeners(e){if(e.handler)return;const t=this.ctx,s=()=>{const e=t._osThemeMedia;if(!e)return;const s={mode:e.dark&&e.dark.matches?"dark":"light"};e.contrast&&e.contrast.matches?s.accessibility={colorBlindMode:"highContrast"}:s.accessibility={colorBlindMode:""},t.updateOptions({theme:s},!1,!0,!1)};i._add(e.dark,s),i._add(e.contrast,s),e.handler=s}teardown(){const e=this.ctx._osThemeMedia;e&&(e.handler&&(i._remove(e.dark,e.handler),i._remove(e.contrast,e.handler)),this.ctx._osThemeMedia=null)}static _add(e,t){e&&("function"==typeof e.addEventListener?e.addEventListener("change",t):"function"==typeof e.addListener&&e.addListener(t))}static _remove(e,t){e&&("function"==typeof e.removeEventListener?e.removeEventListener("change",t):"function"==typeof e.removeListener&&e.removeListener(t))}}t.registerFeatures({osThemeWatcher:i}),e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
"use strict";var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function n(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 n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const s=n(require("apexcharts/core")),o=s.__apex_Utils,r=s.__apex_Environment_Environment;function a(t,e){const i=null!=t,n=null!=e;return i||n?{min:i?t:null,max:n?e:null}:null}function l(t){return Array.isArray(t)?t.map(t=>Array.isArray(t)?t.slice():t):[]}function c(t,e){return"function"==typeof t&&e?t===e.addXaxisAnnotation?"xaxis":t===e.addYaxisAnnotation?"yaxis":t===e.addPointAnnotation?"point":null:null}function h(t,e){const i=t.config.annotations?o.clone(t.config.annotations):null,n=[],s=t.globals.memory&&t.globals.memory.methodsToExec||[];for(const t of s){if(!t||"addAnnotation"!==t.label)continue;const i=c(t.method,e);i&&n.push({kind:i,params:o.clone(t.params)})}return{static:i,dynamic:n}}function d(t){const e=t&&t.measure;if(!e||"function"!=typeof e.getPins)return null;const i=e.getPins();return Array.isArray(i)&&i.length?{pins:i}:null}function u(t,e){if(!t||!e)return;const i=t.w;i.interact.zoomed=!!e.zoomed,function(t,e,i){const n=t.w;if(null==e&&null==i)return;const s=n.globals.seriesNames||[],o=new Set([...e||[],...i||[]]),r=new Set([...n.globals.collapsedSeriesIndices||[],...n.globals.ancillaryCollapsedSeriesIndices||[]]);for(let e=0;e<s.length;e++){const i=s[e];if(null==i)continue;const n=o.has(e),a=r.has(e);n&&!a?t.hideSeries(i):!n&&a&&t.showSeries(i)}}(t,e.collapsed,e.ancillaryCollapsed),e.annotations&&Array.isArray(e.annotations.dynamic)&&e.annotations.dynamic.forEach(e=>{const i=function(t){switch(t){case"xaxis":return"addXaxisAnnotation";case"yaxis":return"addYaxisAnnotation";case"point":return"addPointAnnotation";default:return null}}(e.kind);i&&"function"==typeof t[i]&&t[i](e.params,!0)}),function(t,e){Array.isArray(e)&&(t.w.interact.selectedDataPoints=l(e))}(t,e.selectedDataPoints),e.locale&&e.locale!==i.config.chart.defaultLocale&&t.setLocale(e.locale),t.measure&&"function"==typeof t.measure.setPins&&t.measure.setPins(e.measure&&e.measure.pins||[])}s.default.registerFeatures({history:class{constructor(t,e){this.w=t,this.ctx=e,this.stack=[],this.pointer=-1,this.applying=!1,this._batching=!1,this._counter=0,this._coalesceTimer=null,this._settleTimer=null,this._pendingLabel=void 0,this._keydownTarget=null,this._pointerTarget=null,this._engaged=!1,this._wired=!1,this._readConfig(),this._onMounted=this._onMounted.bind(this),this._onUpdated=this._onUpdated.bind(this),this._onSelection=this._onSelection.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this.init()}_readConfig(){const t=this.w,e=t.config.chart&&t.config.chart.history||{};this.enabled=!!e.enabled,this.maxDepth=e.maxDepth>0?e.maxDepth:100,this.coalesceMs=null!=e.coalesceMs?e.coalesceMs:250,this.keyboard=!1!==e.keyboard}_syncConfig(){this._readConfig(),this.enabled&&this.keyboard?this._wireKeyboard():this._unwireKeyboard()}init(){this._wired||(this._wired=!0,this.ctx.addEventListener("mounted",this._onMounted),this.ctx.addEventListener("updated",this._onUpdated),this.ctx.addEventListener("scrolled",this._onUpdated),this.ctx.addEventListener("dataPointSelection",this._onSelection),this.enabled&&this.keyboard&&this._wireKeyboard())}_wireKeyboard(){if(this._keydownTarget)return;const t=this.ctx.el,e=t&&t.ownerDocument;r.isBrowser()&&e&&(e.addEventListener("keydown",this._onKeyDown),e.addEventListener("pointerdown",this._onPointerDown,!0),e.addEventListener("mousedown",this._onPointerDown,!0),this._keydownTarget=e,this._pointerTarget=e)}_unwireKeyboard(){this._keydownTarget&&(this._keydownTarget.removeEventListener("keydown",this._onKeyDown),this._keydownTarget=null),this._pointerTarget&&(this._pointerTarget.removeEventListener("pointerdown",this._onPointerDown,!0),this._pointerTarget.removeEventListener("mousedown",this._onPointerDown,!0),this._pointerTarget=null),this._engaged=!1}_onMounted(){this._syncConfig(),this.enabled&&0===this.stack.length&&this._commit("initial",!0)}_onUpdated(){this._syncConfig(),this.enabled&&(this.applying?this._refreshSettle():this._schedule("update"))}_onSelection(){this.enabled&&!this.applying&&this._schedule("selection")}_onPointerDown(t){const e=this.ctx.el;this._engaged=!!(e&&t.target&&e.contains(t.target))}_onKeyDown(t){if(!t.metaKey&&!t.ctrlKey)return;const e=(t.key||"").toLowerCase();if("z"!==e&&"y"!==e)return;const i=this.ctx.el;if(!i)return;const n=i.ownerDocument,s=n&&n.activeElement;if(function(t){if(!t)return!1;const e=t.tagName;return"INPUT"===e||"TEXTAREA"===e||"SELECT"===e||!0===t.isContentEditable}(s))return;if(!i.contains(s)&&!this._engaged)return;const o="y"===e||t.shiftKey;t.preventDefault(),o?this.redo():this.undo()}_schedule(t){this.applying||this._batching||!this.enabled||(this._pendingLabel=t,this.coalesceMs>0&&r.isBrowser()?(clearTimeout(this._coalesceTimer),this._coalesceTimer=setTimeout(()=>this._commit(this._pendingLabel),this.coalesceMs)):this._commit(t))}_commit(t,e){if(clearTimeout(this._coalesceTimer),this._coalesceTimer=null,!e&&(this.applying||this._batching))return;const i=this._capture(t),n=this.stack[this.pointer];if(!n||n.sig!==i.sig){for(this.pointer<this.stack.length-1&&this.stack.splice(this.pointer+1),this.stack.push(i),this.pointer=this.stack.length-1;this.stack.length>this.maxDepth;)this.stack.shift(),this.pointer--;this._emitChange()}}_capture(t){const e=function(t,e){var i,n;const s=t.config.xaxis||{},o=(Array.isArray(t.config.yaxis)?t.config.yaxis:t.config.yaxis?[t.config.yaxis]:[]).map(t=>a(t&&t.min,t&&t.max)),r=o.some(t=>null!==t),c=t.config.theme,u=e&&e.drilldown;return{v:1,window:{xaxis:a(s.min,s.max),yaxis:r?o:null},zoomed:!!t.interact.zoomed,collapsed:(t.globals.collapsedSeriesIndices||[]).slice(),ancillaryCollapsed:(t.globals.ancillaryCollapsedSeriesIndices||[]).slice(),selectedDataPoints:l(t.interact.selectedDataPoints),theme:c?{mode:null!=(i=c.mode)?i:null,palette:null!=(n=c.palette)?n:null}:null,locale:t.config.chart&&t.config.chart.defaultLocale||null,annotations:h(t,e),drill:u&&u.depth>0?{path:u.path.slice()}:null,measure:d(e)}}(this.w,this.ctx),{config:i,seriesSig:n}=this._cloneConfigCOW();return{id:"hist-"+ ++this._counter,view:e,config:i,seriesSig:n,label:t||"change",at:r.isBrowser()?Date.now():0,origin:"local",sig:this._signature(e,i)}}_cloneConfigCOW(){const n=this.w,s=this.stack[this.pointer];let r,a=null;try{a=JSON.stringify(n.config.series)}catch(t){a=null}if(s&&null!==a&&s.seriesSig===a){const a=n.config,{series:l}=a,c=((n,s)=>{var o={};for(var r in n)e.call(n,r)&&s.indexOf(r)<0&&(o[r]=n[r]);if(null!=n&&t)for(var r of t(n))s.indexOf(r)<0&&i.call(n,r)&&(o[r]=n[r]);return o})(a,["series"]);r=o.clone(c),r.series=s.config.series}else r=o.clone(n.config);return{config:r,seriesSig:a}}_signature(t,e){try{return JSON.stringify(t)+"|"+JSON.stringify(e)}catch(t){return`nosig-${this._counter}`}}_restore(t,e){if(!t)return;let i;this.applying=!0;try{this.ctx.clearAnnotations(),i=this.ctx.updateOptions(o.clone(t.config),!1,e,!1,!1)}catch(t){throw this.applying=!1,t}Promise.resolve(i).then(()=>{this.w.globals.isDestroyed?this.applying=!1:(u(this.ctx,t.view),this._refreshSettle(),this._emitChange())}).catch(()=>{this.applying=!1})}_refreshSettle(){r.isBrowser()?(clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>{this.applying=!1},0)):this.applying=!1}snapshot(t){this.enabled&&!this.applying&&this._commit(t||"change")}undo(t=!0){this.canUndo()&&(this.pointer--,this._restore(this.stack[this.pointer],t))}redo(t=!0){this.canRedo()&&(this.pointer++,this._restore(this.stack[this.pointer],t))}canUndo(){return this.pointer>0}canRedo(){return this.pointer>-1&&this.pointer<this.stack.length-1}jump(t,e=!0){const i=this.stack.findIndex(e=>e.id===t);-1!==i&&i!==this.pointer&&(this.pointer=i,this._restore(this.stack[i],e))}clear(){clearTimeout(this._coalesceTimer),this._coalesceTimer=null;const t=this.stack[this.pointer];this.stack=t?[t]:[],this.pointer=this.stack.length-1,this._emitChange()}transaction(t,e={}){if("function"!=typeof t)return Promise.resolve();const i=this._batching;return this._batching=!0,Promise.resolve().then(()=>t()).finally(()=>{this._batching=i,i||this._commit(e.label||"transaction",!0)})}entries(){return this.stack.map(t=>({id:t.id,label:t.label,at:t.at}))}state(){return{canUndo:this.canUndo(),canRedo:this.canRedo(),index:this.pointer,length:this.stack.length}}_emitChange(){this.ctx.events.fireEvent("historyChange",[this.ctx,this.state()])}teardown(){var t,e,i,n,s,o,r,a;clearTimeout(this._coalesceTimer),clearTimeout(this._settleTimer),this._coalesceTimer=null,this._settleTimer=null,this._unwireKeyboard(),this._wired&&(null==(e=(t=this.ctx).removeEventListener)||e.call(t,"mounted",this._onMounted),null==(n=(i=this.ctx).removeEventListener)||n.call(i,"updated",this._onUpdated),null==(o=(s=this.ctx).removeEventListener)||o.call(s,"scrolled",this._onUpdated),null==(a=(r=this.ctx).removeEventListener)||a.call(r,"dataPointSelection",this._onSelection)),this.stack=[],this.pointer=-1,this._wired=!1}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>s.default});
|
package/dist/features/history.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ApexCharts v7.
|
|
2
|
+
* ApexCharts v7.4.0
|
|
3
3
|
* (c) 2018-2026 ApexCharts
|
|
4
4
|
*/
|
|
5
5
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexHistory={})}(this,function(t){"use strict";var e=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;const s=globalThis.ApexCharts,o=globalThis.ApexCharts.__internals.__apex_Utils,a=globalThis.ApexCharts.__internals.__apex_Environment_Environment;function r(t,e){const i=null!=t,n=null!=e;return i||n?{min:i?t:null,max:n?e:null}:null}function l(t){return Array.isArray(t)?t.map(t=>Array.isArray(t)?t.slice():t):[]}function h(t,e){return"function"==typeof t&&e?t===e.addXaxisAnnotation?"xaxis":t===e.addYaxisAnnotation?"yaxis":t===e.addPointAnnotation?"point":null:null}function c(t,e){const i=t.config.annotations?o.clone(t.config.annotations):null,n=[],s=t.globals.memory&&t.globals.memory.methodsToExec||[];for(const t of s){if(!t||"addAnnotation"!==t.label)continue;const i=h(t.method,e);i&&n.push({kind:i,params:o.clone(t.params)})}return{static:i,dynamic:n}}function d(t){const e=t&&t.measure;if(!e||"function"!=typeof e.getPins)return null;const i=e.getPins();return Array.isArray(i)&&i.length?{pins:i}:null}function u(t,e){if(!t||!e)return;const i=t.w;i.interact.zoomed=!!e.zoomed,function(t,e,i){const n=t.w;if(null==e&&null==i)return;const s=n.globals.seriesNames||[],o=new Set([...e||[],...i||[]]),a=new Set([...n.globals.collapsedSeriesIndices||[],...n.globals.ancillaryCollapsedSeriesIndices||[]]);for(let e=0;e<s.length;e++){const i=s[e];if(null==i)continue;const n=o.has(e),r=a.has(e);n&&!r?t.hideSeries(i):!n&&r&&t.showSeries(i)}}(t,e.collapsed,e.ancillaryCollapsed),e.annotations&&Array.isArray(e.annotations.dynamic)&&e.annotations.dynamic.forEach(e=>{const i=function(t){switch(t){case"xaxis":return"addXaxisAnnotation";case"yaxis":return"addYaxisAnnotation";case"point":return"addPointAnnotation";default:return null}}(e.kind);i&&"function"==typeof t[i]&&t[i](e.params,!0)}),function(t,e){Array.isArray(e)&&(t.w.interact.selectedDataPoints=l(e))}(t,e.selectedDataPoints),e.locale&&e.locale!==i.config.chart.defaultLocale&&t.setLocale(e.locale),t.measure&&"function"==typeof t.measure.setPins&&t.measure.setPins(e.measure&&e.measure.pins||[])}s.registerFeatures({history:class{constructor(t,e){this.w=t,this.ctx=e,this.stack=[],this.pointer=-1,this.applying=!1,this._batching=!1,this._counter=0,this._coalesceTimer=null,this._settleTimer=null,this._pendingLabel=void 0,this._keydownTarget=null,this._pointerTarget=null,this._engaged=!1,this._wired=!1,this._readConfig(),this._onMounted=this._onMounted.bind(this),this._onUpdated=this._onUpdated.bind(this),this._onSelection=this._onSelection.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this.init()}_readConfig(){const t=this.w,e=t.config.chart&&t.config.chart.history||{};this.enabled=!!e.enabled,this.maxDepth=e.maxDepth>0?e.maxDepth:100,this.coalesceMs=null!=e.coalesceMs?e.coalesceMs:250,this.keyboard=!1!==e.keyboard}_syncConfig(){this._readConfig(),this.enabled&&this.keyboard?this._wireKeyboard():this._unwireKeyboard()}init(){this._wired||(this._wired=!0,this.ctx.addEventListener("mounted",this._onMounted),this.ctx.addEventListener("updated",this._onUpdated),this.ctx.addEventListener("scrolled",this._onUpdated),this.ctx.addEventListener("dataPointSelection",this._onSelection),this.enabled&&this.keyboard&&this._wireKeyboard())}_wireKeyboard(){if(this._keydownTarget)return;const t=this.ctx.el,e=t&&t.ownerDocument;a.isBrowser()&&e&&(e.addEventListener("keydown",this._onKeyDown),e.addEventListener("pointerdown",this._onPointerDown,!0),e.addEventListener("mousedown",this._onPointerDown,!0),this._keydownTarget=e,this._pointerTarget=e)}_unwireKeyboard(){this._keydownTarget&&(this._keydownTarget.removeEventListener("keydown",this._onKeyDown),this._keydownTarget=null),this._pointerTarget&&(this._pointerTarget.removeEventListener("pointerdown",this._onPointerDown,!0),this._pointerTarget.removeEventListener("mousedown",this._onPointerDown,!0),this._pointerTarget=null),this._engaged=!1}_onMounted(){this._syncConfig(),this.enabled&&0===this.stack.length&&this._commit("initial",!0)}_onUpdated(){this._syncConfig(),this.enabled&&(this.applying?this._refreshSettle():this._schedule("update"))}_onSelection(){this.enabled&&!this.applying&&this._schedule("selection")}_onPointerDown(t){const e=this.ctx.el;this._engaged=!!(e&&t.target&&e.contains(t.target))}_onKeyDown(t){if(!t.metaKey&&!t.ctrlKey)return;const e=(t.key||"").toLowerCase();if("z"!==e&&"y"!==e)return;const i=this.ctx.el;if(!i)return;const n=i.ownerDocument,s=n&&n.activeElement;if(function(t){if(!t)return!1;const e=t.tagName;return"INPUT"===e||"TEXTAREA"===e||"SELECT"===e||!0===t.isContentEditable}(s))return;if(!i.contains(s)&&!this._engaged)return;const o="y"===e||t.shiftKey;t.preventDefault(),o?this.redo():this.undo()}_schedule(t){this.applying||this._batching||!this.enabled||(this._pendingLabel=t,this.coalesceMs>0&&a.isBrowser()?(clearTimeout(this._coalesceTimer),this._coalesceTimer=setTimeout(()=>this._commit(this._pendingLabel),this.coalesceMs)):this._commit(t))}_commit(t,e){if(clearTimeout(this._coalesceTimer),this._coalesceTimer=null,!e&&(this.applying||this._batching))return;const i=this._capture(t),n=this.stack[this.pointer];if(!n||n.sig!==i.sig){for(this.pointer<this.stack.length-1&&this.stack.splice(this.pointer+1),this.stack.push(i),this.pointer=this.stack.length-1;this.stack.length>this.maxDepth;)this.stack.shift(),this.pointer--;this._emitChange()}}_capture(t){const e=function(t,e){var i,n;const s=t.config.xaxis||{},o=(Array.isArray(t.config.yaxis)?t.config.yaxis:t.config.yaxis?[t.config.yaxis]:[]).map(t=>r(t&&t.min,t&&t.max)),a=o.some(t=>null!==t),h=t.config.theme,u=e&&e.drilldown;return{v:1,window:{xaxis:r(s.min,s.max),yaxis:a?o:null},zoomed:!!t.interact.zoomed,collapsed:(t.globals.collapsedSeriesIndices||[]).slice(),ancillaryCollapsed:(t.globals.ancillaryCollapsedSeriesIndices||[]).slice(),selectedDataPoints:l(t.interact.selectedDataPoints),theme:h?{mode:null!=(i=h.mode)?i:null,palette:null!=(n=h.palette)?n:null}:null,locale:t.config.chart&&t.config.chart.defaultLocale||null,annotations:c(t,e),drill:u&&u.depth>0?{path:u.path.slice()}:null,measure:d(e)}}(this.w,this.ctx),{config:i,seriesSig:n}=this._cloneConfigCOW();return{id:"hist-"+ ++this._counter,view:e,config:i,seriesSig:n,label:t||"change",at:a.isBrowser()?Date.now():0,origin:"local",sig:this._signature(e,i)}}_cloneConfigCOW(){const t=this.w,s=this.stack[this.pointer];let a,r=null;try{r=JSON.stringify(t.config.series)}catch(t){r=null}if(s&&null!==r&&s.seriesSig===r){const r=t.config,{series:l}=r,h=((t,s)=>{var o={};for(var a in t)i.call(t,a)&&s.indexOf(a)<0&&(o[a]=t[a]);if(null!=t&&e)for(var a of e(t))s.indexOf(a)<0&&n.call(t,a)&&(o[a]=t[a]);return o})(r,["series"]);a=o.clone(h),a.series=s.config.series}else a=o.clone(t.config);return{config:a,seriesSig:r}}_signature(t,e){try{return JSON.stringify(t)+"|"+JSON.stringify(e)}catch(t){return`nosig-${this._counter}`}}_restore(t,e){if(!t)return;let i;this.applying=!0;try{this.ctx.clearAnnotations(),i=this.ctx.updateOptions(o.clone(t.config),!1,e,!1,!1)}catch(t){throw this.applying=!1,t}Promise.resolve(i).then(()=>{this.w.globals.isDestroyed?this.applying=!1:(u(this.ctx,t.view),this._refreshSettle(),this._emitChange())}).catch(()=>{this.applying=!1})}_refreshSettle(){a.isBrowser()?(clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>{this.applying=!1},0)):this.applying=!1}snapshot(t){this.enabled&&!this.applying&&this._commit(t||"change")}undo(t=!0){this.canUndo()&&(this.pointer--,this._restore(this.stack[this.pointer],t))}redo(t=!0){this.canRedo()&&(this.pointer++,this._restore(this.stack[this.pointer],t))}canUndo(){return this.pointer>0}canRedo(){return this.pointer>-1&&this.pointer<this.stack.length-1}jump(t,e=!0){const i=this.stack.findIndex(e=>e.id===t);-1!==i&&i!==this.pointer&&(this.pointer=i,this._restore(this.stack[i],e))}clear(){clearTimeout(this._coalesceTimer),this._coalesceTimer=null;const t=this.stack[this.pointer];this.stack=t?[t]:[],this.pointer=this.stack.length-1,this._emitChange()}transaction(t,e={}){if("function"!=typeof t)return Promise.resolve();const i=this._batching;return this._batching=!0,Promise.resolve().then(()=>t()).finally(()=>{this._batching=i,i||this._commit(e.label||"transaction",!0)})}entries(){return this.stack.map(t=>({id:t.id,label:t.label,at:t.at}))}state(){return{canUndo:this.canUndo(),canRedo:this.canRedo(),index:this.pointer,length:this.stack.length}}_emitChange(){this.ctx.events.fireEvent("historyChange",[this.ctx,this.state()])}teardown(){var t,e,i,n,s,o,a,r;clearTimeout(this._coalesceTimer),clearTimeout(this._settleTimer),this._coalesceTimer=null,this._settleTimer=null,this._unwireKeyboard(),this._wired&&(null==(e=(t=this.ctx).removeEventListener)||e.call(t,"mounted",this._onMounted),null==(n=(i=this.ctx).removeEventListener)||n.call(i,"updated",this._onUpdated),null==(o=(s=this.ctx).removeEventListener)||o.call(s,"scrolled",this._onUpdated),null==(r=(a=this.ctx).removeEventListener)||r.call(a,"dataPointSelection",this._onSelection)),this.stack=[],this.pointer=-1,this._wired=!1}}}),t.default=s,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|