vue-chrts 0.0.42 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-chrts.js +275 -283
- package/dist/vue-chrts.umd.cjs +1 -6
- package/package.json +1 -1
package/dist/vue-chrts.umd.cjs
CHANGED
|
@@ -51,9 +51,4 @@
|
|
|
51
51
|
}
|
|
52
52
|
`;class Fs{constructor(t){this.data=t}get data(){return this._data}set data(t){this._data=t}}var Ie;(function(e){e.X="x",e.Y="y"})(Ie||(Ie={}));var D;(function(e){e.X="x",e.Y="y"})(D||(D={}));var ze;(function(e){e.West="west",e.East="east",e.North="north",e.South="south"})(ze||(ze={}));const Ps=Object.assign(Object.assign({},Pt),{components:[],tooltip:void 0,crosshair:void 0,annotations:void 0,xAxis:void 0,yAxis:void 0,autoMargin:!0,xScale:void 0,xDomain:void 0,xDomainMinConstraint:void 0,xDomainMaxConstraint:void 0,xRange:void 0,yScale:void 0,yDomain:void 0,yDomainMinConstraint:void 0,yDomainMaxConstraint:void 0,yRange:void 0,yDirection:ze.North,preventEmptyDomain:null,scaleByDomain:!1});class Ls extends ie{constructor(t,n,r){var i,s;super(t),this._defaultConfig=Ps,this.datamodel=new Fs,this.config=this._defaultConfig,this._clipPathId=xs(),this._axisMargin={top:0,bottom:0,left:0,right:0},this._firstRender=!0,this._clipPath=this.svg.append("clipPath").attr("id",this._clipPathId),this._clipPath.append("rect");const a="saturate",c=window.location.href.replace(window.location.hash,"");this.svg.attr("class",gs`
|
|
53
53
|
--highlight-filter-id: url(${c}#${a}); // defining a css variable
|
|
54
|
-
`),this._svgDefs.append("filter").attr("id",a).attr("filterUnits","objectBoundingBox").html('<feColorMatrix type="saturate" in="SourceGraphic" values="1.35"/>'),n&&this.updateContainer(n,!0),r&&this.setData(r,!0),(this.config.xAxis||this.config.yAxis||!((i=this.components)===null||i===void 0)&&i.some(o=>o.datamodel.data))&&this.render(),(s=document.fonts)===null||s===void 0||s.ready.then(()=>{this._firstRender||this._renderAxes(0)})}get components(){return this.config.components}get width(){const t=this._getMargin();return G(this.containerWidth-t.left-t.right,0,Number.POSITIVE_INFINITY)}get height(){const t=this._getMargin();return G(this.containerHeight-t.top-t.bottom,0,Number.POSITIVE_INFINITY)}setData(t,n){var r,i,s,a;const{components:c,config:o}=this;t&&(this.datamodel.data=t,c.forEach(f=>{f.setData(t)}),(r=o.crosshair)===null||r===void 0||r.setData(t),(i=o.xAxis)===null||i===void 0||i.setData(t),(s=o.yAxis)===null||s===void 0||s.setData(t),(a=o.tooltip)===null||a===void 0||a.hide(),n||this.render())}updateContainer(t,n){super.updateContainer(t),this._removeAllChildren(),this.setData(this.datamodel.data,!0),t.xAxis&&(this.config.xAxis.config.type=Ie.X,this.element.appendChild(t.xAxis.element)),t.yAxis&&(this.config.yAxis.config.type=Ie.Y,this.element.appendChild(t.yAxis.element));for(const a of this.components)this.element.appendChild(a.element);const r=t.tooltip;r&&(r.hasContainer()||r.setContainer(this._container),r.setComponents(this.components));const i=t.crosshair;i&&(i.setContainer(this.svg),i.tooltip=r,this.element.appendChild(i.element));const s=t.annotations;s&&this.element.appendChild(s.element),this.element.appendChild(this._clipPath.node()),this.element.appendChild(this._svgDefs.node()),this.element.appendChild(this._svgDefsExternal.node()),n||this.render()}updateComponents(t,n){const{config:r}=this;this.components.forEach((i,s)=>{t[s]&&i.setConfig(t[s])}),this._updateScales(...this.components,r.xAxis,r.yAxis,r.crosshair),n||this.render()}update(t,n,r){r&&(this.datamodel.data=r),t&&this.updateContainer(t,!0),n&&this.updateComponents(n,!0),this.render()}_preRender(){const{config:t}=this;super._preRender(),t.autoMargin&&this._setAutoMargin();const n=te([...this.components,t.xAxis,t.yAxis,t.crosshair,t.annotations]);for(const r of n)r.setSize(this.width,this.height,this.containerWidth,this.containerHeight);this._updateScales(...this.components,t.xAxis,t.yAxis,t.crosshair)}_render(t){var n,r,i,s,a;const{config:c}=this;super._render();const o=this._getMargin();for(const u of this.components)u.g.attr("transform",`translate(${o.left},${o.top})`).style("clip-path",u.clippable?`url(#${this._clipPathId})`:null).style("-webkit-clip-path",u.clippable?`url(#${this._clipPathId})`:null),u.render(t);this._renderAxes(this._firstRender?0:t);const f=2;this._clipPath.select("rect").attr("x",-2).attr("y",-2).attr("width",this.width+2*f).attr("height",this.height+2*f),(n=c.tooltip)===null||n===void 0||n.update();const l=c.crosshair;if(l){const u=this.components.filter(h=>!h.stacked).map(h=>h.config.y),g=this.components.filter(h=>h.stacked).map(h=>h.config.y),p=(r=this.components.find(h=>h.config.baseline))===null||r===void 0?void 0:r.config,v=p==null?void 0:p.baseline;l.accessors={x:(i=this.components[0])===null||i===void 0?void 0:i.config.x,y:wt(u),yStacked:wt(g),baseline:v},l.g.attr("transform",`translate(${o.left},${o.top})`).style("clip-path",`url(#${this._clipPathId})`).style("-webkit-clip-path",`url(#${this._clipPathId})`),l.hide()}(s=c.annotations)===null||s===void 0||s.g.attr("transform",`translate(${o.left},${o.top})`),(a=c.annotations)===null||a===void 0||a.render(),this._firstRender=!1}_updateScales(...t){const n=te(t||this.components);this._setScales(...n),this._updateScalesDomain(...n),this._updateScalesRange(...n)}_setScales(...t){const{config:n}=this;t&&(n.xScale&&t.forEach(r=>r.setScale(D.X,n.xScale)),n.yScale&&t.forEach(r=>r.setScale(D.Y,n.yScale)))}_updateScalesDomain(...t){const{config:n}=this;if(!t)return;const r=t.filter(i=>!i.config.excludeFromDomainCalculation);Object.values(D).forEach(i=>{var s,a,c,o,f,l,u,g;const[p,v]=ti(ri(r.map(C=>C.getDataExtent(i,n.scaleByDomain)))),h=i===D.Y?n.yDomain:n.xDomain,m=i===D.Y?n.yDomainMinConstraint:n.xDomainMinConstraint,x=i===D.Y?n.yDomainMaxConstraint:n.xDomainMaxConstraint,w=(a=(s=h==null?void 0:h[0])!==null&&s!==void 0?s:p)!==null&&a!==void 0?a:0,A=(o=(c=h==null?void 0:h[1])!==null&&c!==void 0?c:v)!==null&&o!==void 0?o:1,R=[G(w,(f=m==null?void 0:m[0])!==null&&f!==void 0?f:Number.NEGATIVE_INFINITY,(l=m==null?void 0:m[1])!==null&&l!==void 0?l:Number.POSITIVE_INFINITY),G(A,(u=x==null?void 0:x[0])!==null&&u!==void 0?u:Number.NEGATIVE_INFINITY,(g=x==null?void 0:x[1])!==null&&g!==void 0?g:Number.POSITIVE_INFINITY)];if(R[0]===R[1]){const C=r.some(N=>{var _;return((_=N.datamodel.data)===null||_===void 0?void 0:_.length)>0});(n.preventEmptyDomain||n.preventEmptyDomain===null&&(!C||i===D.Y))&&(R[1]=R[0]+1)}t.forEach(C=>C.setScaleDomain(i,R))})}_updateScalesRange(...t){var n,r,i,s,a,c;const{config:o}=this;if(!t)return;const f=o.yDirection===ze.South,l=[(n=o.padding.left)!==null&&n!==void 0?n:0,this.width-((r=o.padding.right)!==null&&r!==void 0?r:0)],u=[this.height-((i=o.padding.bottom)!==null&&i!==void 0?i:0),(s=o.padding.top)!==null&&s!==void 0?s:0];f&&u.reverse();for(const p of t)p.setSize(this.width,this.height,this.containerWidth,this.containerHeight),p.setScaleRange(D.X,(a=o.xRange)!==null&&a!==void 0?a:l),p.setScaleRange(D.Y,(c=o.yRange)!==null&&c!==void 0?c:u);const g=t.map(p=>p.bleed).reduce((p,v)=>{for(const h of Object.keys(p)){const m=h;p[m]<v[m]&&(p[m]=v[m])}return p},{top:0,bottom:0,left:0,right:0});for(const p of t)p.setScaleRange(D.X,[l[0]+g.left,l[1]-g.right]),p.setScaleRange(D.Y,f?[u[0]+g.top,u[1]-g.bottom]:[u[0]-g.bottom,u[1]+g.top])}_renderAxes(t){const{config:{xAxis:n,yAxis:r}}=this,i=this._getMargin();te([n,r]).forEach(a=>{const c=a.getOffset(i);a.g.attr("transform",`translate(${c.left},${c.top})`),a.render(t)})}_setAutoMargin(){const{config:{xAxis:t,yAxis:n}}=this,r=te([...this.components,t,n]);this._setScales(...r),this._updateScalesDomain(...r);const i=this._firstRender?2:1;for(let s=0;s<i;s+=1){const a={top:0,bottom:0,left:0,right:0};this._updateScalesRange(...r),te([t,n]).forEach(o=>{o.preRender();const f=o.getRequiredMargin();a.top<f.top&&(a.top=f.top),a.bottom<f.bottom&&(a.bottom=f.bottom),a.left<f.left&&(a.left=f.left),a.right<f.right&&(a.right=f.right)}),this._axisMargin=a}}_getMargin(){const{config:{margin:t}}=this;return{top:t.top+this._axisMargin.top,bottom:t.bottom+this._axisMargin.bottom,left:t.left+this._axisMargin.left,right:t.right+this._axisMargin.right}}destroy(){const{components:t,config:{tooltip:n,crosshair:r,annotations:i,xAxis:s,yAxis:a}}=this;super.destroy();for(const c of t)c==null||c.destroy();n==null||n.destroy(),r==null||r.destroy(),i==null||i.destroy(),s==null||s.destroy(),a==null||a.destroy()}}const Hs=Symbol("componentAccessorKey"),Vs=Symbol("tooltipAccessorKey"),Ws=Symbol("crosshairAccessorKey"),qs=Symbol("axisAccessorKey"),Us=Symbol("annotationsAccessorKey");function Ys(e){const t=d.getCurrentInstance(),n=t.attrs;return d.computed(()=>{const r={},i=(t==null?void 0:t.vnode.props)??{};return Object.keys(i).forEach(s=>{r[d.camelize(s)]=e[d.camelize(s)]}),{...r,...n}})}const Xs=d.defineComponent({__name:"index",props:{components:{},xScale:{type:[Object,Function]},xDomain:{},xDomainMinConstraint:{},xDomainMaxConstraint:{},xRange:{},yScale:{type:[Object,Function]},yDomain:{},yDomainMinConstraint:{},yDomainMaxConstraint:{},yRange:{},yDirection:{},xAxis:{},yAxis:{},autoMargin:{type:Boolean},tooltip:{},crosshair:{},preventEmptyDomain:{type:[Boolean,null]},scaleByDomain:{type:Boolean},annotations:{},duration:{},margin:{},padding:{},sizing:{},width:{},height:{},svgDefs:{},ariaLabel:{},data:{}},setup(e,{expose:t}){const n=e,{data:r}=d.toRefs(n),i=Ys(n),s=d.ref(),a=d.reactive({components:[],annotations:void 0,crosshair:void 0,tooltip:void 0,xAxis:void 0,yAxis:void 0}),c=d.ref();return d.watch(r,()=>{s.value&&s.value.setData(r.value,!0)}),d.watchEffect(()=>{var o;a.components.map(f=>f.config),(o=s.value)==null||o.updateContainer({...d.toRaw(i.value),...d.toRaw(a)})}),d.onMounted(()=>{c.value&&(s.value=new Ls(c.value,{...d.toRaw(a)},r.value))}),d.onUnmounted(()=>{var o;return(o=s.value)==null?void 0:o.destroy()}),d.provide(Hs,{data:r,update:o=>a.components=[...a.components,o],destroy:()=>{var o;return a.components=(o=a.components)==null?void 0:o.filter(f=>!f.isDestroyed())}}),d.provide(qs,{data:r,update:o=>a[`${o.config.type}Axis`]=o,destroy:o=>{a[`${o}Axis`]=void 0}}),d.provide(Ws,{data:r,update:o=>a.crosshair=o,destroy:()=>{a.crosshair=void 0}}),d.provide(Vs,{data:r,update:o=>a.tooltip=o,destroy:()=>{a.tooltip=void 0}}),d.provide(Us,{data:r,update:o=>a.annotations=o,destroy:()=>{a.annotations=void 0}}),t({component:s}),(o,f)=>(d.openBlock(),d.createElementBlock("div",{"data-vis-xy-container":"",ref_key:"elRef",ref:c,class:"unovis-xy-container"},[d.renderSlot(o.$slots,"default")],512))}});(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".unovis-xy-container,.unovis-single-container{display:block;position:relative;width:100%}[data-vis-leaflet-map],[data-vis-leaflet-flow-map]{display:block;position:relative}[data-vis-bullet-legend]{display:block}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Gs=d.defineComponent({__name:"Area",props:{data:{},height:{},xLabel:{},yLabel:{},categories:{},xFormatter:{},yFormatter:{},curveType:{},xNumTicks:{default:e=>e.data.length>24?24/4:e.data.length-1},yNumTicks:{default:e=>e.data.length>24?24/4:e.data.length-1},hideLegend:{type:Boolean},hideTooltip:{type:Boolean},gridLineX:{type:Boolean},domainLineX:{type:Boolean},gridLineY:{type:Boolean},domainLineY:{type:Boolean},paginationPoisition:{}},setup(e){const t=e,r=Object.values(t.categories).map(i=>i.color).map((i,s)=>`
|
|
55
|
-
<linearGradient id="gradient${s}-${i}" gradientTransform="rotate(90)">
|
|
56
|
-
<stop offset="0%" stop-color="${i}" stop-opacity="1" />
|
|
57
|
-
<stop offset="100%" stop-color="${i}" stop-opacity="0" />
|
|
58
|
-
</linearGradient>
|
|
59
|
-
`).join("");return(i,s)=>{const a=d.resolveComponent("VisAxis");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["flex flex-col space-y-4",{"flex-col-reverse":t.paginationPoisition==="top"}])},[d.createVNode(d.unref(Xs),{data:i.data,height:i.height,"svg-defs":d.unref(r)},{default:d.withCtx(()=>[d.createVNode(a,{type:"x","tick-format":i.xFormatter,"num-ticks":i.xNumTicks,label:i.xLabel,"grid-line":i.gridLineX,"domain-line":i.domainLineX,"tick-line":!!i.gridLineX},null,8,["tick-format","num-ticks","label","grid-line","domain-line","tick-line"]),d.createVNode(a,{type:"y","num-ticks":i.yNumTicks??i.data.length,"tick-format":i.yFormatter,label:i.yLabel,"grid-line":i.gridLineY,"domain-line":i.domainLineY,"tick-line":!!i.gridLineY},null,8,["num-ticks","tick-format","label","grid-line","domain-line","tick-line"])]),_:1},8,["data","height","svg-defs"])],2)}}});var mn=(e=>(e.Top="top",e.Bottom="bottom",e))(mn||{});const Zs=((e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n})(d.defineComponent({__name:"Button",props:{variant:{},size:{}},setup(e){return(t,n)=>(d.openBlock(),d.createElementBlock("button",{class:d.normalizeClass(["button",`button--${t.variant||"primary"}`,`button--${t.size||"medium"}`])},[d.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-52b6ec0c"]]);L.Area=Gs,L.Button=Zs,L.PaginationPosition=mn,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
|
54
|
+
`),this._svgDefs.append("filter").attr("id",a).attr("filterUnits","objectBoundingBox").html('<feColorMatrix type="saturate" in="SourceGraphic" values="1.35"/>'),n&&this.updateContainer(n,!0),r&&this.setData(r,!0),(this.config.xAxis||this.config.yAxis||!((i=this.components)===null||i===void 0)&&i.some(o=>o.datamodel.data))&&this.render(),(s=document.fonts)===null||s===void 0||s.ready.then(()=>{this._firstRender||this._renderAxes(0)})}get components(){return this.config.components}get width(){const t=this._getMargin();return G(this.containerWidth-t.left-t.right,0,Number.POSITIVE_INFINITY)}get height(){const t=this._getMargin();return G(this.containerHeight-t.top-t.bottom,0,Number.POSITIVE_INFINITY)}setData(t,n){var r,i,s,a;const{components:c,config:o}=this;t&&(this.datamodel.data=t,c.forEach(f=>{f.setData(t)}),(r=o.crosshair)===null||r===void 0||r.setData(t),(i=o.xAxis)===null||i===void 0||i.setData(t),(s=o.yAxis)===null||s===void 0||s.setData(t),(a=o.tooltip)===null||a===void 0||a.hide(),n||this.render())}updateContainer(t,n){super.updateContainer(t),this._removeAllChildren(),this.setData(this.datamodel.data,!0),t.xAxis&&(this.config.xAxis.config.type=Ie.X,this.element.appendChild(t.xAxis.element)),t.yAxis&&(this.config.yAxis.config.type=Ie.Y,this.element.appendChild(t.yAxis.element));for(const a of this.components)this.element.appendChild(a.element);const r=t.tooltip;r&&(r.hasContainer()||r.setContainer(this._container),r.setComponents(this.components));const i=t.crosshair;i&&(i.setContainer(this.svg),i.tooltip=r,this.element.appendChild(i.element));const s=t.annotations;s&&this.element.appendChild(s.element),this.element.appendChild(this._clipPath.node()),this.element.appendChild(this._svgDefs.node()),this.element.appendChild(this._svgDefsExternal.node()),n||this.render()}updateComponents(t,n){const{config:r}=this;this.components.forEach((i,s)=>{t[s]&&i.setConfig(t[s])}),this._updateScales(...this.components,r.xAxis,r.yAxis,r.crosshair),n||this.render()}update(t,n,r){r&&(this.datamodel.data=r),t&&this.updateContainer(t,!0),n&&this.updateComponents(n,!0),this.render()}_preRender(){const{config:t}=this;super._preRender(),t.autoMargin&&this._setAutoMargin();const n=te([...this.components,t.xAxis,t.yAxis,t.crosshair,t.annotations]);for(const r of n)r.setSize(this.width,this.height,this.containerWidth,this.containerHeight);this._updateScales(...this.components,t.xAxis,t.yAxis,t.crosshair)}_render(t){var n,r,i,s,a;const{config:c}=this;super._render();const o=this._getMargin();for(const u of this.components)u.g.attr("transform",`translate(${o.left},${o.top})`).style("clip-path",u.clippable?`url(#${this._clipPathId})`:null).style("-webkit-clip-path",u.clippable?`url(#${this._clipPathId})`:null),u.render(t);this._renderAxes(this._firstRender?0:t);const f=2;this._clipPath.select("rect").attr("x",-2).attr("y",-2).attr("width",this.width+2*f).attr("height",this.height+2*f),(n=c.tooltip)===null||n===void 0||n.update();const l=c.crosshair;if(l){const u=this.components.filter(h=>!h.stacked).map(h=>h.config.y),g=this.components.filter(h=>h.stacked).map(h=>h.config.y),p=(r=this.components.find(h=>h.config.baseline))===null||r===void 0?void 0:r.config,v=p==null?void 0:p.baseline;l.accessors={x:(i=this.components[0])===null||i===void 0?void 0:i.config.x,y:wt(u),yStacked:wt(g),baseline:v},l.g.attr("transform",`translate(${o.left},${o.top})`).style("clip-path",`url(#${this._clipPathId})`).style("-webkit-clip-path",`url(#${this._clipPathId})`),l.hide()}(s=c.annotations)===null||s===void 0||s.g.attr("transform",`translate(${o.left},${o.top})`),(a=c.annotations)===null||a===void 0||a.render(),this._firstRender=!1}_updateScales(...t){const n=te(t||this.components);this._setScales(...n),this._updateScalesDomain(...n),this._updateScalesRange(...n)}_setScales(...t){const{config:n}=this;t&&(n.xScale&&t.forEach(r=>r.setScale(D.X,n.xScale)),n.yScale&&t.forEach(r=>r.setScale(D.Y,n.yScale)))}_updateScalesDomain(...t){const{config:n}=this;if(!t)return;const r=t.filter(i=>!i.config.excludeFromDomainCalculation);Object.values(D).forEach(i=>{var s,a,c,o,f,l,u,g;const[p,v]=ti(ri(r.map(C=>C.getDataExtent(i,n.scaleByDomain)))),h=i===D.Y?n.yDomain:n.xDomain,m=i===D.Y?n.yDomainMinConstraint:n.xDomainMinConstraint,x=i===D.Y?n.yDomainMaxConstraint:n.xDomainMaxConstraint,w=(a=(s=h==null?void 0:h[0])!==null&&s!==void 0?s:p)!==null&&a!==void 0?a:0,A=(o=(c=h==null?void 0:h[1])!==null&&c!==void 0?c:v)!==null&&o!==void 0?o:1,R=[G(w,(f=m==null?void 0:m[0])!==null&&f!==void 0?f:Number.NEGATIVE_INFINITY,(l=m==null?void 0:m[1])!==null&&l!==void 0?l:Number.POSITIVE_INFINITY),G(A,(u=x==null?void 0:x[0])!==null&&u!==void 0?u:Number.NEGATIVE_INFINITY,(g=x==null?void 0:x[1])!==null&&g!==void 0?g:Number.POSITIVE_INFINITY)];if(R[0]===R[1]){const C=r.some(N=>{var _;return((_=N.datamodel.data)===null||_===void 0?void 0:_.length)>0});(n.preventEmptyDomain||n.preventEmptyDomain===null&&(!C||i===D.Y))&&(R[1]=R[0]+1)}t.forEach(C=>C.setScaleDomain(i,R))})}_updateScalesRange(...t){var n,r,i,s,a,c;const{config:o}=this;if(!t)return;const f=o.yDirection===ze.South,l=[(n=o.padding.left)!==null&&n!==void 0?n:0,this.width-((r=o.padding.right)!==null&&r!==void 0?r:0)],u=[this.height-((i=o.padding.bottom)!==null&&i!==void 0?i:0),(s=o.padding.top)!==null&&s!==void 0?s:0];f&&u.reverse();for(const p of t)p.setSize(this.width,this.height,this.containerWidth,this.containerHeight),p.setScaleRange(D.X,(a=o.xRange)!==null&&a!==void 0?a:l),p.setScaleRange(D.Y,(c=o.yRange)!==null&&c!==void 0?c:u);const g=t.map(p=>p.bleed).reduce((p,v)=>{for(const h of Object.keys(p)){const m=h;p[m]<v[m]&&(p[m]=v[m])}return p},{top:0,bottom:0,left:0,right:0});for(const p of t)p.setScaleRange(D.X,[l[0]+g.left,l[1]-g.right]),p.setScaleRange(D.Y,f?[u[0]+g.top,u[1]-g.bottom]:[u[0]-g.bottom,u[1]+g.top])}_renderAxes(t){const{config:{xAxis:n,yAxis:r}}=this,i=this._getMargin();te([n,r]).forEach(a=>{const c=a.getOffset(i);a.g.attr("transform",`translate(${c.left},${c.top})`),a.render(t)})}_setAutoMargin(){const{config:{xAxis:t,yAxis:n}}=this,r=te([...this.components,t,n]);this._setScales(...r),this._updateScalesDomain(...r);const i=this._firstRender?2:1;for(let s=0;s<i;s+=1){const a={top:0,bottom:0,left:0,right:0};this._updateScalesRange(...r),te([t,n]).forEach(o=>{o.preRender();const f=o.getRequiredMargin();a.top<f.top&&(a.top=f.top),a.bottom<f.bottom&&(a.bottom=f.bottom),a.left<f.left&&(a.left=f.left),a.right<f.right&&(a.right=f.right)}),this._axisMargin=a}}_getMargin(){const{config:{margin:t}}=this;return{top:t.top+this._axisMargin.top,bottom:t.bottom+this._axisMargin.bottom,left:t.left+this._axisMargin.left,right:t.right+this._axisMargin.right}}destroy(){const{components:t,config:{tooltip:n,crosshair:r,annotations:i,xAxis:s,yAxis:a}}=this;super.destroy();for(const c of t)c==null||c.destroy();n==null||n.destroy(),r==null||r.destroy(),i==null||i.destroy(),s==null||s.destroy(),a==null||a.destroy()}}const Hs=Symbol("componentAccessorKey"),Vs=Symbol("tooltipAccessorKey"),Ws=Symbol("crosshairAccessorKey"),qs=Symbol("axisAccessorKey"),Us=Symbol("annotationsAccessorKey");function Ys(e){const t=d.getCurrentInstance(),n=t.attrs;return d.computed(()=>{const r={},i=(t==null?void 0:t.vnode.props)??{};return Object.keys(i).forEach(s=>{r[d.camelize(s)]=e[d.camelize(s)]}),{...r,...n}})}const Xs=d.defineComponent({__name:"index",props:{components:{},xScale:{type:[Object,Function]},xDomain:{},xDomainMinConstraint:{},xDomainMaxConstraint:{},xRange:{},yScale:{type:[Object,Function]},yDomain:{},yDomainMinConstraint:{},yDomainMaxConstraint:{},yRange:{},yDirection:{},xAxis:{},yAxis:{},autoMargin:{type:Boolean},tooltip:{},crosshair:{},preventEmptyDomain:{type:[Boolean,null]},scaleByDomain:{type:Boolean},annotations:{},duration:{},margin:{},padding:{},sizing:{},width:{},height:{},svgDefs:{},ariaLabel:{},data:{}},setup(e,{expose:t}){const n=e,{data:r}=d.toRefs(n),i=Ys(n),s=d.ref(),a=d.reactive({components:[],annotations:void 0,crosshair:void 0,tooltip:void 0,xAxis:void 0,yAxis:void 0}),c=d.ref();return d.watch(r,()=>{s.value&&s.value.setData(r.value,!0)}),d.watchEffect(()=>{var o;a.components.map(f=>f.config),(o=s.value)==null||o.updateContainer({...d.toRaw(i.value),...d.toRaw(a)})}),d.onMounted(()=>{c.value&&(s.value=new Ls(c.value,{...d.toRaw(a)},r.value))}),d.onUnmounted(()=>{var o;return(o=s.value)==null?void 0:o.destroy()}),d.provide(Hs,{data:r,update:o=>a.components=[...a.components,o],destroy:()=>{var o;return a.components=(o=a.components)==null?void 0:o.filter(f=>!f.isDestroyed())}}),d.provide(qs,{data:r,update:o=>a[`${o.config.type}Axis`]=o,destroy:o=>{a[`${o}Axis`]=void 0}}),d.provide(Ws,{data:r,update:o=>a.crosshair=o,destroy:()=>{a.crosshair=void 0}}),d.provide(Vs,{data:r,update:o=>a.tooltip=o,destroy:()=>{a.tooltip=void 0}}),d.provide(Us,{data:r,update:o=>a.annotations=o,destroy:()=>{a.annotations=void 0}}),t({component:s}),(o,f)=>(d.openBlock(),d.createElementBlock("div",{"data-vis-xy-container":"",ref_key:"elRef",ref:c,class:"unovis-xy-container"},[d.renderSlot(o.$slots,"default")],512))}});(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".unovis-xy-container,.unovis-single-container{display:block;position:relative;width:100%}[data-vis-leaflet-map],[data-vis-leaflet-flow-map]{display:block;position:relative}[data-vis-bullet-legend]{display:block}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Gs=d.defineComponent({__name:"Area",props:{data:{},height:{},xLabel:{},yLabel:{},categories:{},xFormatter:{},yFormatter:{},curveType:{},xNumTicks:{default:e=>e.data.length>24?24/4:e.data.length-1},yNumTicks:{default:e=>e.data.length>24?24/4:e.data.length-1},hideLegend:{type:Boolean},hideTooltip:{type:Boolean},gridLineX:{type:Boolean},domainLineX:{type:Boolean},gridLineY:{type:Boolean},domainLineY:{type:Boolean},paginationPoisition:{}},setup(e){const t=e;return(n,r)=>{const i=d.resolveComponent("VisAxis");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["flex flex-col space-y-4",{"flex-col-reverse":t.paginationPoisition==="top"}])},[d.createVNode(d.unref(Xs),{data:n.data,height:n.height},{default:d.withCtx(()=>[d.createVNode(i,{type:"x","tick-format":n.xFormatter,"num-ticks":n.xNumTicks,label:n.xLabel,"grid-line":n.gridLineX,"domain-line":n.domainLineX,"tick-line":!!n.gridLineX},null,8,["tick-format","num-ticks","label","grid-line","domain-line","tick-line"]),d.createVNode(i,{type:"y","num-ticks":n.yNumTicks??n.data.length,"tick-format":n.yFormatter,label:n.yLabel,"grid-line":n.gridLineY,"domain-line":n.domainLineY,"tick-line":!!n.gridLineY},null,8,["num-ticks","tick-format","label","grid-line","domain-line","tick-line"])]),_:1},8,["data","height"])],2)}}});var mn=(e=>(e.Top="top",e.Bottom="bottom",e))(mn||{});const Zs=((e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n})(d.defineComponent({__name:"Button",props:{variant:{},size:{}},setup(e){return(t,n)=>(d.openBlock(),d.createElementBlock("button",{class:d.normalizeClass(["button",`button--${t.variant||"primary"}`,`button--${t.size||"medium"}`])},[d.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-52b6ec0c"]]);L.Area=Gs,L.Button=Zs,L.PaginationPosition=mn,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|