@glycanage/web-components 1.177.0 → 1.178.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 W,S as B,i as I,f as
|
|
1
|
+
import{c as W,S as B,i as I,f as b,s as M,e as L,b as H,n as A,p as G,g as k,q as j,u as P,k as F,o as V,A as Z}from"./index2.js";import{g as q}from"./globals.js";import{a as E,i as X,f as _,h as J}from"./helpers.js";const{document:K}=q;function Q(m){let e,l,t;return{c(){e=L("div"),l=H(),t=L("link"),A(e,"width","100%"),A(e,"height","100%"),A(e,"position","relative"),G(t,"href","https://fonts.googleapis.com/css2?family=Sen:wght@400..800&display=swap"),G(t,"rel","stylesheet")},m(n,c){k(n,e,c),m[4](e),k(n,l,c),j(K.head,t)},p:P,i:P,o:P,d(n){n&&(F(e),F(l)),m[4](null),F(t)}}}function U(m,e,l){let{type:t}=e,{lang:n}=e,{service:c=window.GaReportService}=e,R=[{name:"mature",csvPerc:"G0percentile",csvScore:"G0yourscore"},{name:"youth",csvPerc:"G2percentile",csvScore:"G2yourscore"},{name:"shield",csvPerc:"Spercentile",csvScore:"Syourscore"},{name:"lifestyle",csvPerc:"Bpercentile",csvScore:"Byourscore"},{name:"median",csvPerc:"G1percentile",csvScore:"G1yourscore"}],u,$,T,f=0,p=0,s={},v="",y=0,x;const g=R.find(i=>i.name===t);function h(){if(t=="median")return X(f);if(t=="shield"||t=="youth")return _(f);if(t=="mature"||t=="lifestyle")return J(f)}function D(){x&&(s=echarts.init(x,null,{devicePixelRatio:4,renderer:"svg"}));const i=x.getBoundingClientRect();var d={textStyle:{fontFamily:"Sen, sans serif"},animation:!1,backgroundColor:"transparent",grid:{top:"34px",left:"37px",right:"44px",bottom:"28px"},dataset:[{source:$.data.map(o=>[o.x,o.y])},{source:T.data.map(o=>[o.x,o.y])}],tooltip:{show:!1},xAxis:{min:0,max:100,interval:20,name:E(n,"AGE"),nameTextStyle:{color:"#09341F",opacity:.8,fontSize:8},axisLine:{show:!0,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[8]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",fontSize:8,opacity:.8,formatter(o){return o===0||o===100?"":o}},splitLine:{show:!0}},yAxis:{min:0,max:.6,name:E(n,"INDEX_SCORE"),nameTextStyle:{color:"#09341F",opacity:.8,fontSize:8},axisLine:{show:!0,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[5]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",fontSize:8,opacity:.8,formatter(o){return o===0||o===.6?"":o}},splitLine:{show:!0}},series:[{type:"scatter",tooltip:{},itemStyle:{color:"#09341F",opacity:.1,borderWidth:1}},{name:"Rezultat",type:"scatter",data:[{x:y,y:p}],itemStyle:{color:h()}},{name:"Prosje\u010Dna populacija",type:"line",smooth:!0,datasetIndex:1,symbol:"line",lineStyle:{name:"line",type:"line",color:"#09341F",opacity:.5,symbol:"none",width:5},showSymbol:!1}],graphic:[],legend:{show:!0,right:"50%",top:"1%",left:"67%",itemGap:.2,itemWidth:10,itemHeight:6,textStyle:{color:"#09341F",opacity:.8,fontSize:8},selected:{"Measured result":!0,"Population average":!0},inactiveColor:"#fff"}};s.setOption(d),d.graphic.push({type:"line",shape:{x1:s.convertToPixel("xAxis",y),y1:s.convertToPixel("yAxis",0),x2:s.convertToPixel("xAxis",y),y2:s.convertToPixel("yAxis",p)},style:{stroke:h(),lineDash:[8,8],lineWidth:1.7},z:8}),d.graphic.push({type:"line",shape:{x1:s.convertToPixel("xAxis",0),y1:s.convertToPixel("yAxis",p),x2:s.convertToPixel("xAxis",y),y2:s.convertToPixel("yAxis",p)},style:{stroke:h(),lineDash:[8,8],lineWidth:1.7},z:8}),d.graphic.push({name:"Measured result",type:"circle",shape:{cx:s.convertToPixel("xAxis",y),cy:s.convertToPixel("yAxis",p),r:4},style:{fill:h(),stroke:"#FFFFFF",lineWidth:1},z:15});const z=s.convertToPixel("xAxis",y),C=s.convertToPixel("yAxis",p),r=document.createElementNS("http://www.w3.org/2000/svg","svg"),a=document.createElement("div");r.setAttribute("width","52"),r.setAttribute("height","18"),r.setAttribute("viewBox","0 0 71 32"),r.setAttribute("fill","none"),r.setAttribute("xmlns","http://www.w3.org/2000/svg");const w=document.createElementNS("http://www.w3.org/2000/svg","path");w.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"),w.setAttribute("fill",h());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",h()),r.appendChild(w),r.appendChild(S),r.style.position="absolute",r.style.left=`${i.left+z-90}px`,r.style.top=`${i.top+C-10}px`,r.style.zIndex="8",a.innerText=`${Number.parseFloat(p).toFixed(3)}`,a.style.position="absolute",a.style.left=`${i.left+z-74}px`,a.style.top=`${i.top+C-7}px`,a.style.font="bold 10px sans-serif",a.style.color="white",a.style.zIndex="999",a.style.fontFamily="Sen",document.body.appendChild(a),document.body.appendChild(r),s.setOption(d)}V(async()=>{u=await c.getReport(),v=u.sex,$=await c.getScatterData(t,v),T=await c.getLineData(t,v),y=Number(u.chronologicalage),g&&(f=Number(u[g.csvPerc]),p=Number(u[g.csvScore])),D()});function O(i){Z[i?"unshift":"push"](()=>{x=i,l(0,x)})}return m.$$set=i=>{"type"in i&&l(1,t=i.type),"lang"in i&&l(2,n=i.lang),"service"in i&&l(3,c=i.service)},[x,t,n,c,O]}class N extends B{constructor(e){super(),I(this,e,U,Q,M,{type:1,lang:2,service:3})}get type(){return this.$$.ctx[1]}set type(e){this.$$set({type:e}),b()}get lang(){return this.$$.ctx[2]}set lang(e){this.$$set({lang:e}),b()}get service(){return this.$$.ctx[3]}set service(e){this.$$set({service:e}),b()}}customElements.define("ga-scatter-plot-custom",W(N,{type:{},lang:{},service:{}},[],[],!1));export{N as default};
|