Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michał Woźniak
covid
Commits
8203c255
Commit
8203c255
authored
Mar 29, 2020
by
Michał Woźniak
Browse files
fixed y-axis for per-million chart value mode
parent
15b633c4
Pipeline
#137
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
covid.js
View file @
8203c255
...
...
@@ -1125,13 +1125,24 @@ let updateChartSettings = () => {
// move the y-axis zero point depending on whether we're showing cumulative or new cases
if
(
document
.
querySelector
(
'
input[type=radio][name=chart-cases]:checked
'
).
value
===
'
cumulative
'
)
{
theChart
.
options
.
scales
.
yAxes
[
0
].
ticks
.
min
=
chart_start
if
(
document
.
querySelector
(
'
input[type=radio][name=chart-values]:checked
'
).
value
===
'
absolute
'
)
{
theChart
.
options
.
scales
.
yAxes
[
0
].
ticks
.
min
=
chart_start
}
else
{
theChart
.
options
.
scales
.
yAxes
[
0
].
ticks
.
min
=
1
}
theChart
.
options
.
scales
.
yAxes
[
0
].
scaleLabel
.
labelString
=
"
Confirmed cases, cumulative
"
}
else
{
theChart
.
options
.
scales
.
yAxes
[
0
].
ticks
.
min
=
1
theChart
.
options
.
scales
.
yAxes
[
0
].
scaleLabel
.
labelString
=
"
Confirmed cases, new
"
}
// 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
{
theChart
.
options
.
scales
.
yAxes
[
0
].
scaleLabel
.
labelString
+=
'
, per 1 million people
'
}
// update x axis label
if
(
chart_start
==
1
)
{
theChart
.
options
.
scales
.
xAxes
[
0
].
scaleLabel
.
labelString
=
"
Days since 1st confirmed case
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment