@@ -11,12 +11,6 @@ import {revive} from "./components/revive.js";
1111const {womens , mens , MONTHS_OF_DATA , TOP_N_COUNT } = await FileAttachment (" data/top-ranked-players.json" ).json ().then (revive);
1212```
1313
14- ``` js
15- function formatTitle (title ) {
16- return title === " GM" ? " Grand Master" : title;
17- }
18- ```
19-
2014``` js
2115function bumpChart (data , {x = " month" , y = " rating" , z = " name" , interval = " month" , width} = {}) {
2216 const rank = Plot .stackY2 ({x, z, order: y, reverse: true });
@@ -43,8 +37,8 @@ function bumpChart(data, {x = "month", y = "rating", z = "name", interval = "mon
4337 strokeWidth: 24 ,
4438 curve: " bump-x" ,
4539 sort: {color: " y" , reduce: " first" },
46- mixBlendMode : dark ? " lighten " : " darken " ,
47- interval
40+ interval ,
41+ render : halo ({stroke : " var(--theme-background-alt) " , strokeWidth : 27 })
4842 })),
4943 Plot .text (data, {
5044 ... rank,
@@ -71,6 +65,23 @@ function bumpChart(data, {x = "month", y = "rating", z = "name", interval = "mon
7165 ]
7266 })
7367}
68+
69+ function halo ({stroke = " currentColor" , strokeWidth = 3 } = {}) {
70+ return (index , scales , values , dimensions , context , next ) => {
71+ const g = next (index, scales, values, dimensions, context);
72+ for (const path of [... g .childNodes ]) {
73+ const clone = path .cloneNode (true );
74+ clone .setAttribute (" stroke" , stroke);
75+ clone .setAttribute (" stroke-width" , strokeWidth);
76+ path .parentNode .insertBefore (clone, path);
77+ }
78+ return g;
79+ };
80+ }
81+
82+ function formatTitle (title ) {
83+ return title === " GM" ? " Grand Master" : title;
84+ }
7485```
7586
7687<div class =" grid " >
0 commit comments