From 6184b31fda8df5e0fe348f4ed0b93a02220f99cc Mon Sep 17 00:00:00 2001 From: tmont Date: Mon, 20 Jul 2020 22:01:13 -0700 Subject: [PATCH] removed doubling and growth rates --- tmpl/master.pug | 49 ++++--------------------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/tmpl/master.pug b/tmpl/master.pug index 311612c..54310f2 100644 --- a/tmpl/master.pug +++ b/tmpl/master.pug @@ -255,10 +255,8 @@ html totalDeaths, newDeaths, rollingAverage, - doubling, totalCases, newCases, - doublingCases, ) { const canvas = document.getElementById(id); charts.heroMaxValue = totalCases.reduce((max, value) => Math.max(max, value), 0); @@ -270,8 +268,6 @@ html const totalData = totalDeaths.slice(start, end); const newData = newDeaths.slice(start, end); const rollingData = rollingAverage.slice(start, end); - const deathDoublingData = doubling.slice(start, end); - const caseDoublingData = doublingCases.slice(start, end); const totalCaseData = totalCases.slice(start, end); const newCaseData = newCases.slice(start, end); @@ -327,26 +323,6 @@ html backgroundColor: 'rgb(20,24,59, 0.15)', borderWidth: 1, }, - { - label: 'Days to 2x deaths', - data: deathDoublingData, - fill: false, - borderColor: 'rgba(127,30,75,0.5)', - backgroundColor: 'rgb(127,30,75, 0.5)', - borderWidth: 2, - pointRadius: 0, - borderDash: [ 4, 4 ], - }, - { - label: 'Days to 2x cases', - data: caseDoublingData, - fill: false, - borderColor: 'rgba(87,86,38,0.5)', - backgroundColor: 'rgb(87,86,38, 0.5)', - borderWidth: 2, - pointRadius: 0, - borderDash: [ 4, 4 ], - }, ], }, options: { @@ -395,11 +371,6 @@ html setData('cases-new', 1); setData('deaths-total', 2); setData('deaths-new', 4, 3); - - const daysToDoubleDeaths = getDataPoint(5) ? Number(getDataPoint(5).value).toLocaleString() : 'n/a'; - const daysToDoubleCases = getDataPoint(6) ? Number(getDataPoint(6).value).toLocaleString() : 'n/a'; - tooltipEl.querySelector('.tooltip-2x-deaths').textContent = daysToDoubleDeaths + ' days'; - tooltipEl.querySelector('.tooltip-2x-cases').textContent = daysToDoubleCases + ' days'; } const position = this._chart.canvas.getBoundingClientRect(); @@ -482,8 +453,6 @@ html div.mx-auto.position-relative(style="max-width: 1024px; z-index: 1") canvas.mx-auto(id="main-chart" width="1024" height="576") - - const deathGrowthRate = '+' + (data.deathGrowthRate * 100).toFixed(2) + '%'; - const caseGrowthRate = '+' + (data.caseGrowthRate * 100).toFixed(2) + '%'; const population = 'pop. ' + data.population.toLocaleString(); const deathsPerMillion = Math.round(data.deathsPerMillion).toLocaleString() + '/1M'; const casesPerMillion = Math.round(data.casesPerMillion).toLocaleString() + '/1M'; @@ -491,8 +460,8 @@ html const totalCases = data.cases.total.toLocaleString(); const heroTitle = [ `Covid-19: ${data.name} (${population})`, - `${totalCases} cases (${casesPerMillion}, ${caseGrowthRate})`, - `${totalDeaths} deaths (${deathsPerMillion}, ${deathGrowthRate})`, + `${totalCases} cases (${casesPerMillion})`, + `${totalDeaths} deaths (${deathsPerMillion})`, ]; script. makeHeroChart( @@ -502,10 +471,8 @@ html !{JSON.stringify(data.timeSeriesDaily.map(x => x.value))}, !{JSON.stringify(data.timeSeriesDaily.map(x => x.delta))}, !{JSON.stringify(data.rollingAverageDaily.map(x => x.delta))}, - !{JSON.stringify(data.doublingDaily.map(x => x.value))}, !{JSON.stringify(data.cases.timeSeriesDaily.map(x => x.value))}, !{JSON.stringify(data.cases.timeSeriesDaily.map(x => x.delta))}, - !{JSON.stringify(data.cases.doublingDaily.map(x => x.value))}, ); mixin dataTable(items, label, type) @@ -514,8 +481,8 @@ html div#table: table.table.table-sm.table-hover thead: tr th.text-center.font-weight-bold.geo-bg-dark(colspan=(hasPopulation ? 3 : 2)) Geography - th.text-center.font-weight-bold.cases-bg-dark(colspan=(hasPopulation ? 7 : 5)) Cases - th.text-center.font-weight-bold.deaths-bg-dark(colspan=(hasPopulation ? 7 : 5)) Deaths + th.text-center.font-weight-bold.cases-bg-dark(colspan=(hasPopulation ? 6 : 4)) Cases + th.text-center.font-weight-bold.deaths-bg-dark(colspan=(hasPopulation ? 6 : 4)) Deaths th.text-center.font-weight-bold.other-bg-dark(colspan="2") Other thead.headers: tr th.geo-bg # @@ -532,7 +499,6 @@ html if hasPopulation th.cases-bg(data-col="cases-last14-million") +sortableLinks("cases-last14-million"): abbr(title="Last 14 days per million residents") L14/1M - th.cases-bg(data-col="cases-growth"): +sortableLinks("cases-growth") Growth if hasPopulation th.deaths-bg(data-col="million"): +sortableLinks("million") per 1M @@ -543,7 +509,6 @@ html if hasPopulation th.deaths-bg(data-col="last14-million") +sortableLinks("last14-million"): abbr(title="Last 14 days per million residents") L14/1M - th.deaths-bg(data-col="growth"): +sortableLinks("growth") Growth th.other-bg(data-col="cfr"): +sortableLinks("cfr") acronym(title="Case Fatality Rate") CFR @@ -611,7 +576,6 @@ html td.text-right: code: +formatNumber(casesLast14) if hasPopulation td.text-right: code: +formatNumber(Math.round(casesLast14Avg)) - td.text-right: code= Number(item.caseGrowthRate * 100).toFixed(2) + '%' if hasPopulation td.text-right: code: +formatNumber(Math.round(item.deathsPerMillion)) td.text-right: code: +formatNumber(item.total) @@ -620,7 +584,6 @@ html td.text-right: code: +formatNumber(last14) if hasPopulation td.text-right: code: +formatNumber(Math.round(last14Avg)) - td.text-right: code= Number(item.deathGrowthRate * 100).toFixed(2) + '%' td.text-right: code= Number(item.caseFatalityRate * 100).toFixed(2) + '%' td canvas.mx-auto(id="sparkline-" + i width="100" height="35") @@ -667,10 +630,6 @@ html td: span.tooltip-color-deaths-new th New Deaths td.tooltip-value-deaths-new - div.text-center.pt-1.tooltip-bordered - | Cases 2x every #[strong.tooltip-2x-cases] - br - | Deaths 2x every #[strong.tooltip-2x-deaths] script. (function() {