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
970ad5de
Commit
970ad5de
authored
Mar 25, 2020
by
Michał Woźniak
Browse files
The Czech Republic, eh! also, UTF-8 charset now
parent
38932c6d
Pipeline
#104
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
covid.js
View file @
970ad5de
...
...
@@ -58,6 +58,8 @@ let getSiteCases = (site) => {
// snowflake templates are snowflake
if
(
site
===
"
China
"
)
{
site
=
"
Mainland China
"
}
else
if
(
site
===
"
Czech Republic
"
)
{
site
=
"
The Czech Republic
"
}
console
.
log
(
`+-- fetching covid data for:
${
site
}
`
)
return
wtf
...
...
@@ -250,6 +252,7 @@ let selectSite = (e) => {
var
theChart
=
false
;
let
chart
=
()
=>
{
var
context
=
document
.
getElementById
(
'
the-chart
'
).
getContext
(
'
2d
'
);
var
graph_width
=
45
;
Chart
.
defaults
.
global
.
defaultFontColor
=
'
#bbb
'
;
Chart
.
defaults
.
global
.
defaultFontFamily
=
'
Play Regular
'
;
theChart
=
new
Chart
(
context
,
{
...
...
@@ -257,27 +260,27 @@ let chart = () => {
data
:
{
datasets
:
[
/*{
label: 'Doubles every day',
data: genArr(
45
, (i, arr)=>{ return arr[i-1]*2 }),
data: genArr(
graph_width
, (i, arr)=>{ return arr[i-1]*2 }),
backgroundColor: 'rgba(127, 64, 64, 0.1)',
borderColor: 'rgba(127, 64, 64, 0.1)',
pointRadius: 0,
borderWidth: 1
}, */
{
label
:
'
Doubles every 2 days
'
,
data
:
genArr
(
45
,
(
i
,
arr
)
=>
{
return
arr
[
i
-
1
]
*
Math
.
pow
(
2
,
1
/
2
)
}),
data
:
genArr
(
graph_width
,
(
i
,
arr
)
=>
{
return
arr
[
i
-
1
]
*
Math
.
pow
(
2
,
1
/
2
)
}),
backgroundColor
:
'
rgba(192, 192, 127, 0.1)
'
,
borderColor
:
'
rgba(192, 192, 127, 0.1)
'
,
pointRadius
:
0
,
borderWidth
:
1
},
{
label
:
'
Doubles every 7 days
'
,
data
:
genArr
(
45
,
(
i
,
arr
)
=>
{
return
arr
[
i
-
1
]
*
Math
.
pow
(
2
,
1
/
7
)
}),
data
:
genArr
(
graph_width
,
(
i
,
arr
)
=>
{
return
arr
[
i
-
1
]
*
Math
.
pow
(
2
,
1
/
7
)
}),
backgroundColor
:
'
rgba(192, 255, 192, 0.1)
'
,
borderColor
:
'
rgba(192, 255, 192, 0.1)
'
,
pointRadius
:
0
,
borderWidth
:
1
}],
labels
:
genArr
(
45
,
1
)
labels
:
genArr
(
graph_width
,
1
)
},
options
:
{
responsive
:
true
,
...
...
index.html
View file @
970ad5de
<html>
<head>
<meta
charset=
"utf-8"
/>
<script
src=
"./wtf_wikipedia-client.min.js"
></script>
<script
src=
"./Chart.bundle.min.js"
></script>
<script
src=
"./covid.js"
></script>
...
...
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