-
Notifications
You must be signed in to change notification settings - Fork 1
/
40-7691ecfef11f25d88a19.js
1 lines (1 loc) · 7.48 KB
/
40-7691ecfef11f25d88a19.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[40],{"3rfK":function(t,e,r){"use strict";r.r(e);var a=r("q1tI"),n=r.n(a),o=r("9Koi"),i=r("Wbzz"),s=r("hob0"),c=r("ofer");e.default=function(t){var e=Object(i.useStaticQuery)("3619097740"),r=Object(o.a)().t,a=function(){var t=e.dailyFigures.edges.find((function(t){return t.node.bed_number})).node;return{date:t.date,bedCount:Number(t.bed_number),bedPercent:t.bed_percent,roomCount:Number(t.room_number),roomPercent:t.room_percent}},l=r("isolation_beds.helmet",{date:a().date,bedPercent:a().bedPercent,roomCount:a().roomCount,roomPercent:a().roomPercent});return n.a.createElement(n.a.Fragment,null,n.a.createElement(c.a,{variant:"body2"},"*",l),n.a.createElement(s.a,{data:{showLegend:!1,xaxis:e.dailyFigures.edges.map((function(t){return t.node.date})).reverse(),fields:["hospitalised"],horizontalLines:[{color:"#ff574f","stroke-dasharray":"5, 2",legend:r("cases.isolation_bed",{bedCount:a().bedCount}),value:a().bedCount}],datasets:[{line:{legend:r("cases.status_hospitalised"),color:"#ff574f"},data:e.dailyFigures.edges.map((function(t,r){return function(t,r){var a=t.node,n=Object.assign({},a);return Object.keys(n).forEach((function(t){isNaN(parseInt(n[t],0))||(n[t]=parseInt(n[t],0))})),Object.assign({},n,{hospitalised:n.confirmed-n.death-n.discharged-(0===r&&e.pendingAdmission.totalCount||0)})}(t,r)})).reverse()}]}}))}},hob0:function(t,e,r){"use strict";var a=r("q1tI"),n=r.n(a),o=r("VphZ"),i=r("w1NJ"),s=r.n(i),c=r("osgK"),l=r.n(c),u=function(t){return Math.max(2*t/3,300)};e.a=function(t){var e=Object(a.useState)({width:0,height:0}),r=e[0],i=e[1],c=Object(a.useRef)(null),f=function(t,e){if(0!==r.width){var a=20,n=10,i=50,f=35,d=r.width-f-n,p=u(r.width)-a-i,h=d<500?7:3,y=1.1*Math.max(s()(t.datasets.map((function(e){return s()(e.data.map((function(e){return s()(Object.keys(e).filter((function(e){return t.fields.indexOf(e)>=0})).map((function(t){return e[t]})))})))}))),s()(t.horizontalLines.map((function(t){return t.value})))),m=o.select(c.current).attr("width",d+f+n).attr("height",p+a+i);m.selectAll("g").remove();var g=m.append("g").attr("transform","translate("+f+", "+a+")"),b=o.scaleLinear().range([p,0]).domain([0,y]),x=o.scalePoint().range([0,d]).domain(l()(t.xaxis.length));g.append("g").call(o.axisLeft(b)),g.append("g").attr("transform","translate(0, "+p+")").call(o.axisBottom(x).tickValues(x.domain().filter((function(t,e){return e%h==0}))).tickFormat((function(e,r){return t.xaxis[r*h]}))).selectAll("text").attr("transform","rotate(-45)translate(0,0)").style("text-anchor","end").style("fill","#69a3b2"),g.append("g").style("color","lightgrey").style("stroke-opacity","0.7").call(o.axisLeft(b).tickSizeOuter(0).tickSizeInner(-d).tickFormat("")),t.horizontalLines.forEach((function(t,e){m.append("line").attr("x1",f).attr("y1",a+b(t.value)).attr("x2",f+d).attr("y2",a+b(t.value)).style("stroke",t.color).attr("stroke-dasharray",t["stroke-dasharray"]),m.append("text").attr("width",100).attr("x",f+d).attr("y",a+b(t.value)-4).style("text-anchor","end").attr("fill",t.color).text(t.legend)}));var v=o.line().x((function(t,e){return x(e)})).y((function(t){return b(t)}));if(t.datasets.forEach((function(e,r){return n=e.data.map((function(e){return Object.keys(e).filter((function(e){return t.fields.indexOf(e)===r})).map((function(t){return e[t]}))})),o=e.line,i=n.filter((function(t){return null!==t})),s=1500+2e3*Math.random(),m.append("path").attr("transform","translate("+f+", "+a+")").datum(i).attr("fill","none").attr("stroke",o.color).attr("stroke-width",1.5).attr("opacity",o.opactiy||1).attr("stroke-dashoffset",2*d).attr("stroke-dasharray",[2*d,2*d]).attr("d",v).transition().duration(s).attr("stroke-dashoffset",0).transition().duration(0).attr("stroke-dasharray",o["stroke-dasharray"]),void m.append("g").selectAll(".dot").data(i).enter().append("circle").attr("fill",o.color).attr("class","dot").attr("transform","translate("+f+", "+a+")").attr("cx",(function(t,e){return x(e)})).attr("cy",(function(t){return b(t)})).attr("r",2).attr("opacity",0).transition().delay(s-500).duration(2e3).attr("opacity",o.opactiy||1);var n,o,i,s})),t.showLegend){var k=m.selectAll(".legend").data(t.datasets).enter().append("g").attr("class","legend").attr("transform",(function(t,e){return"translate("+(f+20)+", "+(a+24*e)+")"}));k.append("rect").attr("width",14).attr("height",14).style("fill",(function(t,e){return t.line.color})),k.append("text").attr("x",16).attr("y",7).attr("dy",".35em").style("text-anchor","start").style("fill",(function(t,e){return t.line.color})).text((function(t){return t.line.legend}))}var w=m.append("g").attr("display","none").attr("class","tooltip");w.append("rect").attr("fill","#fff").attr("stroke","#000").attr("width",100).attr("height",50).attr("x",0).attr("y",0).attr("rx",4).attr("ry",4),w.append("text").attr("class","title").attr("width",100).attr("height",35).attr("dy",".35em").attr("font-size",14).attr("x",4).attr("y",12).text("date"),w.selectAll(".legend").data(t.datasets).enter().append("text").attr("class","figures").attr("width",100).attr("height",35).attr("dy",".35em").attr("font-size",12).style("text-anchor","start");var j=m.append("line"),O=m.append("rect").attr("width",d).attr("height",p).attr("x",f).attr("y",a).attr("opacity",0).on("mousemove",E).on("mouseout",(function(){w&&w.attr("display","none");j&&j.attr("stroke","none")})).on("mouseclick",E)}function E(){var e=x.step(),r=o.mouse(O.node());r[0]-=f,r[1]-=a;var n=Math.max(Math.round(r[0]/e),0);j.attr("stroke","black").attr("stroke-dasharray","5, 2").attr("x1",f+x(n)).attr("x2",f+x(n)).attr("y1",a+0).attr("y2",a+p);var i=f+x(n)+20;i=i>d-100?i-100-40:i,w.attr("display","block").attr("transform","translate("+i+", "+Math.min(p-100,a+r[1]-20)+")").selectAll(".figures").attr("x",4).attr("y",(function(t,e){return 35+16*e})).attr("fill",(function(t){return t.line.color})).text((function(e,r){return e.line.legend+": "+e.data[n][t.fields[r]]})),w.select(".title").text(t.xaxis[n])}};return Object(a.useEffect)((function(){f(t.data,t.labels)})),Object(a.useLayoutEffect)((function(){c.current&&i({width:c.current.clientWidth})}),[]),n.a.createElement(n.a.Fragment,null,n.a.createElement("svg",{ref:c,style:{height:u(r.width),width:"100%"}}))}},osgK:function(t,e){var r=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,o=/^0o[0-7]+$/i,i=parseInt;var s=Object.prototype.toString,c=Math.min;function l(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function u(t){return t?(t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(l(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=l(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(r,"");var c=n.test(t);return c||o.test(t)?i(t.slice(2),c?2:8):a.test(t)?NaN:+t}(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function f(t){return t}t.exports=function(t,e){if((t=function(t){var e=u(t),r=e%1;return e==e?r?e-r:e:0}(t))<1||t>9007199254740991)return[];var r=4294967295,a=c(t,4294967295);t-=4294967295;for(var n=function(t,e){for(var r=-1,a=Array(t);++r<t;)a[r]=e(r);return a}(a,e="function"==typeof e?e:f);++r<t;)e(r);return n}},w1NJ:function(t,e){var r=Object.prototype.toString;function a(t,e){return t>e}function n(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==r.call(t)}function o(t){return t}t.exports=function(t){return t&&t.length?function(t,e,r){for(var a=-1,o=t.length;++a<o;){var i=t[a],s=e(i);if(null!=s&&(void 0===c?s==s&&!n(s):r(s,c)))var c=s,l=i}return l}(t,o,a):void 0}}}]);