(function(){"use strict";var t={8639:function(t,a,e){var n=e(9242),r=e(3396);function o(t,a,e,n,o,i){const s=(0,r.up)("TestText"),u=(0,r.up)("LineChart");return(0,r.wg)(),(0,r.iD)(r.HY,null,[(0,r.Wm)(s,{msg:"test"}),(0,r.Wm)(u)],64)}const i={class:"container"},s={class:"box"},u={style:{width:"100%",height:"100%"}},l={class:"box"},c={style:{width:"100%",height:"100%"}},d=(0,r._)("div",{class:"box"},null,-1),h=(0,r._)("div",{class:"box"},null,-1);function p(t,a,e,n,o,p){const f=(0,r.up)("Line");return(0,r.wg)(),(0,r.iD)("div",i,[(0,r._)("div",s,[(0,r._)("div",u,[t.XyLoaded?((0,r.wg)(),(0,r.j4)(f,{key:0,id:"my-chart-id",options:t.XyChartOotions,data:t.XyChartData},null,8,["options","data"])):(0,r.kq)("",!0)])]),(0,r._)("div",l,[(0,r._)("div",c,[t.GpuLoaded?((0,r.wg)(),(0,r.j4)(f,{key:0,id:"my-chart-id",options:t.GpuChartOptions,data:t.GpuChartData},null,8,["options","data"])):(0,r.kq)("",!0)])]),d,h])}e(560);var f=e(5866),v=e(9646);v.kL.register(v.Dx,v.u,v.De,v.od,v.jn,v.uw,v.f$);var y={name:"LineChart",components:{Line:f.x1},data:()=>({XyChartData:null,GpuChartData:null,XyLoaded:!1,GpuLoaded:!1,intervals:[],XyChartOotions:{responsive:!0,beginAtZero:!0},GpuChartOptions:{scales:{y:{beginAtZero:!0}},responsive:!0,beginAtZero:!0},XyDataOptions:{label:"XY chart",labelsKey:"x_value",dataKey:"y_value",borderColor:"rgb(97, 193, 190)",maxDataPoints:30},GpuDataOptions:{label:"GPU chart",labelsKey:"hms_time",dataKey:"utilz_gpu",borderColor:"rgb(231, 213, 232)",maxDataPoints:30}}),methods:{async fetchLatestData(t,a,e,n){try{const r=await fetch(t);let o=await r.json();this.updateChartData(o,a,n),this[e]=!0}catch(r){console.log(r)}},updateChartData(t,a,e){const n=e.maxDataPoints;t.length>n&&(t=this.downsampleData(t,n)),this[a]={labels:t.map((t=>t[e.labelsKey])),datasets:[{label:e.label,data:t.map((t=>t[e.dataKey])),borderColor:e.borderColor}]}},downsampleData(t,a){const e=Math.ceil(t.length/a);return t.filter(((t,a)=>a%e==0))}},async mounted(){console.log("mounted"),this.loaded=!1,this.fetchLatestData("/api/v1/xy_graph/","XyChartData","XyLoaded",this.XyDataOptions),this.fetchLatestData("/api/v1/gpu/","GpuChartData","GpuLoaded",this.GpuDataOptions),this.intervals.push(setInterval((()=>this.fetchLatestData("/api/v1/xy_graph/","XyChartData","XyLoaded",this.XyDataOptions)),5e3)),this.intervals.push(setInterval((()=>this.fetchLatestData("/api/v1/gpu/","GpuChartData","GpuLoaded",this.GpuDataOptions)),5e3))},unmounted(){this.intervals.forEach(clearInterval)}},b=e(89);const D=(0,b.Z)(y,[["render",p]]);var g=D;const m=t=>((0,r.dD)("data-v-23274ff4"),t=t(),(0,r.Cn)(),t),C={class:"navbar"},O=m((()=>(0,r._)("div",{class:"navbar-title"},"qdvis",-1))),w=[O];var x={__name:"TestText",setup(t){return(t,a)=>((0,r.wg)(),(0,r.iD)("nav",C,w))}};const L=(0,b.Z)(x,[["__scopeId","data-v-23274ff4"]]);var _=L,G={name:"App",components:{LineChart:g,TestText:_}};const X=(0,b.Z)(G,[["render",o]]);var j=X;(0,n.ri)(j).mount("#app")}},a={};function e(n){var r=a[n];if(void 0!==r)return r.exports;var o=a[n]={exports:{}};return t[n].call(o.exports,o,o.exports,e),o.exports}e.m=t,function(){var t=[];e.O=function(a,n,r,o){if(!n){var i=1/0;for(c=0;c<t.length;c++){n=t[c][0],r=t[c][1],o=t[c][2];for(var s=!0,u=0;u<n.length;u++)(!1&o||i>=o)&&Object.keys(e.O).every((function(t){return e.O[t](n[u])}))?n.splice(u--,1):(s=!1,o<i&&(i=o));if(s){t.splice(c--,1);var l=r();void 0!==l&&(a=l)}}return a}o=o||0;for(var c=t.length;c>0&&t[c-1][2]>o;c--)t[c]=t[c-1];t[c]=[n,r,o]}}(),function(){e.n=function(t){var a=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(a,{a:a}),a}}(),function(){e.d=function(t,a){for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})}}(),function(){e.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){e.o=function(t,a){return Object.prototype.hasOwnProperty.call(t,a)}}(),function(){var t={143:0};e.O.j=function(a){return 0===t[a]};var a=function(a,n){var r,o,i=n[0],s=n[1],u=n[2],l=0;if(i.some((function(a){return 0!==t[a]}))){for(r in s)e.o(s,r)&&(e.m[r]=s[r]);if(u)var c=u(e)}for(a&&a(n);l<i.length;l++)o=i[l],e.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return e.O(c)},n=self["webpackChunkfrontend"]=self["webpackChunkfrontend"]||[];n.forEach(a.bind(null,0)),n.push=a.bind(null,n.push.bind(n))}();var n=e.O(void 0,[998],(function(){return e(8639)}));n=e.O(n)})();
//# sourceMappingURL=app.25031460.js.map