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

improved display of large numbers; reorganized per-site data

parent 989c05fe
Pipeline #293 passed with stage
in 1 second
......@@ -46,6 +46,11 @@ Remember this when somebody tells you again that they need Google Fonts ([nope](
### 14.12.2020
- Per-site data:
- removed "`Doubles every`" and "`Half infected in`" fields;
- added "`Deaths`" and "`Recoveries`";
- reordered the fields.
- Improved the display of numbers of cases, deaths, recoveries, both for global data, and site-specific data.
- Added `incidence` chart for cases, recoveries, and deaths.
Fixes #3.
......
......@@ -1052,12 +1052,12 @@ let selectSite = (e) => {
getSitePopulation(site)
.then((population)=>{
siteDataNode.innerHTML = `
<div><span class="label">Population:</span><span class="value">${population}</span></div>
<div><span class="label">Cases:</span><span class="value">${confirmed}</span></div>
<div><span class="label">Cases:</span><span class="value">${Number(confirmed).toLocaleString()}</span></div>
<div><span class="label">Recoveries:</span><span class="value">${Number(data[data.length-1].recovered).toLocaleString()}</span></div>
<div><span class="label">Deaths:</span><span class="value">${Number(data[data.length-1].deaths).toLocaleString()}</span></div>
<div><span class="label">Population:</span><span class="value">${Number(population).toLocaleString()}</span></div>
<div><span class="label">% infected:</span><span class="value">${Math.round((confirmed/population)*10000)/100}%</span></div>
<div><span class="label">Rate:</span><span class="value">${Math.round((data[data.length-1].ratio - 1) * 10000) / 100}%</span></div>
<div><span class="label">Doubles every:</span><span class="value">${Math.round(Math.log(2)/Math.log(data[data.length-1].ratio))} days</span></div>
<div><span class="label">Half infected in:</span><span class="value">${Math.round(Math.log(population*0.5/confirmed)/Math.log(data[data.length-1].ratio))} days</span></div>
<div class="sources"><a href="${wikiData.source_link}">source</a></div>`
theSelect.fetching = false
updateChartData(theSelect)
......@@ -2118,9 +2118,9 @@ document.addEventListener('DOMContentLoaded', (e)=>{
getCovidData()
.then((data)=>{
// update global stats
document.querySelector('#covid-stats > #confirmed > .value').innerHTML = data.confirmed
document.querySelector('#covid-stats > #deaths > .value').innerHTML = data.deaths
document.querySelector('#covid-stats > #recovered > .value').innerHTML = data.recovered
document.querySelector('#covid-stats > #confirmed > .value').innerHTML = Number(data.confirmed).toLocaleString()
document.querySelector('#covid-stats > #deaths > .value').innerHTML = Number(data.deaths).toLocaleString()
document.querySelector('#covid-stats > #recovered > .value').innerHTML = Number(data.recovered).toLocaleString()
document.querySelector('#covid-stats > #death-to-case > .value').innerHTML = "~" + Math.round(data.death_to_case * 10000) / 100 + '%'
// update the interface
......
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