@@ -11,12 +11,6 @@ import {revive} from "./components/revive.js";
11
11
const {womens , mens , MONTHS_OF_DATA , TOP_N_COUNT } = await FileAttachment (" data/top-ranked-players.json" ).json ().then (revive);
12
12
```
13
13
14
- ``` js
15
- function formatTitle (title ) {
16
- return title === " GM" ? " Grand Master" : title;
17
- }
18
- ```
19
-
20
14
``` js
21
15
function bumpChart (data , {x = " month" , y = " rating" , z = " name" , interval = " month" , width} = {}) {
22
16
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
43
37
strokeWidth: 24 ,
44
38
curve: " bump-x" ,
45
39
sort: {color: " y" , reduce: " first" },
46
- mixBlendMode : dark ? " lighten " : " darken " ,
47
- interval
40
+ interval ,
41
+ render : halo ({stroke : " var(--theme-background-alt) " , strokeWidth : 27 })
48
42
})),
49
43
Plot .text (data, {
50
44
... rank,
@@ -71,6 +65,23 @@ function bumpChart(data, {x = "month", y = "rating", z = "name", interval = "mon
71
65
]
72
66
})
73
67
}
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
+ }
74
85
```
75
86
76
87
<div class =" grid " >
0 commit comments