Commit b6709f95 authored by Michał Woźniak's avatar Michał Woźniak
Browse files

highest cfr button

parent a4b9499d
Pipeline #205 passed with stage
in 1 second
......@@ -1802,6 +1802,28 @@ document.addEventListener('DOMContentLoaded', (e)=>{
}
// return new_active comparison
return adata[adata.length-1].new_active - bdata[bdata.length-1].new_active;
},
"site-menu-button-highest-cfr": (a, b)=>{
// make the formulas easier on the eyes
var adata = siteData[a].data
var bdata = siteData[b].data
// we can assume active is there if new_active is, right?.. right?..
if (! ("cfr" in adata[adata.length - 1]) ) {
if ( (adata[adata.length - 1].recovered + adata[adata.length - 1].deaths) === 0) {
adata[adata.length - 1].cfr = 0
} else {
adata[adata.length - 1].cfr = adata[adata.length - 1].deaths / (adata[adata.length - 1].recovered + adata[adata.length - 1].deaths)
}
}
if (! ("cfr" in bdata[bdata.length - 1]) ) {
if ( (bdata[bdata.length - 1].recovered + bdata[bdata.length - 1].deaths) === 0) {
bdata[bdata.length - 1].cfr = 0
} else {
bdata[bdata.length - 1].cfr = bdata[bdata.length - 1].deaths / (bdata[bdata.length - 1].recovered + bdata[bdata.length - 1].deaths)
}
}
// return new_active comparison
return bdata[bdata.length-1].cfr - adata[adata.length-1].cfr;
}
}
......@@ -1845,6 +1867,12 @@ document.addEventListener('DOMContentLoaded', (e)=>{
document.getElementById('chart-cases-new').checked = true
document.getElementById('chart-values-absolute').checked = true
document.getElementById('chart-type-linear').checked = true
},
"site-menu-button-highest-cfr": ()=>{
document.getElementById('chart-data-cfr').checked = true
document.getElementById('chart-cases-cumulative').checked = true
document.getElementById('chart-values-absolute').checked = true
document.getElementById('chart-type-linear').checked = true
}
}
......
......@@ -470,6 +470,7 @@
<input type="button" id="site-menu-button-death-to-case" value="highest death-to-case ratio"/>
<input type="button" id="site-menu-button-recovered" value="most recoveries"/>
<input type="button" id="site-menu-button-active-drop" value="greatest daily drop of number of active cases"/>
<input type="button" id="site-menu-button-highest-cfr" value="highest case fatality rate"/>
</div>
</div>
<div id="sites-data-container">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment