@glycanage/web-components 1.211.0 → 1.212.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as W,S as M,i as O,f as D,s as G,e as b,b as T,n as t,p as L,g as k,q as f,u as C,k as P,o as I,A as B}from"./index2.js";import{g as H}from"./globals.js";import{f as g}from"./helpers.js";const{document:V}=H;function q(w){let o,x,h,s,d,e,i,y;return{c(){o=b("div"),x=b("div"),h=T(),s=b("div"),s.textContent="Age",d=T(),e=b("div"),e.textContent="Immune resilience index",i=T(),y=b("link"),t(x,"width","100%"),t(x,"height","100%"),t(s,"position","absolute"),t(s,"bottom","3px"),t(s,"left","50%"),t(s,"transform","translateX(-50%)"),t(s,"font-family","Sen, sans-serif"),t(s,"font-size","12px"),t(s,"color","#09341F"),t(s,"opacity","0.8"),t(e,"position","absolute"),t(e,"top","50%"),t(e,"right","83%"),t(e,"transform","translateY(-50%) rotate(-90deg)"),t(e,"font-family","Sen, sans-serif"),t(e,"font-size","12px"),t(e,"color","#09341F"),t(e,"opacity","0.8"),t(e,"white-space","nowrap"),t(o,"width","100%"),t(o,"height","100%"),t(o,"position","relative"),L(y,"href","https://fonts.googleapis.com/css2?family=Sen:wght@400..800&display=swap"),L(y,"rel","stylesheet")},m(n,v){k(n,o,v),f(o,x),w[2](x),f(o,h),f(o,s),f(o,d),f(o,e),k(n,i,v),f(V.head,y)},p:C,i:C,o:C,d(n){n&&(P(o),P(i)),w[2](null),P(y)}}}function Z(w,o,x){let{service:h=window.GaReportService}=o,s,d,e=0,i={},y="",n=0,v=0,$=0,u,a=0;function R(){u&&(i=echarts.init(u,null,{devicePixelRatio:4,renderer:"svg"}));const r=u.getBoundingClientRect();var m={textStyle:{fontFamily:"Sen, sans serif"},animation:!1,backgroundColor:"transparent",grid:{top:"25px",left:"50px",right:"45px",bottom:"40px"},dataset:[{source:d.data.map(c=>[c.x,c.y])}],tooltip:{show:!1},xAxis:{min:0,max:100,interval:20,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[8]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",opacity:.8,formatter(c){return c===0||c===100?"":c}},splitLine:{show:!0}},yAxis:{min:0,max:2,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[5]},axisTick:{show:!1},axisLabel:{show:!1,color:"#09341F",opacity:.8,formatter(c){return c===0||c===.6?"":c}},splitLine:{show:!0}},series:[{type:"scatter",tooltip:{},symbolSize:4,itemStyle:{color:"#09341F",opacity:.4,borderWidth:1,lineWidth:12}},{name:"Resilience index",type:"scatter",data:[{x:n,y:e}],itemStyle:{color:g(a)}}],graphic:[]};i.setOption(m),m.graphic.push({type:"line",shape:{x1:i.convertToPixel("xAxis",n),y1:i.convertToPixel("yAxis",0),x2:i.convertToPixel("xAxis",n),y2:i.convertToPixel("yAxis",e)},style:{stroke:g(a),lineDash:[8,8],lineWidth:1},z:8}),m.graphic.push({type:"line",shape:{x1:i.convertToPixel("xAxis",0),y1:i.convertToPixel("yAxis",e),x2:i.convertToPixel("xAxis",n),y2:i.convertToPixel("yAxis",e)},style:{stroke:g(a),lineDash:[8,8],lineWidth:1},z:8}),m.graphic.push({name:"Measured result",type:"circle",shape:{cx:i.convertToPixel("xAxis",n),cy:i.convertToPixel("yAxis",e),r:6},style:{fill:g(a),stroke:"#FFFFFF",lineWidth:1},z:15});const A=i.convertToPixel("xAxis",n),z=i.convertToPixel("yAxis",e),l=document.createElementNS("http://www.w3.org/2000/svg","svg"),p=document.createElement("div");l.setAttribute("width","71"),l.setAttribute("height","32"),l.setAttribute("viewBox","0 0 71 32"),l.setAttribute("fill","none"),l.setAttribute("xmlns","http://www.w3.org/2000/svg");const F=document.createElementNS("http://www.w3.org/2000/svg","path");F.setAttribute("d","M7 4C7 1.79086 8.79086 0 11 0H67C69.2091 0 71 1.79086 71 4V28C71 30.2091 69.2091 32 67 32H11C8.79086 32 7 30.2091 7 28V4Z"),F.setAttribute("fill",g(a));const S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("d","M1.13333 17.6C0.0666666 16.8 0.0666666 15.2 1.13333 14.4L7 10L7 22L1.13333 17.6Z"),S.setAttribute("fill",g(a)),l.appendChild(F),l.appendChild(S),l.style.position="absolute",l.style.left=`${r.left+A+10}px`,l.style.top=`${r.top+z-15}px`,l.style.zIndex="8",p.innerText=`${Number.parseFloat(e).toFixed(3)}`,p.style.position="absolute",p.style.left=`${r.left+A+28}px`,p.style.top=`${r.top+z-8}px`,p.style.font="bold 16px sans-serif",p.style.color="white",p.style.zIndex="999",p.style.fontFamily="Sen",document.body.appendChild(p),document.body.appendChild(l),i.setOption(m)}I(async()=>{s=await h.getReport(),y=s.sex,d=await h.getResilienceData(y),$=Number(s.G0yourscore),v=Number(s.G2yourscore),n=Number(s.chronologicalage),e=Number((v/$).toFixed(3));let r=d.data.filter(A=>A.y<e).length,m=d.data.length;a=Math.round(r/m*100),(a===100||a===0)&&(a=a===100?99:1),R()});function E(r){B[r?"unshift":"push"](()=>{u=r,x(0,u)})}return w.$$set=r=>{"service"in r&&x(1,h=r.service)},[u,h,E]}class N extends M{constructor(o){super(),O(this,o,Z,q,G,{service:1})}get service(){return this.$$.ctx[1]}set service(o){this.$$set({service:o}),D()}}customElements.define("ga-immune-resilience-index-scatter",W(N,{service:{}},[],[],!1));export{N as default};
|