Skip to content

Commit

Permalink
Make it easier to read the data with a tooltip
Browse files Browse the repository at this point in the history
Refs #31
  • Loading branch information
thewilkybarkid committed Jul 11, 2024
1 parent ab75573 commit fa48ecf
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ function usersByLocation() {
users => users.length,
user => user.country,
)

return Plot.plot({
projection: 'equal-earth',
width,
Expand All @@ -171,11 +170,19 @@ function usersByLocation() {
legend: true,
},
marks: [
Plot.geo(countries(), {
fill: d => colors.get(i18nIsoCountries.alpha3ToAlpha2(d.properties.A3)),
stroke: 'var(--theme-foreground-muted)',
strokeWidth: 0.2,
}),
Plot.geo(
countries(),
Plot.centroid({
fill: d => colors.get(i18nIsoCountries.alpha3ToAlpha2(d.properties.A3)),
stroke: 'var(--theme-foreground-muted)',
strokeWidth: 0.2,
tip: true,
title: d => {
const alpha2 = i18nIsoCountries.alpha3ToAlpha2(d.properties.A3)
return `${alpha2 ? regionNameWithFlag(alpha2) : d.properties.A3} ${(colors.get(alpha2) ?? 0).toLocaleString('en-US')}`
},
}),
),
],
})
}
Expand Down

0 comments on commit fa48ecf

Please sign in to comment.