1import{_ as z}from"./_plugin-vue_export-helper.DlAUqK2U.js";import{z as f,y as E,A as M,a1 as A,ab as S,C as g,D as B,I as W,W as O,P as V,Z as $,J as v,am as P}from"./runtime-dom.esm-bundler.D8YrsGpd.js";const R=["onMouseover","onMouseout","innerHTML"],H={__name:"chart",props:{chartData:Array,chartType:String,yAxisLabel:String},setup(u){const y=f(null),m=f(null),F=f(null),s=f([]),a=u,w=E({sum:0}),p=["#112c45","#3a3c65","#6e477b","#a64f81","#d85c78","#fb7762","#ff9e47","#ffcd32"],L=["#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#000000","#000000"];let n=null,d=null,r=null,h=null;const l={chartArea:{height:"80%",width:"80%"},pieSliceText:"none",legend:"none",enableInteractivity:!1,pieSliceBorderColor:"none",colors:p,backgroundColor:"transparent",tooltip:{trigger:"none"},annotations:{alwaysOutside:!0,textStyle:{bold:!0,color:"#000000"},stem:{color:"transparent"}},vAxis:{title:a.yAxisLabel,viewWindow:{max:1.3*a.chartData.reduce((e,t)=>e>t.value?e:t.value,a.chartData[0].value)}},hAxis:{showTextEvery:1}};M(async()=>{if(a.chartType==="pieChart"?(document.addEventListener("click",b),w.sum=a.chartData.reduce((e,t)=>e+t.value,0)):window.addEventListener("resize",I(()=>{n.draw(h,l)})),google.charts.load("current",{packages:["corechart"]}),google.charts.setOnLoadCallback(T),await A(),F.value){let e=0;s.value.forEach(t=>{e<t.offsetWidth&&(e=t.offsetWidth)}),F.value.style.setProperty("--legendItemWidth",e+"px")}}),S(()=>{a.chartType==="pieChart"&&document.removeEventListener("click",b)});function T(){r=new google.visualization.DataTable,r.addColumn("string","label"),r.addColumn("number","value"),a.chartType==="barChart"&&(r.addColumn({role:"style"},"color"),a.chartData.forEach((e,t)=>{r.addRow([e.label,e.value,p[t]])}),h=new google.visualization.DataView(r),h.setColumns([0,1,2,{calc:"stringify",sourceColumn:1,type:"string",role:"annotation"}]),n=new google.visualization.ColumnChart(m.value),n.draw(h,l)),a.chartType==="pieChart"&&(a.chartData.forEach(e=>{r.addRow([e.label,e.value])}),n=new google.visualization.PieChart(m.value),google.visualization.events.addListener(n,"onmouseover",_),google.visualization.events.addListener(n,"onmouseout",C),n.draw(r,l))}function _(e){e.row!==d&&(s.value.forEach(o=>o.classList.remove("chart__legendItem--active")),d=e.row,s.value[d].classList.add("chart__legendItem--active"),l.slices={[e.row]:{offset:.07}},n.draw(r,l))}function C(){d=null,s.value.forEach(e=>e.classList.remove("chart__legendItem--active")),l.slices={},n.draw(r,l)}function x(e){_({row:e})}function k(e){C()}function b(e){y.value.contains(e.target)||C()}function I(e){let t;return function(o){t&&clearTimeout(t),t=setTimeout(e,10,o)}}function D(e,t,o){const c=Math.round(100*t/o);let i=e;return c!==t&&(i+=`: ${t}`),i+=` (${c}%)`,i}return(e,t)=>(v(),g("div",{class:"chart",ref_key:"parentComponent",ref:y},[B("div",{ref_key:"googleChart",ref:m,class:O(["chart__chart","chart__chart--"+u.chartType]),id:"chart"},null,2),u.chartType==="pieChart"?(v(),g("div",{key:0,class:"chart__legend",ref_key:"legend",ref:F,id:"chartData"},[(v(!0),g(V,null,$(u.chartData,(o,c)=>(v(),g("div",{class:"chart__legendItem",key:o.label,ref_for:!0,ref_key:"legendItems",ref:s,onMouseover:i=>x(c),onMouseout:i=>k(),style:P({"--labelColor":p[c],"--textColor":L[c]}),innerHTML:D(o.label,o.value,w.sum)},null,44,R))),128))],512)):W("",!0)],512))}},U=z(H,[["__scopeId","data-v-bf5a0f88"]]);export{U as default}; 2//# sourceMappingURL=chart.B9jyDuJr.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.