UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

3 lines 108 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-_gyicZFE.cjs"),B=require("./DataTable-DL8_xKlk.cjs"),V=require("./Title-CsERtJKI.cjs"),G=require("./Tooltip-C06-4zGf.cjs"),z=require("./usePrinter-BRTNfg7r.cjs"),E=require("./Shape-C_rBdSHr.cjs"),P=require("./BaseIcon-q0bEOOzl.cjs"),M=require("./vue-ui-table-sparkline-DLt4efL6.cjs"),T=require("./vue-ui-skeleton-KlT3Rmkn.cjs"),D=require("./Slicer-9-SDSvre.cjs"),R=require("./vue-ui-accordion-8mzPx86h.cjs"),v=require("./useNestedProp-BJQoarHp.cjs"),H=require("./PackageVersion-DHtx9fnE.cjs"),q=require("./PenAndPaper-DPoMEHE6.cjs"),t=require("vue"),W=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Y=h.createUid(),U={name:"vue-ui-xy",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},components:{DataTable:B.DataTable,Shape:E._sfc_main,Title:V._sfc_main,Tooltip:G._sfc_main,UserOptions:z.UserOptions,BaseIcon:P.default,TableSparkline:M.default,Skeleton:T.default,Slicer:D.Slicer,Accordion:R.default,PackageVersion:H._sfc_main,PenAndPaper:q.PenAndPaper},data(){this.dataset.forEach((c,r)=>{[null,void 0].includes(c.series)&&this.error({componentName:"VueUiXy",type:"datasetSerieAttribute",property:"series (number[])",index:r})});const l=this.config.downsample&&this.config.downsample.threshold?this.config.downsample.threshold:500,i=Math.max(...this.dataset.map(c=>this.largestTriangleThreeBucketsArray({data:c.series,threshold:l}).length)),n={start:0,end:i};return{themePalettes:h.themePalettes,themes:h.themes,slicerStep:0,selectedScale:null,CTX:null,CANVAS:null,opacity:h.opacity,useSafeValues:!0,palette:h.palette,height:600,width:1e3,viewBox:"0 0 1000 600",clientPosition:{x:0,y:0},canvasClientPosition:{x:0,y:0},icons:{line:"line",bar:"bar",plot:"plot"},isAnnotator:!1,isFullscreen:!1,isPrinting:!1,isImaging:!1,isTooltip:!1,mutableConfig:{dataLabels:{show:!0},showTooltip:!0,showTable:!1,isStacked:!1,useIndividualScale:!1},selectedSerieIndex:null,selectedRowIndex:null,segregatedSeries:[],uniqueId:h.createUid(),step:0,tableStep:0,titleStep:0,slicer:n,__to__:null,maxX:i,showSparklineTable:!0,segregateStep:0,sliderId:Y,fontSizes:{xAxis:18,yAxis:12,dataLabels:20,plotLabels:10},plotRadii:{plot:3,line:3},selectedMinimapIndex:null,showUserOptionsOnChartHover:!1,keepUserOptionState:!0,userOptionsVisible:!0,svgRef:null}},watch:{dataset:{handler(l,i){this.maxX=Math.max(...this.dataset.map(n=>this.largestTriangleThreeBucketsArray({data:n.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length)),this.slicer={start:0,end:this.maxX},this.slicerStep+=1,this.segregateStep+=1},deep:!0},config:{handler(l,i){this.FINAL_CONFIG=this.prepareConfig(),this.prepareChart(),this.titleStep+=1,this.tableStep+=1,this.mutableConfig={dataLabels:{show:!0},showTooltip:this.FINAL_CONFIG.chart.tooltip.show===!0,showTable:this.FINAL_CONFIG.showTable===!0,isStacked:this.FINAL_CONFIG.chart.grid.labels.yAxis.stacked,useIndividualScale:this.FINAL_CONFIG.chart.grid.labels.yAxis.useIndividualScale}},deep:!0}},computed:{chartAriaLabel(){const l=this.FINAL_CONFIG.chart.title.text||"Chart visualization",i=this.FINAL_CONFIG.chart.title.subtitle.text||"";return`${l}. ${i}`},optimize(){return{linePlot:this.maxSeries>this.FINAL_CONFIG.line.dot.hideAboveMaxSerieLength}},hasOptionsNoTitle(){return this.FINAL_CONFIG.chart.userOptions.show&&(!this.FINAL_CONFIG.chart.title.show||!this.FINAL_CONFIG.chart.title.text)},minimap(){if(!this.FINAL_CONFIG.chart.zoom.minimap.show)return[];const l=this.datasetWithIds.filter(r=>!this.segregatedSeries.includes(r.id)),i=Math.max(...l.map(r=>r.series.length)),n=[];for(let r=0;r<i;r+=1)n.push(l.map(e=>e.series[r]||0).reduce((e,I)=>(e||0)+(I||0),0));const c=Math.min(...n);return n.map(r=>r+(c<0?Math.abs(c):0))},customPalette(){return this.convertCustomPalette(this.FINAL_CONFIG.customPalette)},backgroundColor(){return this.FINAL_CONFIG.chart.backgroundColor},slicerColor(){return this.FINAL_CONFIG.chart.zoom.color},allScales(){const l=this.lineSet.map(e=>({name:e.name,color:e.color,scale:e.individualScale,scaleYLabels:e.scaleYLabels,zero:e.zeroPosition,max:e.individualMax,scaleLabel:e.scaleLabel||"",id:e.id,yOffset:e.yOffset||0,individualHeight:e.individualHeight||this.drawingArea.height,autoScaleYLabels:e.autoScaleYLabels})),i=this.barSet.map(e=>({name:e.name,color:e.color,scale:e.individualScale,scaleYLabels:e.scaleYLabels,zero:e.zeroPosition,max:e.individualMax,scaleLabel:e.scaleLabel||"",id:e.id,yOffset:e.yOffset||0,individualHeight:e.individualHeight||this.drawingArea.height})),n=this.plotSet.map(e=>({name:e.name,color:e.color,scale:e.individualScale,scaleYLabels:e.scaleYLabels,zero:e.zeroPosition,max:e.individualMax,scaleLabel:e.scaleLabel||"",id:e.id,yOffset:e.yOffset||0,individualHeight:e.individualHeight||this.drawingArea.height})),c=this.mutableConfig.useIndividualScale&&!this.mutableConfig.isStacked?Object.values(this.scaleGroups):[...l,...i,...n],r=c.flatMap(e=>e).length;return c.flatMap((e,I)=>({unique:e.unique,id:e.id,groupId:e.groupId,scaleLabel:e.scaleLabel,name:this.mutableConfig.useIndividualScale&&!this.mutableConfig.isStacked?e.unique?e.name:e.groupName:e.name,color:this.mutableConfig.useIndividualScale&&!this.mutableConfig.isStacked?e.unique?e.color:e.groupColor:e.color,scale:e.scale,yOffset:e.yOffset,individualHeight:e.individualHeight,x:this.mutableConfig.isStacked?this.drawingArea.left:this.drawingArea.left/r*(I+1),yLabels:e.scaleYLabels||e.scale.ticks.map(m=>({y:m>=0?e.zero-e.individualHeight*(m/e.max):e.zero+e.individualHeight*Math.abs(m)/e.max,value:m}))}))},isDataset(){return!!this.dataset&&this.dataset.length},chartFont(){const l=document.getElementById(`vue-ui-xy_${this.uniqueId}`);return window.getComputedStyle(l,null).getPropertyValue("font-family")},FINAL_CONFIG:{get:function(){return this.prepareConfig()},set:function(l){return l}},hasHighlightArea(){return Array.isArray(this.FINAL_CONFIG.chart.highlightArea)?this.FINAL_CONFIG.chart.highlightArea.some(l=>l.show):this.FINAL_CONFIG.chart.highlightArea&&this.FINAL_CONFIG.chart.highlightArea.show},highlightAreas(){if(Array.isArray(this.FINAL_CONFIG.chart.highlightArea))return this.FINAL_CONFIG.chart.highlightArea.map(i=>({...i,span:i.from===i.to?1:i.to<i.from?0:i.to-i.from+1}));const l=this.FINAL_CONFIG.chart.highlightArea;return[{...l,span:l.from===l.to?1:l.to<l.from?0:l.to-l.from+1}]},xPadding(){return this.FINAL_CONFIG.chart.grid.position==="middle"?0:this.drawingArea.width/this.maxSeries/2},relativeZero(){return[null,void 0].includes(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin)?this.niceScale.min>=0?0:Math.abs(this.niceScale.min):-this.niceScale.min},absoluteMax(){return this.niceScale.max+this.relativeZero},datasetWithIds(){return this.useSafeValues?this.dataset.map((l,i)=>({...l,series:this.largestTriangleThreeBucketsArray({data:l.series,threshold:this.FINAL_CONFIG.downsample.threshold}),id:`uniqueId_${i}`})):this.dataset},safeDataset(){return this.useSafeValues?this.dataset.map((l,i)=>{const n=this.largestTriangleThreeBucketsArray({data:l.series,threshold:this.FINAL_CONFIG.downsample.threshold}),c=`uniqueId_${i}`;return{...l,slotAbsoluteIndex:i,series:n.map(r=>this.isSafeValue(r)?r:null).slice(this.slicer.start,this.slicer.end),color:this.convertColorToHex(l.color?l.color:this.customPalette[i]?this.customPalette[i]:this.palette[i]),id:c,scaleLabel:l.scaleLabel||c}}):this.dataset},relativeDataset(){return this.safeDataset.map((l,i)=>({...l,series:l.series.map(n=>n+this.relativeZero),absoluteValues:l.series})).filter(l=>!this.segregatedSeries.includes(l.id))},tableSparklineDataset(){return this.relativeDataset.map(l=>{const i=l.absoluteValues.map(n=>[void 0,null].includes(n)?0:n);return{id:l.id,name:l.name,color:l.color,values:this.fillArray(this.maxSeries,i)}})},tableSparklineConfig(){return{responsiveBreakpoint:this.FINAL_CONFIG.table.responsiveBreakpoint,roundingValues:this.FINAL_CONFIG.table.rounding,showAverage:!1,showMedian:!1,showTotal:!1,fontFamily:this.FINAL_CONFIG.chart.fontFamily,prefix:this.FINAL_CONFIG.chart.labels.prefix,suffix:this.FINAL_CONFIG.chart.labels.suffix,colNames:JSON.parse(JSON.stringify(this.FINAL_CONFIG.chart.grid.labels.xAxisLabels.values)),thead:{backgroundColor:this.FINAL_CONFIG.table.th.backgroundColor,color:this.FINAL_CONFIG.table.th.color,outline:this.FINAL_CONFIG.table.th.outline},tbody:{backgroundColor:this.FINAL_CONFIG.table.td.backgroundColor,color:this.FINAL_CONFIG.table.td.color,outline:this.FINAL_CONFIG.table.td.outline},userOptions:{show:!1}}},absoluteDataset(){return this.safeDataset.map((l,i)=>({absoluteIndex:i,...l,series:l.series.map(n=>n+this.relativeZero),absoluteValues:l.series,segregate:()=>this.segregate(l),isSegregated:this.segregatedSeries.includes(l.id)}))},activeSeriesLength(){return this.absoluteDataset.length},activeSeriesWithStackRatios(){return this.assignStackRatios(this.absoluteDataset.filter(l=>!this.segregatedSeries.includes(l.id)))},scaleGroups(){const l=Object.groupBy(this.activeSeriesWithStackRatios,n=>n.scaleLabel),i={};for(const[n,c]of Object.entries(l)){const r=c.flatMap(e=>e.absoluteValues);i[n]={min:Math.min(...r)||0,max:Math.max(...r)||1,groupId:`scale_group_${this.createUid()}`}}return i},barSet(){return this.activeSeriesWithStackRatios.filter(l=>l.type==="bar").map((l,i)=>{this.checkAutoScaleError(l);const n=this.scaleGroups[l.scaleLabel].min,c=this.scaleGroups[l.scaleLabel].max;l.absoluteValues.filter(f=>![null,void 0].includes(f)).map(f=>(f-n)/(c-n));const r={valueMin:n,valueMax:c<0?0:c},e={max:l.scaleMax||Math.max(...l.absoluteValues)||1,min:l.scaleMin||Math.min(...l.absoluteValues.filter(f=>![void 0,null].includes(f)))>0?0:Math.min(...l.absoluteValues.filter(f=>![null,void 0].includes(f)))},I=l.scaleSteps||this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps,m=1.0000001,u=this.calculateNiceScaleWithExactExtremes(e.min,e.max===e.min?e.max*m:e.max,I),b=this.calculateNiceScaleWithExactExtremes(r.valueMin,r.valueMax===r.valueMin?r.valueMax*m:r.valueMax,I),C=u.min>=0?0:Math.abs(u.min),_=0,A=u.max+C,y=b.max+Math.abs(_),g=this.mutableConfig.isStacked?this.drawingArea.height*(1-l.cumulatedStackRatio):0,x=this.mutableConfig.isStacked?this.drawingArea.height*l.stackRatio-this.FINAL_CONFIG.chart.grid.labels.yAxis.gap:this.drawingArea.height,L=this.drawingArea.bottom-g-x*C/A,O=this.drawingArea.bottom-g-x*_/y,a=this.absoluteDataset.filter(f=>f.type==="bar").filter(f=>!this.segregatedSeries.includes(f.id)).length,o=l.series.map((f,w)=>{const N=this.mutableConfig.useIndividualScale?(l.absoluteValues[w]+C)/A:this.ratioToMax(f),k=this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?this.drawingArea.left+this.drawingArea.width/this.maxSeries*w:this.drawingArea.left+this.slot.bar*i+this.slot.bar*w*a-this.barSlot/2-i*this.barPeriodGap;return{yOffset:this.checkNaN(g),individualHeight:this.checkNaN(x),x:this.checkNaN(k),y:this.drawingArea.bottom-g-x*N,value:l.absoluteValues[w],zeroPosition:this.checkNaN(L),individualMax:this.checkNaN(A),comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[w]||""}}),s=l.absoluteValues.map(f=>b.min>=0?(f-Math.abs(b.min))/(b.max-Math.abs(b.min)):(f+Math.abs(b.min))/(b.max+Math.abs(b.min))),d=l.series.map((f,w)=>{const N=this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?this.drawingArea.left+this.drawingArea.width/this.maxSeries*w:this.drawingArea.left-this.slot.bar/2+this.slot.bar*i+this.slot.bar*w*this.absoluteDataset.filter(k=>k.type==="bar").filter(k=>!this.segregatedSeries.includes(k.id)).length;return{yOffset:this.checkNaN(g),individualHeight:this.checkNaN(x),x:this.checkNaN(N),y:this.checkNaN(this.drawingArea.bottom-this.checkNaN(g)-(this.checkNaN(x)*s[w]||0)),value:l.absoluteValues[w],zeroPosition:this.checkNaN(L),individualMax:this.checkNaN(A),comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[w]||""}}),F=u.ticks.map(f=>({y:f>=0?L-x*(f/A):L+x*Math.abs(f)/A,value:f,prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:l})),S=b.ticks.map(f=>{const w=(f-b.min)/(b.max-b.min);return{y:f>=0?O-x*w:O+x*w,value:f,prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:l}});return this.scaleGroups[l.scaleLabel].name=l.name,this.scaleGroups[l.scaleLabel].groupName=l.scaleLabel,this.scaleGroups[l.scaleLabel].groupColor=this.FINAL_CONFIG.chart.grid.labels.yAxis.groupColor||l.color,this.scaleGroups[l.scaleLabel].color=l.color,this.scaleGroups[l.scaleLabel].scaleYLabels=l.autoScaling?S:F,this.scaleGroups[l.scaleLabel].zeroPosition=l.autoScaling?O:L,this.scaleGroups[l.scaleLabel].individualMax=l.autoScaling?y:A,this.scaleGroups[l.scaleLabel].scaleLabel=l.scaleLabel,this.scaleGroups[l.scaleLabel].id=l.id,this.scaleGroups[l.scaleLabel].yOffset=g,this.scaleGroups[l.scaleLabel].individualHeight=x,this.scaleGroups[l.scaleLabel].autoScaleYLabels=S,this.scaleGroups[l.scaleLabel].unique=this.activeSeriesWithStackRatios.filter(f=>f.scaleLabel===l.scaleLabel).length===1,{...l,yOffset:g,autoScaleYLabels:S,individualHeight:x,scaleYLabels:l.autoScaling?S:F,individualScale:l.autoScaling?b:u,individualMax:l.autoScaling?y:A,zeroPosition:l.autoScaling?O:L,plots:l.autoScaling?d:o,groupId:this.scaleGroups[l.scaleLabel].groupId}})},lineSet(){return this.activeSeriesWithStackRatios.filter(l=>l.type==="line").map(l=>{this.checkAutoScaleError(l);const i=this.scaleGroups[l.scaleLabel].min,n=this.scaleGroups[l.scaleLabel].max;l.absoluteValues.filter(N=>![null,void 0].includes(N)).map(N=>(N-i)/(n-i));const c={valueMin:i,valueMax:n},r={max:l.scaleMax||Math.max(...l.absoluteValues)||1,min:l.scaleMin||(Math.min(...l.absoluteValues)>0?0:Math.min(...l.absoluteValues))},e=l.scaleSteps||this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps,I=1.0000001,m=this.calculateNiceScaleWithExactExtremes(r.min,r.max===r.min?r.max*I:r.max,e),u=this.calculateNiceScaleWithExactExtremes(c.valueMin,c.valueMax===c.valueMin?c.valueMax*I:c.valueMax,e),b=m.min>=0?0:Math.abs(m.min),C=0,_=m.max+Math.abs(b),A=u.max+Math.abs(C),y=this.mutableConfig.isStacked?this.drawingArea.height*(1-l.cumulatedStackRatio):0,g=this.mutableConfig.isStacked?this.drawingArea.height*l.stackRatio-this.FINAL_CONFIG.chart.grid.labels.yAxis.gap:this.drawingArea.height,x=this.drawingArea.bottom-y-g*b/_,L=this.drawingArea.bottom-y-g*C/A,O=l.series.map((N,k)=>{const p=this.mutableConfig.useIndividualScale?(l.absoluteValues[k]+Math.abs(b))/_:this.ratioToMax(N);return{x:this.checkNaN(this.drawingArea.left+this.slot.line/2+this.slot.line*k),y:this.checkNaN(this.drawingArea.bottom-y-g*p),value:l.absoluteValues[k],comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[k]||""}}),a=l.absoluteValues.map(N=>u.min>=0?(N-Math.abs(u.min))/(u.max-Math.abs(u.min)):(N+Math.abs(u.min))/(u.max+Math.abs(u.min))),o=l.series.map((N,k)=>[void 0,null].includes(l.absoluteValues[k])?{x:this.checkNaN(this.drawingArea.left+this.slot.line/2+this.slot.line*k),y:x,value:l.absoluteValues[k],comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[k]||""}:{x:this.checkNaN(this.drawingArea.left+this.slot.line/2+this.slot.line*k),y:this.checkNaN(this.drawingArea.bottom-y-(g*a[k]||0)),value:l.absoluteValues[k],comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[k]||""}),s=this.createSmoothPath(O.filter(N=>N.value!==null)),d=this.createSmoothPath(o.filter(N=>N.value!==null)),F=this.createStraightPath(O.filter(N=>N.value!==null)),S=this.createStraightPath(o.filter(N=>N.value!==null)),f=m.ticks.map(N=>({y:N>=0?x-g*(N/_):x+g*Math.abs(N)/_,value:N,prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:l})),w=u.ticks.map(N=>{const k=(N-u.min)/(u.max-u.min);return{y:N>=0?L-g*k:L+g*k,value:N,prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:l}});return this.scaleGroups[l.scaleLabel].name=l.name,this.scaleGroups[l.scaleLabel].groupName=l.scaleLabel,this.scaleGroups[l.scaleLabel].groupColor=this.FINAL_CONFIG.chart.grid.labels.yAxis.groupColor||l.color,this.scaleGroups[l.scaleLabel].color=l.color,this.scaleGroups[l.scaleLabel].scaleYLabels=l.autoScaling?w:f,this.scaleGroups[l.scaleLabel].zeroPosition=l.autoScaling?L:x,this.scaleGroups[l.scaleLabel].individualMax=l.autoScaling?A:_,this.scaleGroups[l.scaleLabel].scaleLabel=l.scaleLabel,this.scaleGroups[l.scaleLabel].id=l.id,this.scaleGroups[l.scaleLabel].yOffset=y,this.scaleGroups[l.scaleLabel].individualHeight=g,this.scaleGroups[l.scaleLabel].autoScaleYLabels=w,this.scaleGroups[l.scaleLabel].unique=this.activeSeriesWithStackRatios.filter(N=>N.scaleLabel===l.scaleLabel).length===1,{...l,yOffset:y,autoScaleYLabels:w,individualHeight:g,scaleYLabels:l.autoScaling?w:f,individualScale:l.autoScaling?u:m,individualMax:l.autoScaling?A:_,zeroPosition:l.autoScaling?L:x,curve:l.autoScaling?d:s,plots:l.autoScaling?o:O,area:l.useArea?this.mutableConfig.useIndividualScale?this.createIndividualArea(l.autoScaling?o:O,l.autoScaling?L:x):this.createArea(O):"",straight:l.autoScaling?S:F,groupId:this.scaleGroups[l.scaleLabel].groupId}})},plotSet(){return this.activeSeriesWithStackRatios.filter(l=>l.type==="plot").map(l=>{this.checkAutoScaleError(l);const i=this.scaleGroups[l.scaleLabel].min,n=this.scaleGroups[l.scaleLabel].max;l.absoluteValues.filter(F=>![null,void 0].includes(F)).map(F=>(F-i)/(n-i));const c={valueMin:i,valueMax:n},r={max:l.scaleMax||Math.max(...l.absoluteValues)||1,min:l.scaleMin||Math.min(...l.absoluteValues)>0?0:Math.min(...l.absoluteValues)},e=l.scaleSteps||this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps,I=1.0000001,m=this.calculateNiceScaleWithExactExtremes(r.min,r.max===r.min?r.max*I:r.max,e),u=this.calculateNiceScaleWithExactExtremes(c.valueMin,c.valueMax===c.valueMin?c.valueMax*I:c.valueMax,e),b=m.min>=0?0:Math.abs(m.min),C=0,_=m.max+b,A=u.max+Math.abs(C),y=this.mutableConfig.isStacked?this.drawingArea.height*(1-l.cumulatedStackRatio):0,g=this.mutableConfig.isStacked?this.drawingArea.height*l.stackRatio-this.FINAL_CONFIG.chart.grid.labels.yAxis.gap:this.drawingArea.height,x=this.drawingArea.bottom-y-g*b/_,L=this.drawingArea.bottom-y-g*C/A,O=l.series.map((F,S)=>{const f=this.mutableConfig.useIndividualScale?(l.absoluteValues[S]+Math.abs(b))/_:this.ratioToMax(F);return{x:this.checkNaN(this.drawingArea.left+this.slot.plot/2+this.slot.plot*S),y:this.checkNaN(this.drawingArea.bottom-y-g*f),value:l.absoluteValues[S],comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[S]||""}}),a=l.absoluteValues.map(F=>u.min>=0?(F-Math.abs(u.min))/(u.max-Math.abs(u.min)):(F+Math.abs(u.min))/(u.max+Math.abs(u.min))),o=l.series.map((F,S)=>({x:this.checkNaN(this.drawingArea.left+this.slot.plot/2+this.slot.plot*S),y:this.checkNaN(this.drawingArea.bottom-y-(g*a[S]||0)),value:l.absoluteValues[S],comment:l.comments&&l.comments.slice(this.slicer.start,this.slicer.end)[S]||""})),s=m.ticks.map(F=>({y:F>=0?x-g*(F/_):x+g*Math.abs(F)/_,value:F,prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:l})),d=u.ticks.map(F=>{const S=(F-u.min)/(u.max-u.min);return{y:F>=0?L-g*S:L+g*S,value:F,prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:l}});return this.scaleGroups[l.scaleLabel].name=l.name,this.scaleGroups[l.scaleLabel].groupName=l.scaleLabel,this.scaleGroups[l.scaleLabel].groupColor=this.FINAL_CONFIG.chart.grid.labels.yAxis.groupColor||l.color,this.scaleGroups[l.scaleLabel].color=l.color,this.scaleGroups[l.scaleLabel].scaleYLabels=l.autoScaling?d:s,this.scaleGroups[l.scaleLabel].zeroPosition=l.autoScaling?L:x,this.scaleGroups[l.scaleLabel].individualMax=l.autoScaling?A:_,this.scaleGroups[l.scaleLabel].scaleLabel=l.scaleLabel,this.scaleGroups[l.scaleLabel].id=l.id,this.scaleGroups[l.scaleLabel].yOffset=y,this.scaleGroups[l.scaleLabel].individualHeight=g,this.scaleGroups[l.scaleLabel].autoScaleYLabels=d,this.scaleGroups[l.scaleLabel].unique=this.activeSeriesWithStackRatios.filter(F=>F.scaleLabel===l.scaleLabel).length===1,{...l,yOffset:y,autoScaleYLabels:d,individualHeight:g,scaleYLabels:l.autoScaling?d:s,individualScale:l.autoScaling?u:m,individualMax:l.autoScaling?A:_,zeroPosition:l.autoScaling?L:x,plots:l.autoScaling?o:O,groupId:this.scaleGroups[l.scaleLabel].groupId}})},drawingArea(){function l(c){const r=new Set;return c.forEach(e=>{const I=e.scaleLabel||"__noScaleLabel__";r.add(I)}),r.size}const i=l(this.absoluteDataset.filter(c=>!this.segregatedSeries.includes(c.id))),n=this.mutableConfig.useIndividualScale&&this.FINAL_CONFIG.chart.grid.labels.show?i*(this.mutableConfig.isStacked?0:this.FINAL_CONFIG.chart.grid.labels.yAxis.labelWidth):0;return{top:this.FINAL_CONFIG.chart.padding.top,right:this.width-this.FINAL_CONFIG.chart.padding.right,bottom:this.height-this.FINAL_CONFIG.chart.padding.bottom,left:this.FINAL_CONFIG.chart.padding.left+n,height:this.height-(this.FINAL_CONFIG.chart.padding.top+this.FINAL_CONFIG.chart.padding.bottom),width:this.width-(this.FINAL_CONFIG.chart.padding.right+this.FINAL_CONFIG.chart.padding.left+n)}},max(){return this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMax?this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMax:Math.max(...this.safeDataset.filter(l=>!this.segregatedSeries.includes(l.id)).map(l=>Math.max(...l.series)))},min(){if(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin!==null)return this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin;const l=Math.min(...this.safeDataset.filter(i=>!this.segregatedSeries.includes(i.id)).map(i=>Math.min(...i.series)));return l>0?0:l},niceScale(){return this.calculateNiceScaleWithExactExtremes(this.min,this.max<0?0:this.max,this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps)},maxSeries(){return this.slicer.end-this.slicer.start},timeLabels(){const l=Math.max(...this.dataset.map(n=>this.largestTriangleThreeBucketsArray({data:n.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length)),i=[];for(let n=0;n<l;n+=1)i.push({text:this.FINAL_CONFIG.chart.grid.labels.xAxisLabels.values[n]||String(n),absoluteIndex:n});return i.slice(this.slicer.start,this.slicer.end)},slot(){return{bar:this.drawingArea.width/this.maxSeries/this.safeDataset.filter(l=>l.type==="bar").filter(l=>!this.segregatedSeries.includes(l.id)).length,plot:this.drawingArea.width/this.maxSeries,line:this.drawingArea.width/this.maxSeries}},barSlot(){const l=this.safeDataset.filter(i=>i.type==="bar").filter(i=>!this.segregatedSeries.includes(i.id)).length;return this.drawingArea.width/this.maxSeries/l-this.barPeriodGap*l},barPeriodGap(){return this.slot.line*this.FINAL_CONFIG.bar.periodGap},maxSlot(){return Math.max(...Object.values(this.slot).filter(l=>l!==1/0))},table(){if(this.safeDataset.length===0)return{head:[],body:[],config:{},columnNames:[]};const l=this.relativeDataset.map(n=>({label:n.name,color:n.color,type:n.type})),i=[];return this.timeLabels.forEach((n,c)=>{const r=[n.text];this.relativeDataset.forEach(e=>{r.push(this.canShowValue(e.absoluteValues[c])?Number(e.absoluteValues[c].toFixed(this.FINAL_CONFIG.table.rounding)):"")}),i.push(r)}),{head:l,body:i}},dataTable(){const l=this.FINAL_CONFIG.table.showSum;let i=[""].concat(this.relativeDataset.map(e=>e.name));l&&(i=i.concat(' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>'));let n=[];for(let e=0;e<this.maxSeries;e+=1){const I=this.relativeDataset.map(m=>m.absoluteValues[e]??0).reduce((m,u)=>m+u,0);n.push([this.timeLabels[e].text??"-"].concat(this.relativeDataset.map(m=>this.applyDataLabel(m.type==="line"?this.FINAL_CONFIG.line.labels.formatter:m.type==="bar"?this.FINAL_CONFIG.bar.labels.formatter:this.FINAL_CONFIG.plot.labels.formatter,m.absoluteValues[e]??0,this.dataLabel({p:m.prefix||this.FINAL_CONFIG.chart.labels.prefix,v:m.absoluteValues[e]??0,s:m.suffix||this.FINAL_CONFIG.chart.labels.suffix,r:this.FINAL_CONFIG.table.rounding})))).concat(l?(I??0).toFixed(this.FINAL_CONFIG.table.rounding):[]))}const c={th:{backgroundColor:this.FINAL_CONFIG.table.th.backgroundColor,color:this.FINAL_CONFIG.table.th.color,outline:this.FINAL_CONFIG.table.th.outline},td:{backgroundColor:this.FINAL_CONFIG.table.td.backgroundColor,color:this.FINAL_CONFIG.table.td.color,outline:this.FINAL_CONFIG.table.td.outline},breakpoint:this.FINAL_CONFIG.table.responsiveBreakpoint},r=[this.FINAL_CONFIG.table.columnNames.period].concat(this.relativeDataset.map(e=>e.name)).concat(this.FINAL_CONFIG.table.columnNames.total);return{head:i,body:n,config:c,colNames:r}},dataTooltipSlot(){return{datapoint:this.selectedSeries,seriesIndex:this.selectedSerieIndex,series:this.absoluteDataset,bars:this.barSet,lines:this.lineSet,plots:this.plotSet,config:this.FINAL_CONFIG}},selectedSeries(){return this.relativeDataset.map(l=>({slotAbsoluteIndex:l.slotAbsoluteIndex,shape:l.shape||null,name:l.name,color:l.color,type:l.type,value:l.absoluteValues.find((i,n)=>n===this.selectedSerieIndex),comments:l.comments||[],prefix:l.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:l.suffix||this.FINAL_CONFIG.chart.labels.suffix}))},tooltipContent(){let l="",i=this.selectedSeries.map(r=>r.value).filter(r=>this.isSafeValue(r)&&r!==null).reduce((r,e)=>Math.abs(r)+Math.abs(e),0);const n=this.timeLabels[this.selectedSerieIndex],c=this.FINAL_CONFIG.chart.tooltip.customFormat;return this.isFunction(c)&&this.functionReturnsString(()=>c({seriesIndex:this.selectedSerieIndex,datapoint:this.selectedSeries,series:this.absoluteDataset,bars:this.barSet,lines:this.lineSet,plots:this.plotSet,config:this.FINAL_CONFIG}))?c({seriesIndex:this.selectedSerieIndex,datapoint:this.selectedSeries,series:this.absoluteDataset,bars:this.barSet,lines:this.lineSet,plots:this.plotSet,config:this.FINAL_CONFIG}):(n&&n.text&&this.FINAL_CONFIG.chart.tooltip.showTimeLabel&&(l+=`<div style="padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid ${this.FINAL_CONFIG.chart.tooltip.borderColor}; width:100%">${n.text}</div>`),this.selectedSeries.forEach(r=>{if(this.isSafeValue(r.value)){let e="",I="";switch(this.icons[r.type]){case"bar":e=`<svg viewBox="0 0 40 40" height="14" width="14">${this.$slots.pattern?`<rect x="0" y="0" rx="1" stroke="none" height="40" width="40" fill="${r.color}" />`:""}<rect x="0" y="0" rx="1" stroke="none" height="40" width="40" fill="${this.$slots.pattern?`url(#pattern_${this.uniqueId}_${r.slotAbsoluteIndex}`:r.color}" /></svg>`;break;case"line":!r.shape||!["star","triangle","square","diamond","pentagon","hexagon"].includes(r.shape)?I=`<circle cx="10" cy="8" r="4" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" fill="${r.color}" />`:r.shape==="triangle"?I=`<path d="${h.createPolygonPath({plot:{x:10,y:8},radius:4,sides:3,rotation:.52}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:r.shape==="square"?I=`<path d="${h.createPolygonPath({plot:{x:10,y:8},radius:4,sides:4,rotation:.8}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:r.shape==="diamond"?I=`<path d="${h.createPolygonPath({plot:{x:10,y:8},radius:4,sides:4,rotation:0}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:r.shape==="pentagon"?I=`<path d="${h.createPolygonPath({plot:{x:10,y:8},radius:4,sides:5,rotation:.95}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:r.shape==="hexagon"?I=`<path d="${h.createPolygonPath({plot:{x:10,y:8},radius:4,sides:6,rotation:0}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:r.shape==="star"&&(I=`<polygon stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" fill="${r.color}" points="${h.createStar({plot:{x:10,y:8},radius:4})}" />`),e=`<svg viewBox="0 0 20 12" height="14" width="20"><rect rx="1.5" x="0" y="6.5" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" height="3" width="20" fill="${r.color}" />${I}</svg>`;break;case"plot":if(!r.shape||!["star","triangle","square","diamond","pentagon","hexagon"].includes(r.shape)){e=`<svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" fill="${r.color}" /></svg>`;break}if(r.shape==="star"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><polygon stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" fill="${r.color}" points="${h.createStar({plot:{x:6,y:6},radius:5})}" /></svg>`;break}if(r.shape==="triangle"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${h.createPolygonPath({plot:{x:6,y:6},radius:6,sides:3,rotation:.52}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(r.shape==="square"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${h.createPolygonPath({plot:{x:6,y:6},radius:6,sides:4,rotation:.8}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(r.shape==="diamond"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${h.createPolygonPath({plot:{x:6,y:6},radius:5,sides:4,rotation:0}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(r.shape==="pentagon"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${h.createPolygonPath({plot:{x:6,y:6},radius:5,sides:5,rotation:.95}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(r.shape==="hexagon"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${h.createPolygonPath({plot:{x:6,y:6},radius:5,sides:6,rotation:0}).path}" fill="${r.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}}l+=`<div style="display:flex;flex-direction:row; align-items:center;gap:3px;"><div style="width:20px">${e}</div> ${r.name}: <b>${this.FINAL_CONFIG.chart.tooltip.showValue?this.applyDataLabel(r.type==="line"?this.FINAL_CONFIG.line.labels.formatter:r.type==="bar"?this.FINAL_CONFIG.bar.labels.formatter:this.FINAL_CONFIG.plot.labels.formatter,r.value,this.dataLabel({p:r.prefix,v:r.value,s:r.suffix,r:this.FINAL_CONFIG.chart.tooltip.roundingValue}),{datapoint:r}):""}</b> ${this.FINAL_CONFIG.chart.tooltip.showPercentage?`(${h.dataLabel({v:this.checkNaN(Math.abs(r.value)/i*100),s:"%",r:this.FINAL_CONFIG.chart.tooltip.roundingPercentage})})`:""}</div>`,this.FINAL_CONFIG.chart.comments.showInTooltip&&r.comments.length&&r.comments.slice(this.slicer.start,this.slicer.end)[this.selectedSerieIndex]&&(l+=`<div class="vue-data-ui-tooltip-comment" style="background:${r.color}20; padding: 6px; margin-bottom: 6px; border-left: 1px solid ${r.color}">${r.comments.slice(this.slicer.start,this.slicer.end)[this.selectedSerieIndex]}</div>`)}}),`<div style="border-radius:4px;padding:12px;font-variant-numeric: tabular-nums;color:${this.FINAL_CONFIG.chart.tooltip.color}">${l}</div>`)},svg(){return{height:this.height,width:this.width}},yLabels(){return this.niceScale.ticks.map(l=>({y:l>=0?this.zero-this.drawingArea.height*this.ratioToMax(l):this.zero+this.drawingArea.height*this.ratioToMax(Math.abs(l)),value:l,prefix:this.FINAL_CONFIG.chart.labels.prefix,suffix:this.FINAL_CONFIG.chart.labels.suffix}))},zero(){return this.drawingArea.bottom-this.drawingArea.height*this.ratioToMax(this.relativeZero)}},mounted(){this.svgRef=this.$refs.svgRef,this.prepareChart(),this.setupSlicer(),document.addEventListener("mousemove",l=>{this.clientPosition={x:l.clientX,y:l.clientY}})},methods:{abbreviate:h.abbreviate,adaptColorToBackground:h.adaptColorToBackground,applyDataLabel:h.applyDataLabel,assignStackRatios:h.assignStackRatios,calcLinearProgression:h.calcLinearProgression,calculateNiceScaleWithExactExtremes:h.calculateNiceScaleWithExactExtremes,checkNaN:h.checkNaN,closestDecimal:h.closestDecimal,convertColorToHex:h.convertColorToHex,convertConfigColors:h.convertConfigColors,convertCustomPalette:h.convertCustomPalette,createCsvContent:h.createCsvContent,createSmoothPath:h.createSmoothPath,createStraightPath:h.createStraightPath,createTSpans:h.createTSpans,dataLabel:h.dataLabel,downloadCsv:h.downloadCsv,error:h.error,forceValidValue:h.forceValidValue,functionReturnsString:h.functionReturnsString,hasDeepProperty:h.hasDeepProperty,isFunction:h.isFunction,isSafeValue:h.isSafeValue,largestTriangleThreeBucketsArray:h.largestTriangleThreeBucketsArray,objectIsEmpty:h.objectIsEmpty,setOpacity:h.setOpacity,shiftHue:h.shiftHue,translateSize:h.translateSize,treeShake:h.treeShake,useMouse:G.useMouse,useNestedProp:v.useNestedProp,createUid:h.createUid,setUserOptionsVisibility(l=!1){this.showUserOptionsOnChartHover&&(this.userOptionsVisible=l)},toggleAnnotator(){this.isAnnotator=!this.isAnnotator},selectTimeLabel(l,i){const n=this.relativeDataset.map(c=>({shape:c.shape||null,name:c.name,color:c.color,type:c.type,value:c.absoluteValues.find((r,e)=>e===i),comments:c.comments||[],prefix:c.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:c.suffix||this.FINAL_CONFIG.chart.labels.suffix}));this.$emit("selectTimeLabel",{datapoint:n,absoluteIndex:l.absoluteIndex,label:l.text})},getHighlightAreaPosition(l){const i=this.drawingArea.left+this.drawingArea.width/this.maxSeries*(l.from-this.slicer.start),n=this.drawingArea.width/(this.slicer.end-this.slicer.start)*l.span<0?1e-5:this.drawingArea.width/(this.slicer.end-this.slicer.start)*l.span;return{x:i<this.drawingArea.left?this.drawingArea.left:i,width:n}},prepareConfig(){const l=h.useConfig().vue_ui_xy;if(!Object.keys(this.config||{}).length)return l;const i=this.useNestedProp({userConfig:this.config,defaultConfig:l});return this.config&&this.hasDeepProperty(this.config,"chart.highlightArea")&&(Array.isArray(this.config.chart.highlightArea)?i.chart.highlightArea=this.config.chart.highlightArea:i.chart.highlightArea=[this.config.chart.highlightArea]),this.config&&this.hasDeepProperty(this.config,"chart.grid.labels.yAxis.scaleMin")?i.chart.grid.labels.yAxis.scaleMin=this.config.chart.grid.labels.yAxis.scaleMin:i.chart.grid.labels.yAxis.scaleMin=null,this.config&&this.hasDeepProperty(this.config,"chart.grid.labels.yAxis.scaleMax")?i.chart.grid.labels.yAxis.scaleMax=this.config.chart.grid.labels.yAxis.scaleMax:i.chart.grid.labels.yAxis.scaleMax=null,this.config&&this.hasDeepProperty(this.config,"chart.zoom.startIndex")?i.chart.zoom.startIndex=this.config.chart.zoom.startIndex:i.chart.zoom.startIndex=null,this.config&&this.hasDeepProperty(this.config,"chart.zoom.endIndex")?i.chart.zoom.endIndex=this.config.chart.zoom.endIndex:i.chart.zoom.endIndex=null,this.config&&this.hasDeepProperty(this.config,"chart.grid.labels.yAxis.groupColor")?i.chart.grid.labels.yAxis.groupColor=this.config.chart.grid.labels.yAxis.groupColor:i.chart.grid.labels.yAxis.groupColor=null,i.theme?{...v.useNestedProp({userConfig:this.themes.vue_ui_xy[i.theme]||this.config,defaultConfig:i}),customPalette:this.themePalettes[i.theme]||this.palette}:i},prepareChart(){if(this.objectIsEmpty(this.dataset)?this.error({componentName:"VueUiXy",type:"dataset"}):this.dataset.forEach((l,i)=>{[null,void 0].includes(l.name)&&this.error({componentName:"VueUiXy",type:"datasetSerieAttribute",property:"name (string)",index:i})}),this.FINAL_CONFIG.showWarnings&&this.dataset.forEach(l=>{l.series.forEach((i,n)=>{this.isSafeValue(i)||console.warn(`VueUiXy has detected an unsafe value in your dataset: -----> The serie '${l.name}' contains the value '${i}' at index ${n}. '${i}' was converted to null to allow the chart to display.`)})}),this.showUserOptionsOnChartHover=this.FINAL_CONFIG.chart.userOptions.showOnChartHover,this.keepUserOptionState=this.FINAL_CONFIG.chart.userOptions.keepStateOnChartLeave,this.userOptionsVisible=!this.FINAL_CONFIG.chart.userOptions.showOnChartHover,this.mutableConfig={dataLabels:{show:!0},showTooltip:this.FINAL_CONFIG.chart.tooltip.show===!0,showTable:this.FINAL_CONFIG.showTable===!0,isStacked:this.FINAL_CONFIG.chart.grid.labels.yAxis.stacked,useIndividualScale:this.FINAL_CONFIG.chart.grid.labels.yAxis.useIndividualScale},this.FINAL_CONFIG.responsive){const i=this.$refs.chart.parentNode,{height:n,width:c}=i.getBoundingClientRect();let r=null,e=0;this.FINAL_CONFIG.chart.title.show&&(r=this.$refs.chartTitle,e=r.getBoundingClientRect().height);let I=null,m=0;this.FINAL_CONFIG.chart.zoom.show&&this.maxX>6&&this.isDataset&&(I=this.$refs.chartSlicer.$el,m=I.getBoundingClientRect().height);let u=null,b=0;this.FINAL_CONFIG.chart.legend.show&&(u=this.$refs.chartLegend,b=u.getBoundingClientRect().height);let C=0;this.$refs.source&&(C=this.$refs.source.getBoundingClientRect().height);let _=0;this.$refs.noTitle&&(_=this.$refs.noTitle.getBoundingClientRect().height),this.height=n-e-b-m-C-_,this.width=c,this.viewBox=`0 0 ${this.width<0?10:this.width} ${this.height<0?10:this.height}`,this.convertSizes(),new ResizeObserver(y=>{for(const g of y)this.$refs.chartTitle&&(e=this.$refs.chartTitle.getBoundingClientRect().height),this.$refs.chartSlicer&&this.$refs.chartSlicer.$el&&(m=this.$refs.chartSlicer.$el.getBoundingClientRect().height),this.$refs.chartLegend&&(b=this.$refs.chartLegend.getBoundingClientRect().height),this.$refs.source&&(C=this.$refs.source.getBoundingClientRect().height),requestAnimationFrame(()=>{this.height=g.contentBoxSize[0].blockSize-e-b-m-C-24,this.width=g.contentBoxSize[0].inlineSize,this.viewBox=`0 0 ${this.width<0?10:this.width} ${this.height<0?10:this.height}`,this.convertSizes()})}).observe(i)}else this.height=this.FINAL_CONFIG.chart.height,this.width=this.FINAL_CONFIG.chart.width,this.viewBox=`0 0 ${this.width} ${this.height}`,this.fontSizes.dataLabels=this.FINAL_CONFIG.chart.grid.labels.fontSize,this.fontSizes.yAxis=this.FINAL_CONFIG.chart.grid.labels.axis.fontSize,this.fontSizes.xAxis=this.FINAL_CONFIG.chart.grid.labels.xAxisLabels.fontSize,this.fontSizes.plotLabels=this.FINAL_CONFIG.chart.labels.fontSize,this.plotRadii.plot=this.FINAL_CONFIG.plot.radius,this.plotRadii.line=this.FINAL_CONFIG.line.radius},selectMinimapIndex(l){this.selectedMinimapIndex=l},convertSizes(){this.fontSizes.dataLabels=this.translateSize({relator:this.height,adjuster:400,source:this.FINAL_CONFIG.chart.grid.labels.fontSize,threshold:10,fallback:10}),this.fontSizes.yAxis=this.translateSize({relator:this.width,adjuster:1e3,source:this.FINAL_CONFIG.chart.grid.labels.axis.fontSize,threshold:10,fallback:10}),this.fontSizes.xAxis=this.translateSize({relator:this.width,adjuster:1e3,source:this.FINAL_CONFIG.chart.grid.labels.xAxisLabels.fontSize,threshold:10,fallback:10}),this.fontSizes.plotLabels=this.translateSize({relator:this.width,adjuster:800,source:this.FINAL_CONFIG.chart.labels.fontSize,threshold:10,fallback:10}),this.plotRadii.plot=this.translateSize({relator:this.width,adjuster:800,source:this.FINAL_CONFIG.plot.radius,threshold:1,fallback:1}),this.plotRadii.line=this.translateSize({relator:this.width,adjuster:800,source:this.FINAL_CONFIG.line.radius,threshold:1,fallback:1})},toggleStack(){this.mutableConfig.isStacked=!this.mutableConfig.isStacked,this.mutableConfig.isStacked?this.mutableConfig.useIndividualScale=!0:this.mutableConfig.useIndividualScale=this.FINAL_CONFIG.chart.grid.labels.yAxis.useIndividualScale},toggleTable(){this.mutableConfig.showTable=!this.mutableConfig.showTable},toggleLabels(){this.mutableConfig.dataLabels.show=!this.mutableConfig.dataLabels.show},toggleTooltip(){this.mutableConfig.showTooltip=!this.mutableConfig.showTooltip},checkAutoScaleError(l){l.autoScaling&&(this.FINAL_CONFIG.chart.grid.labels.yAxis.useIndividualScale||console.warn(`VueUiXy (datapoint: ${l.name}) : autoScaling only works when config.chart.grid.labels.yAxis.useIndividualScale is set to true`),this.FINAL_CONFIG.chart.grid.labels.yAxis.stacked||console.warn(`VueUiXy (datapoint: ${l.name}) : autoScaling only works when config.chart.grid.labels.yAxis.stacked is set to true`))},createArea(l){if(!l[0])return[-10,-10,"",-10,-10];const i={x:l[0].x,y:this.zero},n={x:l.at(-1).x,y:this.zero},c=[];return l.forEach(r=>{c.push(`${r.x},${r.y} `)}),[i.x,i.y,...c,n.x,n.y].toString()},createIndividualArea(l,i){if(!l[0])return[-10,-10,"",-10,-10];const n={x:l[0]?l[0].x:Math.min(...l.filter(e=>!!e).map(e=>e.x)),y:i},c={x:l.at(-1)?l.at(-1).x:Math.min(...l.filter(e=>!!e).map(e=>e.x)),y:i},r=[];return l.filter(e=>!!e).forEach(e=>{r.push(`${e.x},${e.y} `)}),[n.x,n.y,...r,c.x,c.y].toString()},createStar:h.createStar,createPolygonPath:h.createPolygonPath,fillArray(l,i){let n=Array(l).fill(0);for(let c=0;c<i.length&&c<l;c+=1)n[c]=i[c];return n},async setupSlicer(){(this.FINAL_CONFIG.chart.zoom.startIndex!==null||this.FINAL_CONFIG.chart.zoom.endIndex!==null)&&this.$refs.chartSlicer?(this.FINAL_CONFIG.chart.zoom.startIndex!==null&&(await this.$nextTick(),await this.$nextTick(),this.$refs.chartSlicer.setStartValue(this.FINAL_CONFIG.chart.zoom.startIndex)),this.FINAL_CONFIG.chart.zoom.endIndex!==null&&(await this.$nextTick(),await this.$nextTick(),this.$refs.chartSlicer.setEndValue(this.validSlicerEnd(this.FINAL_CONFIG.chart.zoom.endIndex+1)))):(this.slicer={start:0,end:Math.max(...this.dataset.map(l=>this.largestTriangleThreeBucketsArray({data:l.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length))},this.slicerStep+=1)},refreshSlicer(){this.setupSlicer()},validSlicerEnd(l){const i=Math.max(...this.dataset.map(n=>this.largestTriangleThreeBucketsArray({data:n.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length));return l>i?i:l<0||this.FINAL_CONFIG.chart.zoom.startIndex!==null&&l<this.FINAL_CONFIG.chart.zoom.startIndex?this.FINAL_CONFIG.chart.zoom.startIndex!==null?this.FINAL_CONFIG.chart.zoom.startIndex+1:1:l},calcRectHeight(l){const i=![null,void 0].includes(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin)&&this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin>0&&this.min>=0?this.drawingArea.bottom:this.zero;return l.value>=0?this.checkNaN(i-l.y<=0?1e-5:i-l.y):this.checkNaN(l.y-this.zero<=0?1e-5:l.y-this.zero)},calcIndividualHeight(l){return l.value>=0?this.checkNaN(l.zeroPosition-l.y<=0?1e-5:l.zeroPosition-l.y):this.checkNaN(l.y-l.zeroPosition<=0?1e-5:l.zeroPosition-l.y)},calcRectWidth(){return this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?this.slot.line-this.drawingArea.width/this.maxSeries*.1:this.slot.bar},calcRectX(l){return this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?l.x+this.drawingArea.width/this.maxSeries*.05:l.x+this.slot.bar/2},calcRectY(l){return l.value>=0?l.y:this.zero},calcIndividualRectY(l){return l.value>=0?l.y:[null,void 0,NaN,1/0,-1/0].includes(l.zeroPosition)?0:l.zeroPosition},canShowValue(l){return![null,void 0,NaN,1/0,-1/0].includes(l)},findClosestValue(l,i){let n=i[0],c=Math.abs(l-i[0]);for(let r=1;r<i.length;r+=1){const e=Math.abs(l-i[r]);e<c&&i[r]<l&&(n=i[r],c=e)}return n},ratioToMax(l){return l/(this.canShowValue(this.absoluteMax)?this.absoluteMax:1)},selectX(l){this.$emit("selectX",{dataset:this.relativeDataset.map(i=>({name:i.name,value:[null,void 0,NaN].includes(i.absoluteValues[l])?null:i.absoluteValues[l],color:i.color,type:i.type})),index:l,indexLabel:this.FINAL_CONFIG.chart.grid.labels.xAxisLabels.values[l]})},getData(){return this.absoluteDataset.map(l=>({values:l.absoluteValues,color:l.color,name:l.name,type:l.type}))},segregate(l){if(this.segregatedSeries.includes(l.id))this.segregatedSeries=this.segregatedSeries.filter(i=>i!==l.id);else{if(this.segregatedSeries.length+1===this.safeDataset.length)return;this.segregatedSeries.push(l.id)}this.$emit("selectLegend",this.relativeDataset.map(i=>({name:i.name,values:i.absoluteValues,color:i.color,type:i.type}))),this.segregateStep+=1},toggleTooltipVisibility(l,i=null){this.isTooltip=l,l?this.selectedSerieIndex=i:this.selectedSerieIndex=null},toggleFullscreen(l){this.isFullscreen=l,this.step+=1},showSpinnerPdf(){this.isPrinting=!0},async generatePdf(){this.showSpinnerPdf(),clearTimeout(this.__to__),this.isPrinting=!0,this.__to__=setTimeout(async()=>{try{const{default:l}=await Promise.resolve().then(()=>require("./pdf-DSkQT5iH.cjs"));await l({domElement:document.getElementById(`vue-ui-xy_${this.uniqueId}`),fileName:this.FINAL_CONFIG.chart.title.text||"vue-ui-xy"})}catch(l){console.error("Error generating PDF:",l)}finally{this.isPrinting=!1}},100)},generateCsv(){const l=[[this.FINAL_CONFIG.chart.title.text],[this.FINAL_CONFIG.chart.title.subtitle.text],[""]],i=["",...this.table.head.map(e=>e.label)],n=this.table.body,c=l.concat([i]).concat(n),r=this.createCsvContent(c);this.downloadCsv({csvContent:r,title:this.FINAL_CONFIG.chart.title.text||"vue-ui-xy"})},showSpinnerImage(){this.isImaging=!0},async generateImage(){this.showSpinnerImage(),clearTimeout(this.__to__),this.isImaging=!0,this.__to__=setTimeout(async()=>{try{const{default:l}=await Promise.resolve().then(()=>require("./img-BPGizWpM.cjs"));await l({domElement:document.getElementById(`vue-ui-xy_${this.uniqueId}`),fileName:this.FINAL_CONFIG.chart.title.text||"vue-ui-xy",format:"png"})}catch(l){console.error("Error generating image:",l)}finally{this.isImaging=!1}},100)}}},X=["id"],Z={key:1,ref:"noTitle",class:"vue-data-ui-no-title-space",style:"height:36px; width: 100%; background:transparent"},J=["viewBox","aria-label"],K=["x","y","width","height"],Q={key:1},j={class:"vue-ui-xy-grid"},$=["stroke","x1","x2","y1","y2"],ee=["stroke","x1","x2","y1","y2"],te={key:1},le=["x1","x2","y1","y2","stroke"],re=["x1","x2","y1","y2","stroke"],ae=["x1","x2","y1","y2","stroke"],ie={key:3},se=["x1","x2","y1","y2","stroke"],oe=["id"],ne=["stop-color"],ce=["stop-color"],he=["stop-color"],de=["id"],ue=["stop-color"],me=["stop-color"],ge=["stop-color"],fe=["id"],Ne=["stop-color"],Ie=["stop-color"],be=["id"],xe=["stop-color"],Fe=["stop-color"],ke=["id"],_e=["stop-color"],ye=["stop-color"],Ce=["x","y","height","width","fill"],Ae=["x","y","width"],Le=["x","y","height","width","fill"],Se=["x","y","height","width","rx","fill","stroke","stroke-width"],we=["x","y","height","width","rx","fill","stroke","stroke-width"],Oe=["width","x","y"],Ge={key:0},ve=["id"],pe=["fill"],Be=["x1","x2","y1","y2","stroke","marker-end"],Ve=["x","y","font-size","fill"],ze=["stroke","x1","x2","y1","y2"],Ee={key:2},Pe=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],Me=["x","y","width","height","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray"],Te={key:4},De=["x1","x2","y1","y2","stroke","stroke-width"],Re=["fill","font-size","transform"],He=["x1","x2","y1","y2","stroke"],qe=["x","y","font-size","fill"],We=["x1","x2","y1","y2","stroke"],Ye=["x","y","font-size","fill"],Ue=["width","x","y"],Xe={style:{width:"100%"}},Ze={key:0},Je=["id"],Ke=["fill"],Qe=["x1","x2","y1","y2","stroke","marker-end"],je=["x","y","font-size","fill"],$e=["d","stroke","stroke-width","stroke-dasharray"],et=["d","stroke","stroke-width","stroke-dasharray"],tt={key:5},lt={key:0},rt=["d","fill"],at=["d","fill"],it=["d","fill"],st=["d","fill"],ot=["d","stroke","stroke-width","stroke-dasharray"],nt=["d","stroke","stroke-width","stroke-dasharray"],ct=["width","x","y"],ht={style:{width:"100%"}},dt={key:3},ut=["id"],mt=["fill"],gt=["x1","x2","y1","y2","stroke","marker-end"],ft=["x","y","font-size","fill"],Nt={key:6},It=["x","y","font-size","fill"],bt=["x","y","font-size","fill","font-weight"],xt={key:7},Ft=["x","y","font-size","fill"],kt=["x","y"],_t=["x","y"],yt={key:8},Ct=["x","y","font-size","fill"],At=["x","y"],Lt=["x","y"],St=["x","y","font-size","fill","innerHTML"],wt=["x","y","font-size","fill","innerHTML"],Ot=["x","y","font-size","fill","innerHTML"],Gt=["x","y","font-size","fill","innerHTML"],vt=["id"],pt=["stop-color"],Bt=["stop-color"],Vt=["x","y","width","height","fill","onMouseenter"],zt=["font-size","fill","transform"],Et=["x","y","font-size","fill"],Pt={key:10},Mt=["text-anchor","font-size","fill","transform","onClick"],Tt=["x","y","height","width","onMouseenter","onClick"],Dt={key:11,style:{"pointer-events":"none"}},Rt=["x","y"],Ht=["cx","cy","r","fill"],qt={key:5,class:"vue-data-ui-watermark"},Wt=["onClick"],Yt={key:0,viewBox:"0 0 20 12",height:"14",width:"20"},Ut=["stroke","fill"],Xt={key:1,viewBox:"0 0 40 40",height:"14",width:"14"},Zt=["fill"],Jt=["fill"],Kt={key:2,viewBox:"0 0 12 12",height:"14",width:"14"},Qt={key:9,ref:"chartLegend"},jt={key:10,ref:"source",dir:"auto"},$t={style:{display:"flex","flex-direction":"row",gap:"6px","align-items":"center","padding-left":"6px"},"data-html2canvas-ignore":""},el=["innerHTML"];function tl(l,i,n,c,r,e){const I=t.resolveComponent("PenAndPaper"),m=t.resolveComponent("Title"),u=t.resolveComponent("UserOptions"),b=t.resolveComponent("PackageVersion"),C=t.resolveComponent("Shape"),_=t.resolveComponent("Skeleton"),A=t.resolveComponent("Slicer"),y=t.resolveComponent("Tooltip"),g=t.resolveComponent("BaseIcon"),x=t.resolveComponent("TableSparkline"),L=t.resolveComponent("DataTable"),O=t.resolveComponent("Accordion");return t.openBlock(),t.createElementBlock("div",{id:`vue-ui-xy_${r.uniqueId}`,class:t.normalizeClass(`vue-ui-xy ${r.isFullscreen?"vue-data-ui-wrapper-fullscreen":""} ${e.FINAL_CONFIG.useCssAnimation?"":"vue-ui-dna"}`),ref:"chart",style:t.normalizeStyle(`background:${e.FINAL_CONFIG.chart.backgroundColor}; color:${e.FINAL_CONFIG.chart.color};width:100%;font-family:${e.FINAL_CONFIG.chart.fontFamily};${e.FINAL_CONFIG.responsive?"height: 100%":""}`),onMouseenter:i[7]||(i[7]=()=>e.setUserOptionsVisibility(!0)),onMouseleave:i[8]||(i[8]