Skip to content

Commit eb3b759

Browse files
authored
Merge pull request #4 from codestance/dev
Dev
2 parents e7363dc + 567c08c commit eb3b759

File tree

6 files changed

+117
-32
lines changed

6 files changed

+117
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Babies given names in Poland the last 20 years.
1+
Babies given names in Poland the last 21 years.

births.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ year,M,W,sum
1919
2017,206990,196093,403083
2020
2018,200468,188987,389455
2121
2019,193327,182865,376192
22-
2020,182932,173608,356540
22+
2020,182932,173608,356540
23+
2021,175132,165856,340988

index.html

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
.race span{
1919
position: absolute;
2020
bottom: 1.5em;
21-
right: 2em;
21+
right: 1.5em;
2222
font-size: 3em;
2323
font-weight: bolder;
2424
color: lightslategray;
25+
mix-blend-mode: multiply;
2526
}
2627

2728
</style>
@@ -69,7 +70,6 @@ <h3 id="instruction">Jak używać</h3>
6970
</div>
7071
<br/>
7172
<div id="names"></div>
72-
<!-- <div id="namesNew"></div> -->
7373
</section>
7474
<section class="py-3">
7575
<h3>Ranking najpopularniejszych imion wg kolejnych lat</h3>
@@ -116,7 +116,7 @@ <h2>O danych</h2>
116116
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script>
117117
<script>
118118
var chart,data;
119-
const years = []; for(let i=2000; i<=2020; i++) years.push(i)
119+
const years = []; for(let i=2000; i<=2021; i++) years.push(i)
120120
const yearsColumn = ['x']; for(let y of years) yearsColumn.push(y)
121121
function addOption(name){
122122
const opt = `<option id="${name}" value="${name}" >${name}</option>`;
@@ -135,7 +135,7 @@ <h2>O danych</h2>
135135
}
136136
function addName(name){chart.load({columns:[yearsColumn, getNameData(name)]})}
137137
function delName(name){chart.unload({ids: name})}
138-
d3.csv('https://gist.githubusercontent.com/codestance/f9a514f4dcad8ab1e981aa322deb885f/raw/7e8b4d14df60fa493081a5155edbaa5061dbf8dd/names-given-in-poland-till-2020').then(function(dat){
138+
d3.csv('https://gist.githubusercontent.com/codestance/0ae1d47de69530a8c38d50dd785a4a6c/raw/256683201d597826d39fb1cd0f0b900fd69d818a/names-given-in-poland-till-2021.csv').then(function(dat){
139139
data=dat;
140140
dat.map(d=>addOption(d.name))
141141
chart=c3.generate({
@@ -184,36 +184,13 @@ <h2>O danych</h2>
184184
delName(e.params.data.text)
185185
})
186186
})
187-
188-
// c3.generate({
189-
// bindto: '#namesNew',
190-
// data: {
191-
// x: 'name',
192-
// xFormat: '%Y',
193-
// columns: [['name','2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014','2015','2016','2017','2018','2019','2020'],
194-
// ['JAKUB',7.349072051,9.696426618,9.717660383,8.967060557,8.791191153,8.195207966,7.846769856,7.604767252,6.966773376,6.382508738,6.002904631,5.855582945,5.549923387,5.238200796,4.840549122,4.370972261,4.336138056,4.222377331,4.306523116,4.000321392,3.838362184],
195-
// ['JULIA',5.38307809,6.784997939,6.761774589,6.98353401,7.791083783,7.772292368,7.520597363,7.664508955,8.031592747,7.283529942,7.131775071,6.7657978,7.006591208,5.737263235,4.831635434,4.62043389,4.483998703,4.634105525,4.347714472,4.342983819,4.157123549],
196-
// ['KACPER',4.510729331,4.464253153,5.419194779,6.470540076,6.849542276,6.489472046,6.23219586,5.754295906,5.125589249,4.481096322,3.864991343,3.701305609,4.267640646,4.170321039,3.7488347,3.261132825,2.92678836,2.741644533,2.628487447,2.455130716,2.297014845]
197-
// ],
198-
// type: 'line',
199-
// order: null
200-
// },
201-
// axis: {
202-
// x: {
203-
// type: 'timeseries',
204-
// tick: {
205-
// format: '%Y'
206-
// }
207-
// }
208-
// }
209-
// })
210187
</script>
211188
<script type="module">
212189
import {default as births} from '/births.js'
213190
import {default as race} from '/race.js'
214191
births('births')
215-
race('raceM', 2020)
216-
race('raceW', 2020)
192+
race('raceM', 2021)
193+
race('raceW', 2021)
217194
</script>
218195
</body>
219196
<footer class="py-4">

race.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export default function(dataName, lastYear){
88
x: 'name',
99
value: ["value"]
1010
},
11-
type: 'bar'
11+
type: 'bar',
12+
names: {
13+
value: 'liczba'
14+
}
1215
},
1316
axis: {
1417
rotated: true,

raceM.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,5 +1091,57 @@
10911091
"value": 4963,
10921092
"rank": 10
10931093
}
1094+
],
1095+
"2021": [
1096+
{
1097+
"name": "ANTONI",
1098+
"value": 7821,
1099+
"rank": 1
1100+
},
1101+
{
1102+
"name": "JAN",
1103+
"value": 6975,
1104+
"rank": 2
1105+
},
1106+
{
1107+
"name": "ALEKSANDER",
1108+
"value": 6919,
1109+
"rank": 3
1110+
},
1111+
{
1112+
"name": "FRANCISZEK",
1113+
"value": 6629,
1114+
"rank": 4
1115+
},
1116+
{
1117+
"name": "JAKUB",
1118+
"value": 6427,
1119+
"rank": 5
1120+
},
1121+
{
1122+
"name": "LEON",
1123+
"value": 5296,
1124+
"rank": 6
1125+
},
1126+
{
1127+
"name": "MIKOŁAJ",
1128+
"value": 5205,
1129+
"rank": 7
1130+
},
1131+
{
1132+
"name": "SZYMON",
1133+
"value": 4962,
1134+
"rank": 8
1135+
},
1136+
{
1137+
"name": "FILIP",
1138+
"value": 4884,
1139+
"rank": 9
1140+
},
1141+
{
1142+
"name": "STANISŁAW",
1143+
"value": 4679,
1144+
"rank": 10
1145+
}
10941146
]
10951147
}

raceW.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,5 +1090,57 @@
10901090
"value": 4650,
10911091
"rank": 10
10921092
}
1093+
],
1094+
"2021": [
1095+
{
1096+
"name": "ZUZANNA",
1097+
"value": 6562,
1098+
"rank": 1
1099+
},
1100+
{
1101+
"name": "ZOFIA",
1102+
"value": 6325,
1103+
"rank": 2
1104+
},
1105+
{
1106+
"name": "HANNA",
1107+
"value": 6065,
1108+
"rank": 3
1109+
},
1110+
{
1111+
"name": "JULIA",
1112+
"value": 5954,
1113+
"rank": 4
1114+
},
1115+
{
1116+
"name": "MAJA",
1117+
"value": 5585,
1118+
"rank": 5
1119+
},
1120+
{
1121+
"name": "LAURA",
1122+
"value": 5569,
1123+
"rank": 6
1124+
},
1125+
{
1126+
"name": "OLIWIA",
1127+
"value": 4770,
1128+
"rank": 7
1129+
},
1130+
{
1131+
"name": "ALICJA",
1132+
"value": 4767,
1133+
"rank": 8
1134+
},
1135+
{
1136+
"name": "LENA",
1137+
"value": 4599,
1138+
"rank": 9
1139+
},
1140+
{
1141+
"name": "POLA",
1142+
"value": 4483,
1143+
"rank": 10
1144+
}
10931145
]
10941146
}

0 commit comments

Comments
 (0)