Skip to content

Commit 8f9a545

Browse files
committed
fix: correct Sankey graph vizu (remove slide, title and change police
1 parent 08a7da9 commit 8f9a545

4 files changed

Lines changed: 25 additions & 18 deletions

File tree

website/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ <h2>Where do the medal winners come from?</h2>
113113
</div>
114114

115115
<div class="slide" data-anchor="medal-flow">
116-
<h2>Where do the medal winners come from?</h2>
117-
118116
<div id="medal-viz">
119117
<div class="medal-controls">
120118
<div>

website/js/delegations.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,16 @@
380380

381381
state.availableYears = getAvailableYears(season);
382382

383-
state.currentYear = state.availableYears.includes(1896)
384-
? 1896
385-
: state.availableYears[0];
383+
const previousYear = state.currentYear;
384+
if (previousYear && state.availableYears.includes(previousYear)) {
385+
state.currentYear = previousYear;
386+
} else if (previousYear) {
387+
state.currentYear = state.availableYears.reduce((closest, y) =>
388+
Math.abs(y - previousYear) < Math.abs(closest - previousYear) ? y : closest
389+
);
390+
} else {
391+
state.currentYear = state.availableYears[0];
392+
}
386393

387394
updateSliderLimits();
388395
update();
@@ -432,7 +439,7 @@
432439
}
433440

434441
state.playing = true;
435-
d3.select(selectors.play).text("");
442+
d3.select(selectors.play).text("II");
436443

437444
playNextYear();
438445
}
@@ -746,8 +753,8 @@
746753
root.selectAll("*").remove();
747754

748755
const width = 1280;
749-
const height = 650;
750-
const margin = { top: 70, right: 40, bottom: 30, left: 40 };
756+
const height = 520;
757+
const margin = { top: 75, right: 40, bottom: 20, left: 40 };
751758

752759
const svg = root
753760
.append("svg")
@@ -759,7 +766,7 @@
759766
.attr("y", 32)
760767
.attr("text-anchor", "middle")
761768
.attr("fill", "white")
762-
.attr("font-family", "Arial, sans-serif")
769+
.attr("font-family", "'Elms Sans', sans-serif")
763770
.attr("font-size", 24)
764771
.attr("font-weight", 700)
765772
.text(`Distribution of medals in ${graph.season} Olympics, ${graph.year}`);
@@ -769,7 +776,7 @@
769776
.attr("y", 58)
770777
.attr("text-anchor", "middle")
771778
.attr("fill", "rgba(255,255,255,0.75)")
772-
.attr("font-family", "Arial, sans-serif")
779+
.attr("font-family", "'Elms Sans', sans-serif")
773780
.attr("font-size", 14)
774781
.text(`Flows show ${graph.mode}s → medal type → top 10 sports · ${graph.medalCount} medals shown`);
775782

@@ -779,7 +786,7 @@
779786
.attr("y", height / 2)
780787
.attr("text-anchor", "middle")
781788
.attr("fill", "white")
782-
.attr("font-family", "Arial, sans-serif")
789+
.attr("font-family", "'Elms Sans', sans-serif")
783790
.attr("font-size", 22)
784791
.text("No medal data available for this year.");
785792

@@ -871,7 +878,7 @@
871878
.attr("dy", "0.35em")
872879
.attr("text-anchor", d => d.x0 < width / 2 ? "start" : "end")
873880
.attr("fill", "white")
874-
.attr("font-family", "Arial, sans-serif")
881+
.attr("font-family", "'Elms Sans', sans-serif")
875882
.attr("font-size", 13)
876883
.attr("font-weight", d => d.type === "medal" ? 800 : 600)
877884
.text(d => shortenLabel(d.name, 22));
@@ -937,10 +944,10 @@
937944

938945
header.append("div")
939946
.html(`
940-
<div style="font-family:Arial, sans-serif; font-size:28px; font-weight:800;">
947+
<div style="font-family:'Elms Sans', sans-serif; font-size:28px; font-weight:800;">
941948
${detail.medal} medals in ${detail.sport}
942949
</div>
943-
<div style="font-family:Arial, sans-serif; font-size:15px; color:rgba(255,255,255,0.72); margin-top:4px;">
950+
<div style="font-family:'Elms Sans', sans-serif; font-size:15px; color:rgba(255,255,255,0.72); margin-top:4px;">
944951
${detail.season} Olympics, ${detail.year} · grouped by ${detail.mode}
945952
</div>
946953
`);
@@ -951,7 +958,7 @@
951958
.style("border", "2px solid white")
952959
.style("border-radius", "10px")
953960
.style("padding", "9px 18px")
954-
.style("font-family", "Arial, sans-serif")
961+
.style("font-family", "'Elms Sans', sans-serif")
955962
.style("font-size", "15px")
956963
.style("font-weight", "800")
957964
.style("cursor", "pointer")
@@ -1038,7 +1045,7 @@
10381045
.attr("y", 22)
10391046
.attr("text-anchor", "middle")
10401047
.attr("fill", "white")
1041-
.attr("font-family", "Arial, sans-serif")
1048+
.attr("font-family", "'Elms Sans', sans-serif")
10421049
.attr("font-size", 16)
10431050
.attr("font-weight", 700)
10441051
.text(`The ${total} ${detail.medal.toLowerCase()} medals in ${detail.sport} are split across ${detail.mode}s`);
@@ -1093,7 +1100,7 @@
10931100
.attr("dy", "0.35em")
10941101
.attr("text-anchor", d => d.x0 < width / 2 ? "start" : "end")
10951102
.attr("fill", "white")
1096-
.attr("font-family", "Arial, sans-serif")
1103+
.attr("font-family", "'Elms Sans', sans-serif")
10971104
.attr("font-size", 15)
10981105
.attr("font-weight", 800)
10991106
.text(d => {

website/js/gender-evolution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@
370370

371371
function startPlaying() {
372372
state.playing = true;
373-
d3.select(selectors.play).text("");
373+
d3.select(selectors.play).text("II");
374374

375375
state.timer = setInterval(() => {
376376
const currentIndex = state.availableYears.indexOf(state.currentYear);

website/styles.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ p {
641641
color: white;
642642
font-size: 18px;
643643
font-weight: 700;
644+
font-family: "Elms Sans", sans-serif;
644645
margin-right: 8px;
645646
}
646647

@@ -652,6 +653,7 @@ p {
652653
padding: 8px 14px;
653654
font-size: 18px;
654655
font-weight: 700;
656+
font-family: "Elms Sans", sans-serif;
655657
cursor: pointer;
656658
}
657659

0 commit comments

Comments
 (0)