|
322 | 322 | justify-content: center; |
323 | 323 | gap: 28px; |
324 | 324 | align-items: center; |
325 | | - margin: 0 auto 8px; |
| 325 | + margin: 0 auto; |
326 | 326 | } |
327 | 327 |
|
328 | 328 | .never-controls label { |
|
347 | 347 |
|
348 | 348 | .never-layout { |
349 | 349 | display: grid; |
350 | | - grid-template-columns: 1.08fr 0.92fr; |
351 | | - gap: 24px; |
| 350 | + grid-template-columns: 1.2fr 0.8fr; |
352 | 351 | align-items: start; |
353 | 352 | margin-top: 50px; |
354 | 353 | } |
|
366 | 365 | background: transparent; |
367 | 366 | } |
368 | 367 |
|
369 | | - .never-panel-title { |
370 | | - font-family: Arial, sans-serif; |
371 | | - font-size: 16px; |
372 | | - font-weight: 800; |
373 | | - fill: white; |
374 | | - } |
375 | | -
|
376 | 368 | .never-medaled-tooltip { |
377 | 369 | position: absolute; |
378 | 370 | pointer-events: none; |
|
382 | 374 | border: 1px solid rgba(255, 255, 255, 0.18); |
383 | 375 | border-radius: 10px; |
384 | 376 | padding: 10px 12px; |
385 | | - font-family: Arial, sans-serif; |
| 377 | + font-family: "Elms Sans", sans-serif; |
386 | 378 | font-size: 14px; |
387 | 379 | line-height: 1.35; |
388 | 380 | max-width: 330px; |
|
771 | 763 | } |
772 | 764 |
|
773 | 765 | function drawMap(container, data) { |
774 | | - const width = 760; |
775 | | - const height = 420; |
| 766 | + const width = 800; |
| 767 | + const height = 520; |
776 | 768 |
|
777 | 769 | const svg = container.append("svg") |
778 | 770 | .attr("viewBox", `0 0 ${width} ${height}`) |
779 | 771 | .attr("class", "never-map-svg"); |
780 | 772 |
|
781 | 773 | const projection = d3.geoNaturalEarth1() |
782 | | - .fitExtent([[10, 28], [width - 10, height - 10]], state.worldGeo); |
| 774 | + .fitExtent([[20, 20], [width - 10, height - 10]], state.worldGeo); |
783 | 775 |
|
784 | 776 | const path = d3.geoPath().projection(projection); |
785 | 777 |
|
786 | | - svg.append("text") |
787 | | - .attr("x", width / 2) |
788 | | - .attr("y", 20) |
789 | | - .attr("text-anchor", "middle") |
790 | | - .attr("class", "never-panel-title") |
791 | | - .attr("font-family", "'Elms Sans', sans-serif") |
792 | | - .text("Countries that have participated without ever winning a medal"); |
| 778 | + d3.select(".never-medaled-viz-title").text( |
| 779 | + `Countries that have participated without ever winning a medal` |
| 780 | + ); |
793 | 781 |
|
794 | 782 | const byCountry = new Map( |
795 | 783 | data.neverMedaled.map(d => [normalizeCountryName(d.country), d]) |
|
816 | 804 | }) |
817 | 805 | .attr("stroke-width", d => { |
818 | 806 | const country = normalizeCountryName(d.properties.name); |
819 | | - return byCountry.has(country) ? 0.95 : 0.45; |
| 807 | + return byCountry.has(country) ? 1.6 : 0.6; |
820 | 808 | }) |
821 | 809 | .attr("opacity", d => { |
822 | 810 | const country = normalizeCountryName(d.properties.name); |
|
866 | 854 |
|
867 | 855 | tooltip.style("opacity", 0); |
868 | 856 | }); |
| 857 | + |
| 858 | + const legendData = Object.entries(continentColors); |
| 859 | + const legendY = height - 8; |
| 860 | + const legendItemWidth = width / legendData.length; |
| 861 | + |
| 862 | + const legend = svg.append("g") |
| 863 | + .attr("transform", `translate(0, ${legendY})`); |
| 864 | + |
| 865 | + legendData.forEach(([continent, color], i) => { |
| 866 | + const x = i * legendItemWidth + legendItemWidth / 2; |
| 867 | + |
| 868 | + legend.append("rect") |
| 869 | + .attr("x", x - 28) |
| 870 | + .attr("y", -10) |
| 871 | + .attr("width", 12) |
| 872 | + .attr("height", 12) |
| 873 | + .attr("rx", 2) |
| 874 | + .attr("fill", color); |
| 875 | + |
| 876 | + legend.append("text") |
| 877 | + .attr("x", x - 10) |
| 878 | + .attr("y", 0) |
| 879 | + .attr("dy", "0.1em") |
| 880 | + .attr("fill", "white") |
| 881 | + .attr("font-family", "'Elms Sans', sans-serif") |
| 882 | + .attr("font-size", 16) |
| 883 | + .attr("font-weight", 600) |
| 884 | + .text(continent); |
| 885 | + }); |
869 | 886 | } |
870 | 887 |
|
871 | 888 | function drawBarChart(container, data, mode) { |
|
893 | 910 | .attr("x", width / 2) |
894 | 911 | .attr("y", 22) |
895 | 912 | .attr("text-anchor", "middle") |
896 | | - .attr("class", "never-panel-title") |
| 913 | + .attr("font-family", "Elms Sans, sans-serif") |
| 914 | + .attr("font-size", 16) |
| 915 | + .attr("font-weight", 700) |
| 916 | + .attr("fill", "white") |
897 | 917 | .text(mode === "continent" |
898 | 918 | ? "Participations without a medal by continent" |
899 | 919 | : "Most participations without a medal"); |
|
917 | 937 | .attr("dy", "0.35em") |
918 | 938 | .attr("text-anchor", "end") |
919 | 939 | .attr("fill", "white") |
920 | | - .attr("font-family", "Arial, sans-serif") |
921 | | - .attr("font-size", mode === "continent" ? 15 : 12) |
| 940 | + .attr("font-family", "Elms Sans, sans-serif") |
| 941 | + .attr("font-size", 14) |
922 | 942 | .attr("font-weight", 700) |
923 | 943 | .text(d => shortenLabel(d.name, mode === "continent" ? 18 : 20)); |
924 | 944 |
|
|
967 | 987 | .attr("y", d => y(d.name) + y.bandwidth() / 2) |
968 | 988 | .attr("dy", "0.35em") |
969 | 989 | .attr("fill", "white") |
970 | | - .attr("font-family", "Arial, sans-serif") |
971 | | - .attr("font-size", mode === "continent" ? 12 : 10) |
| 990 | + .attr("font-family", "Elms Sans, sans-serif") |
| 991 | + .attr("font-size", 12) |
972 | 992 | .attr("font-weight", 700) |
973 | 993 | .text(d => { |
974 | 994 | if (mode === "continent") { |
|
989 | 1009 | .call(g => g.selectAll("line").attr("stroke", "rgba(255,255,255,0.35)")) |
990 | 1010 | .call(g => g.selectAll("text") |
991 | 1011 | .attr("fill", "rgba(255,255,255,0.75)") |
992 | | - .attr("font-family", "Arial, sans-serif") |
993 | | - .attr("font-size", 11)); |
| 1012 | + .attr("font-family", "Elms Sans, sans-serif") |
| 1013 | + .attr("font-size", 14)) |
| 1014 | + .attr("font-weight", 700); |
994 | 1015 |
|
995 | 1016 | svg.append("text") |
996 | 1017 | .attr("x", (margin.left + width - margin.right) / 2) |
997 | 1018 | .attr("y", height - 8) |
998 | 1019 | .attr("text-anchor", "middle") |
999 | 1020 | .attr("fill", "rgba(255,255,255,0.72)") |
1000 | | - .attr("font-family", "Arial, sans-serif") |
1001 | | - .attr("font-size", 11) |
| 1021 | + .attr("font-family", "Elms Sans, sans-serif") |
| 1022 | + .attr("font-size", 14) |
| 1023 | + .attr("font-weight", 700) |
1002 | 1024 | .text("Athlete participations"); |
1003 | 1025 | } |
1004 | 1026 |
|
|
0 commit comments