about summary refs log tree commit diff
path: root/covid-uk/src/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'covid-uk/src/index.html')
-rw-r--r--covid-uk/src/index.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/covid-uk/src/index.html b/covid-uk/src/index.html
new file mode 100644
index 000000000000..5b2c0705b0a0
--- /dev/null
+++ b/covid-uk/src/index.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Covid UK</title>
+</head>
+<body>
+  <canvas id="myChart" width="400" height="400"></canvas>
+  <script src="./node_modules/chart.js/dist/Chart.bundle.min.js"></script>
+  <script>
+   var timeseries =
+     fetch('./timeseries.json')
+       .then(res => res.json())
+       .then(createChart);
+
+   function createChart(data) {
+     var uk = data["United Kingdom"];
+     var data = uk.map(x => x["confirmed"])
+     var labels = uk.map(x => x["date"])
+
+     var ctx = document.getElementById('myChart').getContext('2d');
+     var myChart = new Chart(ctx, {
+       type: 'line',
+       data: {
+         labels: labels,
+         datasets: [{
+           label: 'Number of confirmed COVID-19 cases in the U.K.',
+           data: data,
+           backgroundColor: 'rgba(255, 0, 100, 0.2)',
+           borderWidth: 3
+         }]
+       },
+       options: {
+         scales: {
+           yAxes: [{
+             ticks: {
+               beginAtZero: true
+             }
+           }]
+         }
+       }
+     });
+   }
+  </script>
+</body>
+</html>