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

fixing per-million for cfr

parent 99b98ed4
Pipeline #204 passed with stage
in 2 seconds
......@@ -1520,6 +1520,9 @@ let updateChartSettings = () => {
theChart.options.title.text.push(`${chart_dataset} COVID-19 cases`)
} else if (chart_dataset === 'recovered') {
theChart.options.title.text.push(`COVID-19 recoveries`)
} else if (chart_dataset === 'cfr') {
theChart.options.scales.yAxes[0].scaleLabel.labelString = "Case fatality rate"
theChart.options.title.text.push(`COVID-19 case fatality rate`)
} else {
theChart.options.title.text.push(`COVID-19 ${chart_dataset}`)
}
......@@ -1531,19 +1534,23 @@ let updateChartSettings = () => {
} else {
theChart.options.scales.yAxes[0].ticks.min = 0
}
theChart.options.scales.yAxes[0].scaleLabel.labelString += ", cumulative"
// showing new confirmed cases / recoveries / deaths / active cases
// showing new confirmed cases / recoveries / deaths / active cases / cfr
// notice: *new active cases* can be *negative!*
} else {
theChart.options.scales.yAxes[0].ticks.min = Math.round((min_cases * chart_type_factor) * 1000) / 1000
theChart.options.scales.yAxes[0].scaleLabel.labelString += ", new"
theChart.options.title.text[0] = `new ${theChart.options.title.text[0]}`
// for confirmed, recoveries, deaths -- we're talking "new"
if ( (chart_dataset === 'confirmed') || (chart_dataset === 'recovered') || (chart_dataset === 'deaths') ) {
theChart.options.scales.yAxes[0].scaleLabel.labelString += ", new"
theChart.options.title.text[0] = `new ${theChart.options.title.text[0]}`
} else {
theChart.options.scales.yAxes[0].scaleLabel.labelString += ", daily change"
theChart.options.title.text[0] = `change in ${theChart.options.title.text[0]}`
}
}
// amend the y-axis label
if (document.querySelector('input[type=radio][name=chart-values]:checked').value === 'absolute') {
theChart.options.scales.yAxes[0].scaleLabel.labelString += ', absolute'
} else {
if ( (chart_dataset != 'cfr') && (document.querySelector('input[type=radio][name=chart-values]:checked').value !== 'absolute') ) {
theChart.options.scales.yAxes[0].scaleLabel.labelString += ', per 1 million people'
theChart.options.title.text.push('per 1 million people')
}
......@@ -1552,12 +1559,12 @@ let updateChartSettings = () => {
if (chart_start_setting === "date") {
theChart.options.scales.xAxes[0].scaleLabel.labelString = "Date"
} else if (chart_start == 1) {
if (document.querySelector('input[type=radio][name=chart-values]:checked').value === 'per-million') {
if ( (chart_dataset != 'cfr') && (document.querySelector('input[type=radio][name=chart-values]:checked').value === 'per-million')) {
theChart.options.scales.xAxes[0].scaleLabel.labelString = "Days since one confirmed case per million people"
} else {
theChart.options.scales.xAxes[0].scaleLabel.labelString = "Days since 1st confirmed case"
}
} else if (document.querySelector('input[type=radio][name=chart-values]:checked').value === 'per-million') {
} else if ( (chart_dataset != 'cfr') && (document.querySelector('input[type=radio][name=chart-values]:checked').value === 'per-million') ) {
theChart.options.scales.xAxes[0].scaleLabel.labelString = `Days since ${chart_start} confirmed cases per million people`
} else {
theChart.options.scales.xAxes[0].scaleLabel.labelString = `Days since ${chart_start}th confirmed case`
......
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