UNPKG

vue-data-ui-hq

Version:

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

3 lines 99.4 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-ZfICPrrM.cjs"),B=require("./DataTable-CC6dPSer.cjs"),E=require("./Title-FbHK83tB.cjs"),v=require("./Tooltip-C7TJODUx.cjs"),z=require("./usePrinter-B-gh2f22.cjs"),V=require("./Shape-C3YtaYr4.cjs"),P=require("./BaseIcon-DO69J5Rk.cjs"),M=require("./vue-ui-table-sparkline-YmGsrfQG.cjs"),T=require("./vue-ui-skeleton-Bvmpr51u.cjs"),D=require("./Slicer-CtTQxL9r.cjs"),R=require("./vue-ui-accordion-Dp6uTsJi.cjs"),p=require("./useNestedProp-C14rfl0j.cjs"),H=require("./PackageVersion-D3dK8oA3.cjs"),W=require("./PenAndPaper-PL3bp4ud.cjs"),t=require("vue"),q=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Y=u.createUid(),X={name:"vue-ui-xy",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},components:{DataTable:B.DataTable,Shape:V._sfc_main,Title:E._sfc_main,Tooltip:v._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:W.PenAndPaper},data(){this.dataset.forEach((h,l)=>{[null,void 0].includes(h.series)&&this.error({componentName:"VueUiXy",type:"datasetSerieAttribute",property:"series (number[])",index:l})});const r=this.config.downsample&&this.config.downsample.threshold?this.config.downsample.threshold:500,i=Math.max(...this.dataset.map(h=>this.largestTriangleThreeBucketsArray({data:h.series,threshold:r}).length)),n={start:0,end:i};return{themePalettes:u.themePalettes,themes:u.themes,slicerStep:0,selectedScale:null,CTX:null,CANVAS:null,opacity:u.opacity,useSafeValues:!0,palette:u.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:u.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}},watch:{dataset:{handler(r,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(r,i){this.FINAL_CONFIG=this.prepareConfig(),this.prepareChart(),this.titleStep+=1,this.tableStep+=1},deep:!0}},computed:{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 r=this.datasetWithIds.filter(l=>!this.segregatedSeries.includes(l.id)),i=Math.max(...r.map(l=>l.series.length)),n=[];for(let l=0;l<i;l+=1)n.push(r.map(e=>e.series[l]||0).reduce((e,g)=>(e||0)+(g||0),0));const h=Math.min(...n);return n.map(l=>l+(h<0?Math.abs(h):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 r=this.lineSet.map(l=>({name:l.name,color:l.color,scale:l.individualScale,scaleYLabels:l.scaleYLabels,zero:l.zeroPosition,max:l.individualMax,scaleLabel:l.scaleLabel||"",id:l.id,yOffset:l.yOffset||0,individualHeight:l.individualHeight||this.drawingArea.height,autoScaleYLabels:l.autoScaleYLabels})),i=this.barSet.map(l=>({name:l.name,color:l.color,scale:l.individualScale,scaleYLabels:l.scaleYLabels,zero:l.zeroPosition,max:l.individualMax,scaleLabel:l.scaleLabel||"",id:l.id,yOffset:l.yOffset||0,individualHeight:l.individualHeight||this.drawingArea.height})),n=this.plotSet.map(l=>({name:l.name,color:l.color,scale:l.individualScale,scaleYLabels:l.scaleYLabels,zero:l.zeroPosition,max:l.individualMax,scaleLabel:l.scaleLabel||"",id:l.id,yOffset:l.yOffset||0,individualHeight:l.individualHeight||this.drawingArea.height})),h=[...r,...i,...n].flatMap(l=>l).length;return[...r,...i,...n].flatMap((l,e)=>({id:l.id,scaleLabel:l.scaleLabel,name:l.name,color:l.color,scale:l.scale,yOffset:l.yOffset,individualHeight:l.individualHeight,x:this.mutableConfig.isStacked?this.drawingArea.left:this.drawingArea.left/h*(e+1),yLabels:l.scaleYLabels||l.scale.ticks.map(g=>({y:g>=0?l.zero-l.individualHeight*(g/l.max):l.zero+l.individualHeight*Math.abs(g)/l.max,value:g}))}))},isDataset(){return!!this.dataset&&this.dataset.length},chartFont(){const r=document.getElementById(`vue-ui-xy_${this.uniqueId}`);return window.getComputedStyle(r,null).getPropertyValue("font-family")},FINAL_CONFIG:{get:function(){return this.prepareConfig()},set:function(r){return r}},hasHighlightArea(){return Array.isArray(this.FINAL_CONFIG.chart.highlightArea)?this.FINAL_CONFIG.chart.highlightArea.some(r=>r.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 r=this.FINAL_CONFIG.chart.highlightArea;return[{...r,span:r.from===r.to?1:r.to<r.from?0:r.to-r.from+1}]},xPadding(){return this.FINAL_CONFIG.chart.grid.position==="middle"?0:this.drawingArea.width/this.maxSeries/2},relativeZero(){return this.niceScale.min>=0?0:Math.abs(this.niceScale.min)},absoluteMax(){return this.niceScale.max+this.relativeZero},datasetWithIds(){return this.useSafeValues?this.dataset.map((r,i)=>({...r,series:this.largestTriangleThreeBucketsArray({data:r.series,threshold:this.FINAL_CONFIG.downsample.threshold}),id:`uniqueId_${i}`})):this.dataset},safeDataset(){return this.useSafeValues?this.dataset.map((r,i)=>{const n=this.largestTriangleThreeBucketsArray({data:r.series,threshold:this.FINAL_CONFIG.downsample.threshold});return{...r,series:n.map(h=>this.isSafeValue(h)?h:null).slice(this.slicer.start,this.slicer.end),color:this.convertColorToHex(r.color?r.color:this.customPalette[i]?this.customPalette[i]:this.palette[i]),id:`uniqueId_${i}`}}):this.dataset},relativeDataset(){return this.safeDataset.map((r,i)=>({...r,series:r.series.map(n=>n+this.relativeZero),absoluteValues:r.series})).filter(r=>!this.segregatedSeries.includes(r.id))},tableSparklineDataset(){return this.relativeDataset.map(r=>{const i=r.absoluteValues.map(n=>[void 0,null].includes(n)?0:n);return{id:r.id,name:r.name,color:r.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((r,i)=>({absoluteIndex:i,...r,series:r.series.map(n=>n+this.relativeZero),absoluteValues:r.series,segregate:()=>this.segregate(r),isSegregated:this.segregatedSeries.includes(r.id)}))},barSet(){return this.activeSeriesWithStackRatios.filter(r=>r.type==="bar").map((r,i)=>{this.checkAutoScaleError(r);const n=Math.min(...r.absoluteValues.filter(d=>![null,void 0].includes(d))),h=Math.max(...r.absoluteValues.filter(d=>![null,void 0].includes(d))),e={ratios:r.absoluteValues.filter(d=>![null,void 0].includes(d)).map(d=>(d-n)/(h-n)),valueMin:n,valueMax:h<0?0:h},g={max:r.scaleMax||Math.max(...r.absoluteValues)||1,min:r.scaleMin||Math.min(...r.absoluteValues.filter(d=>![void 0,null].includes(d)))>0?0:Math.min(...r.absoluteValues.filter(d=>![null,void 0].includes(d)))},x=r.scaleSteps||this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps,b=1.0000001,m=this.calculateNiceScaleWithExactExtremes(g.min,g.max===g.min?g.max*b:g.max,x),N=this.calculateNiceScaleWithExactExtremes(e.valueMin,e.valueMax===e.valueMin?e.valueMax*b:e.valueMax,x),S=m.min>=0?0:Math.abs(m.min),C=0,A=m.max+S,_=N.max+Math.abs(C),I=this.mutableConfig.isStacked?this.drawingArea.height*(1-r.cumulatedStackRatio):0,F=this.mutableConfig.isStacked?this.drawingArea.height*r.stackRatio-this.FINAL_CONFIG.chart.grid.labels.yAxis.gap:this.drawingArea.height,L=this.drawingArea.bottom-I-F*S/A,a=this.drawingArea.bottom-I-F*C/_,o=this.absoluteDataset.filter(d=>d.type==="bar").filter(d=>!this.segregatedSeries.includes(d.id)).length,s=r.series.map((d,f)=>{const O=this.mutableConfig.useIndividualScale?(r.absoluteValues[f]+S)/A:this.ratioToMax(d),G=this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?this.drawingArea.left+this.drawingArea.width/this.maxSeries*f:this.drawingArea.left+this.slot.bar*i+this.slot.bar*f*o-this.barSlot/2-i*this.barPeriodGap;return{yOffset:this.checkNaN(I),individualHeight:this.checkNaN(F),x:this.checkNaN(G),y:this.drawingArea.bottom-I-F*O,value:r.absoluteValues[f],zeroPosition:this.checkNaN(L),individualMax:this.checkNaN(A),comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[f]||""}}),c=r.absoluteValues.map(d=>N.min>=0?(d-Math.abs(N.min))/(N.max-Math.abs(N.min)):(d+Math.abs(N.min))/(N.max+Math.abs(N.min))),w=r.series.map((d,f)=>{const O=this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?this.drawingArea.left+this.drawingArea.width/this.maxSeries*f:this.drawingArea.left-this.slot.bar/2+this.slot.bar*i+this.slot.bar*f*this.absoluteDataset.filter(G=>G.type==="bar").filter(G=>!this.segregatedSeries.includes(G.id)).length;return{yOffset:this.checkNaN(I),individualHeight:this.checkNaN(F),x:this.checkNaN(O),y:this.checkNaN(this.drawingArea.bottom-this.checkNaN(I)-(this.checkNaN(F)*c[f]||0)),value:r.absoluteValues[f],zeroPosition:this.checkNaN(L),individualMax:this.checkNaN(A),comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[f]||""}}),k=m.ticks.map(d=>({y:d>=0?L-F*(d/A):L+F*Math.abs(d)/A,value:d,prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:r})),y=N.ticks.map(d=>{const f=(d-N.min)/(N.max-N.min);return{y:d>=0?a-F*f:a+F*f,value:d,prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:r}});return{...r,yOffset:I,autoScaleYLabels:y,individualHeight:F,scaleYLabels:r.autoScaling?y:k,individualScale:r.autoScaling?N:m,individualMax:r.autoScaling?_:A,zeroPosition:r.autoScaling?a:L,plots:r.autoScaling?w:s}})},activeSeriesLength(){return this.absoluteDataset.length},activeSeriesWithStackRatios(){return this.assignStackRatios(this.absoluteDataset.filter(r=>!this.segregatedSeries.includes(r.id)))},lineSet(){return this.activeSeriesWithStackRatios.filter(r=>r.type==="line").map(r=>{this.checkAutoScaleError(r);const i=Math.min(...r.absoluteValues.filter(d=>![void 0,null].includes(d))),n=Math.max(...r.absoluteValues.filter(d=>![void 0,null].includes(d)))||1,l={ratios:r.absoluteValues.filter(d=>![null,void 0].includes(d)).map(d=>(d-i)/(n-i)),valueMin:i,valueMax:n},e={max:r.scaleMax||Math.max(...r.absoluteValues)||1,min:r.scaleMin||(Math.min(...r.absoluteValues)>0?0:Math.min(...r.absoluteValues))},g=r.scaleSteps||this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps,x=1.0000001,b=this.calculateNiceScaleWithExactExtremes(e.min,e.max===e.min?e.max*x:e.max,g),m=this.calculateNiceScaleWithExactExtremes(l.valueMin,l.valueMax===l.valueMin?l.valueMax*x:l.valueMax,g),N=b.min>=0?0:Math.abs(b.min),S=0,C=b.max+Math.abs(N),A=m.max+Math.abs(S),_=this.mutableConfig.isStacked?this.drawingArea.height*(1-r.cumulatedStackRatio):0,I=this.mutableConfig.isStacked?this.drawingArea.height*r.stackRatio-this.FINAL_CONFIG.chart.grid.labels.yAxis.gap:this.drawingArea.height,F=this.drawingArea.bottom-_-I*N/C,L=this.drawingArea.bottom-_-I*S/A,a=r.series.map((d,f)=>{const O=this.mutableConfig.useIndividualScale?(r.absoluteValues[f]+Math.abs(N))/C:this.ratioToMax(d);return{x:this.checkNaN(this.drawingArea.left+this.slot.line/2+this.slot.line*f),y:this.checkNaN(this.drawingArea.bottom-_-I*O),value:r.absoluteValues[f],comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[f]||""}}),o=r.absoluteValues.map(d=>m.min>=0?(d-Math.abs(m.min))/(m.max-Math.abs(m.min)):(d+Math.abs(m.min))/(m.max+Math.abs(m.min))),s=r.series.map((d,f)=>[void 0,null].includes(r.absoluteValues[f])?{x:this.checkNaN(this.drawingArea.left+this.slot.line/2+this.slot.line*f),y:F,value:r.absoluteValues[f],comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[f]||""}:{x:this.checkNaN(this.drawingArea.left+this.slot.line/2+this.slot.line*f),y:this.checkNaN(this.drawingArea.bottom-_-(I*o[f]||0)),value:r.absoluteValues[f],comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[f]||""}),c=this.createSmoothPath(a),w=this.createSmoothPath(s),k=b.ticks.map(d=>({y:d>=0?F-I*(d/C):F+I*Math.abs(d)/C,value:d,prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:r})),y=m.ticks.map(d=>{const f=(d-m.min)/(m.max-m.min);return{y:d>=0?L-I*f:L+I*f,value:d,prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:r}});return{...r,yOffset:_,autoScaleYLabels:y,individualHeight:I,scaleYLabels:r.autoScaling?y:k,individualScale:r.autoScaling?m:b,individualMax:r.autoScaling?A:C,zeroPosition:r.autoScaling?L:F,curve:r.autoScaling?w:c,plots:r.autoScaling?s:a,area:r.useArea?this.mutableConfig.useIndividualScale?this.createIndividualArea(r.autoScaling?s:a,r.autoScaling?L:F):this.createArea(a):""}})},plotSet(){return this.activeSeriesWithStackRatios.filter(r=>r.type==="plot").map(r=>{this.checkAutoScaleError(r);const i=Math.min(...r.absoluteValues.filter(k=>![null,void 0].includes(k))),n=Math.max(...r.absoluteValues.filter(k=>![null,void 0].includes(k)))||1,l={ratios:r.absoluteValues.filter(k=>![null,void 0].includes(k)).map(k=>(k-i)/(n-i)),valueMin:i,valueMax:n},e={max:r.scaleMax||Math.max(...r.absoluteValues)||1,min:r.scaleMin||Math.min(...r.absoluteValues)>0?0:Math.min(...r.absoluteValues)},g=r.scaleSteps||this.FINAL_CONFIG.chart.grid.labels.yAxis.commonScaleSteps,x=1.0000001,b=this.calculateNiceScaleWithExactExtremes(e.min,e.max===e.min?e.max*x:e.max,g),m=this.calculateNiceScaleWithExactExtremes(l.valueMin,l.valueMax===l.valueMin?l.valueMax*x:l.valueMax,g),N=b.min>=0?0:Math.abs(b.min),S=0,C=b.max+N,A=m.max+Math.abs(S),_=this.mutableConfig.isStacked?this.drawingArea.height*(1-r.cumulatedStackRatio):0,I=this.mutableConfig.isStacked?this.drawingArea.height*r.stackRatio-this.FINAL_CONFIG.chart.grid.labels.yAxis.gap:this.drawingArea.height,F=this.drawingArea.bottom-_-I*N/C,L=this.drawingArea.bottom-_-I*S/A,a=r.series.map((k,y)=>{const d=this.mutableConfig.useIndividualScale?(r.absoluteValues[y]+Math.abs(N))/C:this.ratioToMax(k);return{x:this.checkNaN(this.drawingArea.left+this.slot.plot/2+this.slot.plot*y),y:this.checkNaN(this.drawingArea.bottom-_-I*d),value:r.absoluteValues[y],comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[y]||""}}),o=r.absoluteValues.map(k=>m.min>=0?(k-Math.abs(m.min))/(m.max-Math.abs(m.min)):(k+Math.abs(m.min))/(m.max+Math.abs(m.min))),s=r.series.map((k,y)=>({x:this.checkNaN(this.drawingArea.left+this.slot.plot/2+this.slot.plot*y),y:this.checkNaN(this.drawingArea.bottom-_-(I*o[y]||0)),value:r.absoluteValues[y],comment:r.comments&&r.comments.slice(this.slicer.start,this.slicer.end)[y]||""})),c=b.ticks.map(k=>({y:k>=0?F-I*(k/C):F+I*Math.abs(k)/C,value:k,prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:r})),w=m.ticks.map(k=>{const y=(k-m.min)/(m.max-m.min);return{y:k>=0?L-I*y:L+I*y,value:k,prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix,datapoint:r}});return{...r,yOffset:_,autoScaleYLabels:w,individualHeight:I,scaleYLabels:r.autoScaling?w:c,individualScale:r.autoScaling?m:b,individualMax:r.autoScaling?A:C,zeroPosition:r.autoScaling?L:F,plots:r.autoScaling?s:a}})},drawingArea(){const r=this.mutableConfig.useIndividualScale&&this.FINAL_CONFIG.chart.grid.labels.show?this.absoluteDataset.filter(i=>!this.segregatedSeries.includes(i.id)).length*(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+r,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+r)}},max(){return this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMax?this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMax:Math.max(...this.safeDataset.filter(r=>!this.segregatedSeries.includes(r.id)).map(r=>Math.max(...r.series)))},min(){if(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin!==null)return this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin;const r=Math.min(...this.safeDataset.filter(i=>!this.segregatedSeries.includes(i.id)).map(i=>Math.min(...i.series)));return r>0?0:r},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 r=Math.max(...this.dataset.map(n=>this.largestTriangleThreeBucketsArray({data:n.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length)),i=[];for(let n=0;n<r;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(r=>r.type==="bar").filter(r=>!this.segregatedSeries.includes(r.id)).length,plot:this.drawingArea.width/this.maxSeries,line:this.drawingArea.width/this.maxSeries}},barSlot(){const r=this.safeDataset.filter(i=>i.type==="bar").filter(i=>!this.segregatedSeries.includes(i.id)).length;return this.drawingArea.width/this.maxSeries/r-this.barPeriodGap*r},barPeriodGap(){return this.slot.line*this.FINAL_CONFIG.bar.periodGap},maxSlot(){return Math.max(...Object.values(this.slot).filter(r=>r!==1/0))},table(){if(this.safeDataset.length===0)return{head:[],body:[],config:{},columnNames:[]};const r=this.relativeDataset.map(n=>({label:n.name,color:n.color,type:n.type})),i=[];return this.timeLabels.forEach((n,h)=>{const l=[n.text];this.relativeDataset.forEach(e=>{l.push(this.canShowValue(e.absoluteValues[h])?Number(e.absoluteValues[h].toFixed(this.FINAL_CONFIG.table.rounding)):"")}),i.push(l)}),{head:r,body:i}},dataTable(){const r=this.FINAL_CONFIG.table.showSum;let i=[""].concat(this.relativeDataset.map(e=>e.name));r&&(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 g=this.relativeDataset.map(x=>x.absoluteValues[e]??0).reduce((x,b)=>x+b,0);n.push([this.timeLabels[e].text??"-"].concat(this.relativeDataset.map(x=>this.applyDataLabel(x.type==="line"?this.FINAL_CONFIG.line.labels.formatter:x.type==="bar"?this.FINAL_CONFIG.bar.labels.formatter:this.FINAL_CONFIG.plot.labels.formatter,x.absoluteValues[e]??0,this.dataLabel({p:x.prefix||this.FINAL_CONFIG.chart.labels.prefix,v:x.absoluteValues[e]??0,s:x.suffix||this.FINAL_CONFIG.chart.labels.suffix,r:this.FINAL_CONFIG.table.rounding})))).concat(r?(g??0).toFixed(this.FINAL_CONFIG.table.rounding):[]))}const h={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},l=[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:h,colNames:l}},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(r=>({shape:r.shape||null,name:r.name,color:r.color,type:r.type,value:r.absoluteValues.find((i,n)=>n===this.selectedSerieIndex),comments:r.comments||[],prefix:r.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:r.suffix||this.FINAL_CONFIG.chart.labels.suffix}))},tooltipContent(){let r="",i=this.selectedSeries.map(l=>l.value).filter(l=>this.isSafeValue(l)&&l!==null).reduce((l,e)=>Math.abs(l)+Math.abs(e),0);const n=this.timeLabels[this.selectedSerieIndex],h=this.FINAL_CONFIG.chart.tooltip.customFormat;return this.isFunction(h)&&this.functionReturnsString(()=>h({seriesIndex:this.selectedSerieIndex,datapoint:this.selectedSeries,series:this.absoluteDataset,bars:this.barSet,lines:this.lineSet,plots:this.plotSet,config:this.FINAL_CONFIG}))?h({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&&(r+=`<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(l=>{if(this.isSafeValue(l.value)){let e="",g="";switch(this.icons[l.type]){case"bar":e=`<svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" rx="1" stroke="none" height="12" width="12" fill="${l.color}" /></svg>`;break;case"line":!l.shape||!["star","triangle","square","diamond","pentagon","hexagon"].includes(l.shape)?g=`<circle cx="10" cy="8" r="4" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" fill="${l.color}" />`:l.shape==="triangle"?g=`<path d="${u.createPolygonPath({plot:{x:10,y:8},radius:4,sides:3,rotation:.52}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:l.shape==="square"?g=`<path d="${u.createPolygonPath({plot:{x:10,y:8},radius:4,sides:4,rotation:.8}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:l.shape==="diamond"?g=`<path d="${u.createPolygonPath({plot:{x:10,y:8},radius:4,sides:4,rotation:0}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:l.shape==="pentagon"?g=`<path d="${u.createPolygonPath({plot:{x:10,y:8},radius:4,sides:5,rotation:.95}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:l.shape==="hexagon"?g=`<path d="${u.createPolygonPath({plot:{x:10,y:8},radius:4,sides:6,rotation:0}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" />`:l.shape==="star"&&(g=`<polygon stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="0.5" fill="${l.color}" points="${u.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="${l.color}" />${g}</svg>`;break;case"plot":if(!l.shape||!["star","triangle","square","diamond","pentagon","hexagon"].includes(l.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="${l.color}" /></svg>`;break}if(l.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="${l.color}" points="${u.createStar({plot:{x:6,y:6},radius:5})}" /></svg>`;break}if(l.shape==="triangle"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${u.createPolygonPath({plot:{x:6,y:6},radius:6,sides:3,rotation:.52}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(l.shape==="square"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${u.createPolygonPath({plot:{x:6,y:6},radius:6,sides:4,rotation:.8}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(l.shape==="diamond"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${u.createPolygonPath({plot:{x:6,y:6},radius:5,sides:4,rotation:0}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(l.shape==="pentagon"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${u.createPolygonPath({plot:{x:6,y:6},radius:5,sides:5,rotation:.95}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}if(l.shape==="hexagon"){e=`<svg viewBox="0 0 12 12" height="14" width="14"><path d="${u.createPolygonPath({plot:{x:6,y:6},radius:5,sides:6,rotation:0}).path}" fill="${l.color}" stroke="${this.FINAL_CONFIG.chart.tooltip.backgroundColor}" stroke-width="1" /></svg>`;break}}r+=`<div style="display:flex;flex-direction:row; align-items:center;gap:3px;"><div style="width:20px">${e}</div> ${l.name}: <b>${this.FINAL_CONFIG.chart.tooltip.showValue?this.applyDataLabel(l.type==="line"?this.FINAL_CONFIG.line.labels.formatter:l.type==="bar"?this.FINAL_CONFIG.bar.labels.formatter:this.FINAL_CONFIG.plot.labels.formatter,l.value,this.dataLabel({p:l.prefix,v:l.value,s:l.suffix,r:this.FINAL_CONFIG.chart.tooltip.roundingValue}),{datapoint:l}):""}</b> ${this.FINAL_CONFIG.chart.tooltip.showPercentage?`(${u.dataLabel({v:this.checkNaN(Math.abs(l.value)/i*100),s:"%",r:this.FINAL_CONFIG.chart.tooltip.roundingPercentage})})`:""}</div>`,this.FINAL_CONFIG.chart.comments.showInTooltip&&l.comments.length&&l.comments.slice(this.slicer.start,this.slicer.end)[this.selectedSerieIndex]&&(r+=`<div class="vue-data-ui-tooltip-comment" style="background:${l.color}20; padding: 6px; margin-bottom: 6px; border-left: 1px solid ${l.color}">${l.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}">${r}</div>`)},svg(){return{height:this.height,width:this.width}},yLabels(){return this.niceScale.ticks.map(r=>({y:r>=0?this.zero-this.drawingArea.height*this.ratioToMax(r):this.zero+this.drawingArea.height*this.ratioToMax(Math.abs(r)),value:r,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.prepareChart(),this.setupSlicer(),document.addEventListener("mousemove",r=>{this.clientPosition={x:r.clientX,y:r.clientY}})},methods:{abbreviate:u.abbreviate,adaptColorToBackground:u.adaptColorToBackground,applyDataLabel:u.applyDataLabel,assignStackRatios:u.assignStackRatios,calcLinearProgression:u.calcLinearProgression,calculateNiceScaleWithExactExtremes:u.calculateNiceScaleWithExactExtremes,checkNaN:u.checkNaN,closestDecimal:u.closestDecimal,convertColorToHex:u.convertColorToHex,convertConfigColors:u.convertConfigColors,convertCustomPalette:u.convertCustomPalette,createCsvContent:u.createCsvContent,createSmoothPath:u.createSmoothPath,createTSpans:u.createTSpans,dataLabel:u.dataLabel,downloadCsv:u.downloadCsv,error:u.error,functionReturnsString:u.functionReturnsString,hasDeepProperty:u.hasDeepProperty,isFunction:u.isFunction,isSafeValue:u.isSafeValue,largestTriangleThreeBucketsArray:u.largestTriangleThreeBucketsArray,objectIsEmpty:u.objectIsEmpty,setOpacity:u.setOpacity,shiftHue:u.shiftHue,translateSize:u.translateSize,treeShake:u.treeShake,useMouse:v.useMouse,useNestedProp:p.useNestedProp,setUserOptionsVisibility(r=!1){this.showUserOptionsOnChartHover&&(this.userOptionsVisible=r)},toggleAnnotator(){this.isAnnotator=!this.isAnnotator},selectTimeLabel(r,i){const n=this.relativeDataset.map(h=>({shape:h.shape||null,name:h.name,color:h.color,type:h.type,value:h.absoluteValues.find((l,e)=>e===i),comments:h.comments||[],prefix:h.prefix||this.FINAL_CONFIG.chart.labels.prefix,suffix:h.suffix||this.FINAL_CONFIG.chart.labels.suffix}));this.$emit("selectTimeLabel",{datapoint:n,absoluteIndex:r.absoluteIndex,label:r.text})},getHighlightAreaPosition(r){const i=this.drawingArea.left+this.drawingArea.width/this.maxSeries*(r.from-this.slicer.start),n=this.drawingArea.width/(this.slicer.end-this.slicer.start)*r.span<0?1e-5:this.drawingArea.width/(this.slicer.end-this.slicer.start)*r.span;return{x:i<this.drawingArea.left?this.drawingArea.left:i,width:n}},prepareConfig(){const r=u.useConfig().vue_ui_xy;if(!Object.keys(this.config||{}).length)return r;const i=this.useNestedProp({userConfig:this.config,defaultConfig:r});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,i.theme?{...p.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((r,i)=>{[null,void 0].includes(r.name)&&this.error({componentName:"VueUiXy",type:"datasetSerieAttribute",property:"name (string)",index:i})}),this.FINAL_CONFIG.showWarnings&&this.dataset.forEach(r=>{r.series.forEach((i,n)=>{this.isSafeValue(i)||console.warn(`VueUiXy has detected an unsafe value in your dataset: -----> The serie '${r.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:h}=i.getBoundingClientRect();let l=null,e=0;this.FINAL_CONFIG.chart.title.show&&(l=this.$refs.chartTitle,e=l.getBoundingClientRect().height);let g=null,x=0;this.FINAL_CONFIG.chart.zoom.show&&this.maxX>6&&this.isDataset&&(g=this.$refs.chartSlicer.$el,x=g.getBoundingClientRect().height);let b=null,m=0;this.FINAL_CONFIG.chart.legend.show&&(b=this.$refs.chartLegend,m=b.getBoundingClientRect().height);let N=0;this.$refs.source&&(N=this.$refs.source.getBoundingClientRect().height);let S=0;this.$refs.noTitle&&(S=this.$refs.noTitle.getBoundingClientRect().height),this.height=n-e-m-x-N-S,this.width=h,this.viewBox=`0 0 ${this.width<0?10:this.width} ${this.height<0?10:this.height}`,this.convertSizes(),new ResizeObserver(A=>{for(const _ of A)this.$refs.chartTitle&&(e=this.$refs.chartTitle.getBoundingClientRect().height),this.$refs.chartSlicer&&this.$refs.chartSlicer.$el&&(x=this.$refs.chartSlicer.$el.getBoundingClientRect().height),this.$refs.chartLegend&&(m=this.$refs.chartLegend.getBoundingClientRect().height),this.$refs.source&&(N=this.$refs.source.getBoundingClientRect().height),this.height=_.contentBoxSize[0].blockSize-e-m-x-N-24,this.width=_.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(r){this.selectedMinimapIndex=r},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(r){r.autoScaling&&(this.FINAL_CONFIG.chart.grid.labels.yAxis.useIndividualScale||console.warn(`VueUiXy (datapoint: ${r.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: ${r.name}) : autoScaling only works when config.chart.grid.labels.yAxis.stacked is set to true`))},createArea(r){if(!r[0])return[-10,-10,"",-10,-10];const i={x:r[0].x,y:this.zero},n={x:r.at(-1).x,y:this.zero},h=[];return r.forEach(l=>{h.push(`${l.x},${l.y} `)}),[i.x,i.y,...h,n.x,n.y].toString()},createIndividualArea(r,i){if(!r[0])return[-10,-10,"",-10,-10];const n={x:r[0]?r[0].x:Math.min(...r.filter(e=>!!e).map(e=>e.x)),y:i},h={x:r.at(-1)?r.at(-1).x:Math.min(...r.filter(e=>!!e).map(e=>e.x)),y:i},l=[];return r.filter(e=>!!e).forEach(e=>{l.push(`${e.x},${e.y} `)}),[n.x,n.y,...l,h.x,h.y].toString()},createStar:u.createStar,createPolygonPath:u.createPolygonPath,fillArray(r,i){let n=Array(r).fill(0);for(let h=0;h<i.length&&h<r;h+=1)n[h]=i[h];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(r=>this.largestTriangleThreeBucketsArray({data:r.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length))},this.slicerStep+=1)},refreshSlicer(){this.setupSlicer()},validSlicerEnd(r){const i=Math.max(...this.dataset.map(n=>this.largestTriangleThreeBucketsArray({data:n.series,threshold:this.FINAL_CONFIG.downsample.threshold}).length));return r>i?i:r<0||this.FINAL_CONFIG.chart.zoom.startIndex!==null&&r<this.FINAL_CONFIG.chart.zoom.startIndex?this.FINAL_CONFIG.chart.zoom.startIndex!==null?this.FINAL_CONFIG.chart.zoom.startIndex+1:1:r},calcRectHeight(r){return r.value>=0?this.checkNaN(this.zero-r.y<=0?1e-5:this.zero-r.y):this.checkNaN(r.y-this.zero<=0?1e-5:r.y-this.zero)},calcIndividualHeight(r){return r.value>=0?this.checkNaN(r.zeroPosition-r.y<=0?1e-5:r.zeroPosition-r.y):this.checkNaN(r.y-r.zeroPosition<=0?1e-5:r.zeroPosition-r.y)},calcRectWidth(){return this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?this.slot.line-this.drawingArea.width/this.maxSeries*.1:this.slot.bar},calcRectX(r){return this.mutableConfig.useIndividualScale&&this.mutableConfig.isStacked?r.x+this.drawingArea.width/this.maxSeries*.05:r.x+this.slot.bar/2},calcRectY(r){return r.value>=0?r.y:this.zero},calcIndividualRectY(r){return r.value>=0?r.y:[null,void 0,NaN,1/0,-1/0].includes(r.zeroPosition)?0:r.zeroPosition},canShowValue(r){return![null,void 0,NaN,1/0,-1/0].includes(r)},findClosestValue(r,i){let n=i[0],h=Math.abs(r-i[0]);for(let l=1;l<i.length;l+=1){const e=Math.abs(r-i[l]);e<h&&i[l]<r&&(n=i[l],h=e)}return n},ratioToMax(r){return r/(this.canShowValue(this.absoluteMax)?this.absoluteMax:1)},selectX(r){this.$emit("selectX",{dataset:this.relativeDataset.map(i=>({name:i.name,value:[null,void 0,NaN].includes(i.absoluteValues[r])?null:i.absoluteValues[r],color:i.color,type:i.type})),index:r,indexLabel:this.FINAL_CONFIG.chart.grid.labels.xAxisLabels.values[r]})},getData(){return this.absoluteDataset.map(r=>({values:r.absoluteValues,color:r.color,name:r.name,type:r.type}))},segregate(r){if(this.segregatedSeries.includes(r.id))this.segregatedSeries=this.segregatedSeries.filter(i=>i!==r.id);else{if(this.segregatedSeries.length+1===this.safeDataset.length)return;this.segregatedSeries.push(r.id)}this.$emit("selectLegend",this.relativeDataset.map(i=>({name:i.name,values:i.absoluteValues,color:i.color,type:i.type}))),this.segregateStep+=1},toggleTooltipVisibility(r,i=null){this.isTooltip=r,r?this.selectedSerieIndex=i:this.selectedSerieIndex=null},toggleFullscreen(r){this.isFullscreen=r,this.step+=1},showSpinnerPdf(){this.isPrinting=!0},async generatePdf(){this.showSpinnerPdf(),clearTimeout(this.__to__),this.isPrinting=!0,this.__to__=setTimeout(async()=>{try{const{default:r}=await Promise.resolve().then(()=>require("./pdf-v1ddxvP5.cjs"));await r({domElement:document.getElementById(`vue-ui-xy_${this.uniqueId}`),fileName:this.FINAL_CONFIG.chart.title.text||"vue-ui-xy"})}catch(r){console.error("Error generating PDF:",r)}finally{this.isPrinting=!1}},100)},generateCsv(){const r=[[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,h=r.concat([i]).concat(n),l=this.createCsvContent(h);this.downloadCsv({csvContent:l,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:r}=await Promise.resolve().then(()=>require("./img-BFCs759q.cjs"));await r({domElement:document.getElementById(`vue-ui-xy_${this.uniqueId}`),fileName:this.FINAL_CONFIG.chart.title.text||"vue-ui-xy",format:"png"})}catch(r){console.error("Error generating image:",r)}finally{this.isImaging=!1}},100)}}},U=["id"],Z={key:1,ref:"noTitle",class:"vue-data-ui-no-title-space",style:"height:36px; width: 100%; background:transparent"},J=["viewBox"],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"],Ne=["id"],fe=["stop-color"],Ie=["stop-color"],xe=["id"],ke=["stop-color"],Fe=["stop-color"],be=["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=["width","x","y"],Oe={key:0},Ge=["id"],ve=["fill"],pe=["x1","x2","y1","y2","stroke","marker-end"],Be=["x","y","font-size","fill"],Ee=["stroke","x1","x2","y1","y2"],ze={key:2},Ve=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],Pe=["x","y","width","height","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray"],Me={key:4},Te=["x1","x2","y1","y2","stroke","stroke-width"],De=["fill","font-size","transform"],Re=["x1","x2","y1","y2","stroke"],He=["x","y","font-size","fill"],We=["x1","x2","y1","y2","stroke"],qe=["x","y","font-size","fill"],Ye=["width","x","y"],Xe={style:{width:"100%"}},Ue={key:0},Ze=["id"],Je=["fill"],Ke=["x1","x2","y1","y2","stroke","marker-end"],Qe=["x","y","font-size","fill"],je=["d","stroke","stroke-width","stroke-dasharray"],$e={key:1},et=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],tt={key:0},lt=["d","fill"],rt=["d","fill"],at=["d","stroke","stroke-width","stroke-dasharray"],it={key:2},st=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],ot=["width","x","y"],nt={style:{width:"100%"}},ct={key:3},ht=["id"],dt=["fill"],ut=["x1","x2","y1","y2","stroke","marker-end"],mt=["x","y","font-size","fill"],gt={key:5},Nt=["x","y","font-size","fill"],ft=["x","y","font-size","fill","font-weight"],It={key:6},xt=["x","y","font-size","fill"],kt=["x","y"],Ft=["x","y"],bt={key:7},_t=["x","y","font-size","fill"],yt=["x","y"],Ct=["x","y"],At=["x","y","font-size","fill","innerHTML"],Lt=["x","y","font-size","fill","innerHTML"],St=["x","y","font-size","fill","innerHTML"],wt=["x","y","font-size","fill","innerHTML"],Ot=["x","y","width","height","fill","onMouseenter"],Gt=["font-size","fill","transform"],vt=["x","y","font-size","fill"],pt={key:9},Bt=["text-anchor","font-size","fill","transform","onClick"],Et=["x","y","height","width","onMouseenter","onClick"],zt={key:10},Vt=["x","y"],Pt=["cx","cy","r","fill"],Mt={key:5,class:"vue-data-ui-watermark"},Tt=["onClick"],Dt={key:0,viewBox:"0 0 20 12",height:"14",width:"20"},Rt=["stroke","fill"],Ht={key:1,viewBox:"0 0 12 12",height:"14",width:"14"},Wt=["fill"],qt={key:9,ref:"chartLegend"},Yt={key:10,ref:"source",dir:"auto"},Xt={style:{display:"flex","flex-direction":"row",gap:"6px","align-items":"center","padding-left":"6px"},"data-html2canvas-ignore":""},Ut=["innerHTML"];function Zt(r,i,n,h,l,e){const g=t.resolveComponent("PenAndPaper"),x=t.resolveComponent("Title"),b=t.resolveComponent("UserOptions"),m=t.resolveComponent("PackageVersion"),N=t.resolveComponent("Shape"),S=t.resolveComponent("Skeleton"),C=t.resolveComponent("Slicer"),A=t.resolveComponent("Tooltip"),_=t.resolveComponent("BaseIcon"),I=t.resolveComponent("TableSparkline"),F=t.resolveComponent("DataTable"),L=t.resolveComponent("Accordion");return t.openBlock(),t.createElementBlock("div",{id:`vue-ui-xy_${l.uniqueId}`,class:t.normalizeClass(`vue-ui-xy ${l.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]=()=>e.setUserOptionsVisibility(!1))},[e.FINAL_CONFIG.chart.userOptions.buttons.annotator?(t.openBlock(),t.createBlock(g,{key:0,parent:r.$refs.chart,backgroundColor:e.FINAL_CONFIG.chart.backgroundColor,color:e.FINAL_CONFIG.chart.color,active:l.isAnnotator,onClose:e.toggleAnnotator},null,8,["parent","backgroundColor","color","active","onClose"])):t.createCommentVNode("",!0),e.hasOptionsNoTitle?(t.openBlock(),t.createElementBlock("div",Z,null,512)):t.createCommentVNode("",!0),e.FINAL_CONFIG.chart.title.show?(t.openBlock(),t.createElementBlock("div",{key:2,ref:"chartTitle",class:"vue-ui-xy-title",style:t.normalizeStyle(`font-family:${e.FINAL_CONFIG.chart.fontFamily}`)},[(t.openBlock(),t.createBlock(x,{key:`title_${l.titleStep}`,config:{title:{cy:"xy-div-title",...e.FINAL_CONFIG.chart.title},subtitle:{cy:"xy-div-subtitle",...e.FINAL_CONFIG.chart.title.subtitle}}},null,8,["config"]))],4)):t.createCommentVNode("",!0),e.FINAL_CONFIG.chart.userOptions.show&&e.isDataset&&(l.keepUserOptionState||l.userOptionsVisible)?(t.openBlock(),t.createBlock(b,{ref:"defails",key:`user_options_${l.step}`,backgroundColor:e.FINAL_CONFIG.chart.backgroundColor,color:e.FINAL_CONFIG.chart.color,isPrinting:l.isPrinting,isImaging:l.isImaging,uid:l.uniqueId,hasTooltip:e.FINAL_CONFIG.chart.userOptions.buttons.tooltip&&e.FINAL_CONFIG.chart.tooltip.show,hasPdf:e.FINAL_CONFIG.chart.userOptions.buttons.pdf,hasXls:e.FINAL_CONFIG.chart.userOptions.buttons.csv,hasImg:e.FINAL_CONFIG.chart.userOptions.buttons.img,hasLabel:e.FINAL_CONFIG.chart.userOptions.buttons.labels,hasTable:e.FINAL_CONFIG.chart.userOptions.buttons.table,hasStack:n.dataset.length>1&&e.FINAL_CONFIG.chart.userOptions.buttons.stack,hasFullscreen:e.FINAL_CONFIG.chart.userOptions.buttons.fullscreen,isStacked:l.mutableConfig.isStacked,isFullscreen:l.isFullscreen,chartElement:r.$refs.chart,position:e.FINAL_CONFIG.chart.userOptions.position,isTooltip:l.mutableConfig.showTooltip,titles:{...e.FINAL_CONFIG.chart.userOptions.buttonTitles},hasAnnotator:e.FINAL_CONFIG.chart.userOptions.buttons.annotator,isAnnotation:l.isAnnotator,onToggleFullscreen:e.toggleFullscreen,onGeneratePdf:e.generatePdf,onGenerateCsv:e.generateCsv,onGenerateImage:e.generateImage,onToggleTable:e.toggleTable,onToggleLabels:e.toggleLabels,onToggleStack:e.toggleStack,onToggleTooltip:e.toggleTooltip,onToggleAnnotator:e.toggleAnnotator,style:t.normalizeStyle({visibility:l.keepUserOptionState?l.userOptionsVisible?"visible":"hidden":"visible"})},t.createSlots({_:2},[r.$slots.optionTooltip?{name:"optionTooltip",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionTooltip",{},void 0,!0)]),key:"0"}:void 0,r.$slots.optionPdf?{name:"optionPdf",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionPdf",{},void 0,!0)]),key:"1"}:void 0,r.$slots.optionCsv?{name:"optionCsv",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionCsv",{},void 0,!0)]),key:"2"}:void 0,r.$slots.optionImg?{name:"optionImg",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionImg",{},void 0,!0)]),key:"3"}:void 0,r.$slots.optionTable?{name:"optionTable",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionTable",{},void 0,!0)]),key:"4"}:void 0,r.$slots.optionLabels?{name:"optionLabels",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionLabels",{},void 0,!0)]),key:"5"}:void 0,r.$slots.optionStack?{name:"optionStack",fn:t.withCtx(()=>[t.renderSlot(r.$slots,"optionStack",{},void 0,!0)]),key:"6"}:void 0,r.$slots.optionFullscreen?{name:"optionFullscreen",fn:t.withCtx(({toggleFullscreen:a,isFullscreen:o})=>[t.renderSlot(r.$slots,"optionFullscreen",t.normalizeProps(t.guardReactiveProps({toggleFullscreen:a,isFullscreen:o})),void 0,!0)]),key:"7"}:void 0,r.$slots.optionAnnotator?{name:"optionAnnotator",fn:t.withCtx(({toggleAnnotator:a,isAnnotator:o})=>[t.renderSlot(r.$slots,"optionAnnotator",t.normalizeProps(t.guardReactiveProps({toggleAnnotator:a,isAnnotator:o})),void 0,!0)]),key:"8"}:void 0]),1032,["backgroundColor","color","isPrinting","isImaging","uid","hasTooltip","hasPdf","hasXls","hasImg","hasLabel","hasTable","hasStack","hasFullscreen","isStacked","isFullscreen","chartElement","position","isTooltip","titles","hasAnnotator","isAnnotation","onToggleFullscreen","onGeneratePdf","onGenerateCsv","onGenerateImage","onToggleTable","onToggleLabels","onToggleStack","onToggleTooltip","onToggleAnnotator","style"])):t.createCommentVNode("",!0),e.isDataset?(t.openBlock(),t.createElementBlock("svg",{key:4,xmlns:"http://www.w3.org/2000/svg",class:t.normalizeClass([{"vue-data-ui-fullscreen--on":l.isFullscreen,"vue-data-ui-fulscreen--off":!l.isFullscreen},"vue-ui-xy-svg"]),width:"100%",viewBox:l.viewBox,style:t.normalizeStyle(`background: transparent; color:${e.FINAL_CONFIG.chart.color}; font-family:${e.FINAL_CONFIG.chart.fontFamily}`)},[t.createVNode(m),r.$slots["chart-background"]?(t.openBlock(),t.createElementBlock("foreignObject",{key:0,x:e.drawingArea.left+e.xPad