-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeaths_weekly.html
123 lines (120 loc) · 4.56 KB
/
deaths_weekly.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script src="./chart.min.js"></script>
<div class="chart-container" style="width: 90vw; height:80vh; margin-left: auto; margin-right: auto;">
<canvas id="myChart"></canvas>
</div>
<script>
var ctx = document.getElementById('myChart');
// Data from 'https://infostat.nsi.bg/infostat/pages/reports/query.jsf?x_2=1818'
const deaths_raw = {
"2015":[2501,2512,2419,2339,2335,2295,2341,2535,2561,2469,2438,2362,2374,2265,2265,2242,2135,2161,2106,1981,1984,1837,1969,1980,1904,1838,1825,2028,1900,2101,2138,1999,1939,1784,1838,1975,1727,1886,1728,1832,1930,2012,2065,2188,2092,2221,2116,2027,2008,2127,2178,2158,2149],
"2016":[2441,2283,2280,2367,2303,2222,2103,2093,1957,2091,2096,2025,2100,2125,1925,1944,1968,2031,2054,1990,2010,1992,1782,2012,2143,1959,1806,1966,1826,1901,1971,1806,1804,1865,1759,1756,1819,1806,1862,2023,2109,2111,2135,2078,2141,2129,2096,2148,2299,2277,2435,2807],
"2017":[3174,3220,2817,2627,2526,2349,2357,2310,2141,2233,2117,2118,2100,2084,2028,2118,2035,1956,1985,1977,1985,2054,1960,1917,1957,2294,2010,1923,1797,1916,1946,2062,1772,1763,1805,1766,1944,1701,1710,1934,1958,2067,2061,2063,2014,2112,2072,2062,2021,2109,2041,2252],
"2018":[2274,2166,2374,2362,2564,2454,2381,2235,2468,2384,2238,2162,2060,2076,2062,1992,2073,1936,1887,1920,1895,1918,1952,1771,1777,1795,1896,1966,1975,1977,1904,1909,1860,1825,1826,1845,1844,1886,1889,2067,2040,2134,2094,2065,2074,2137,2163,2212,2319,2343,2345,2434],
"2019":[2530,2694,2754,2849,2574,2245,2300,2263,2273,2167,2123,2150,2080,2112,2092,2035,2051,1981,2120,1980,2001,1967,1931,1992,2027,1910,1953,1820,1867,1961,1856,1896,1920,1934,1861,1737,1751,1789,1827,1888,1888,1970,1911,2040,2194,2027,1954,2076,2126,2112,2136,2120],
"2020":[2111,2279,2185,2393,2439,2350,2310,2161,2183,2049,2075,2044,2082,2041,2030,2024,1981,1891,1913,2087,1898,1799,1922,1951,1930,1904,2138,2043,1846,1987,2161,2059,1975,1911,1937,1946,1912,1849,1844,1986,2084,2157,2372,2732,3236,3948,4407,4739,4753,4370,3945,3242,2963],
"2021":[2623,2486,2524,2457,2383,2369,2483,2582,2753,3016,3387,3679,4040,3779,3734,3430,3132,2792,2547,2354,2180,2089,2053,2023,2285,2136,2096,2083,1929,2090,2240,2234,2074,2339,2470,2643,2885,2765,2831,3056,3386,3809,4006,4120,4047,3935,3604,3413,3238,3036,2994],
"avg_pre_covid": [2584,2575,2529,2509,2460,2313,2296,2287,2280,2269,2202,2163,2143,2132,2074,2066,2052,2013,2030,1970,1975,1954,1919,1934,1962,1959,1898,1941,1873,1971,1963,1934,1859,1834,1818,1816,1817,1814,1803,1949,1985,2059,2053,2087,2103,2125,2080,2105,2155,2194,2227,2354,2149],
};
const data = {
labels: Array.from({length: 53}, (_, i) => i + 1),
datasets: [
{
label: 'средно за 2015-2019г.',
data: deaths_raw["avg_pre_covid"],
backgroundColor: [
'rgba(0, 0, 0, 0.2)',
],
borderColor: [
'rgba(0, 0, 0, 0.5)',
],
},
{
label: '2019г.',
data: deaths_raw["2019"],
backgroundColor: [
'rgba(0, 99, 132, 0.2)',
],
borderColor: [
'rgba(0, 99, 132, 1)',
],
},
{
label: '2020г.',
data: deaths_raw["2020"],
backgroundColor: [
'rgba(255, 150, 50, 0.2)',
],
borderColor: [
'rgba(255, 150, 50, 1)',
],
},
{
label: '2021г.',
data: deaths_raw["2021"],
backgroundColor: [
'rgba(255, 50, 100, 0.2)',
],
borderColor: [
'rgba(255, 50, 100, 1)',
],
},
]
};
const config = {
type: 'line',
data: data,
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
},
title: {
display: true,
text: 'Седмична смъртност за България'
}
},
tooltips: {
mode: "x",
intersect: false,
},
hover: {
mode: "x",
intersect: false,
},
scales: {
x: {
display: true,
title: {
display: true,
text: "Поредна Седмица",
font: {
weight: "bold",
}
}
},
y: {
display: true,
title: {
display: true,
text: "Умирания",
font: {
weight: "bold",
}
},
suggestedMin: 0,
},
}
},
};
var myChart = new Chart(ctx, config);
</script>
</body>
</html>