Skip to content

Commit

Permalink
Show the number of new users over time
Browse files Browse the repository at this point in the history
Refs #31
  • Loading branch information
thewilkybarkid committed Jul 4, 2024
1 parent 77ed715 commit fdeef4e
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
theme: dashboard
title: PREreviewers
toc: false
---

# PREreviewers 🫅

```js
const parseTimestamp = d3.utcParse('%Y-%m-%dT%H:%M:%SZ')

const users = FileAttachment('./data/users.json')
.json()
.then(data => data.map(user => ({ ...user, timestamp: parseTimestamp(user.timestamp) })))
```

```js
const now = new Date()
const firstUser = d3.min(users, user => user.timestamp)
```

<div class="grid grid-cols-4">
<div class="card">
<h2>PREreviewers</h2>
<span class="big">${users.length.toLocaleString("en-US")}</span>
</div>
</div>

```js
console.log(users)
function usersTimeline({ width } = {}) {
return Plot.plot({
title: 'PREreviewers joining per month',
width: Math.max(width, 600),
height: 400,
y: { grid: true, label: 'PREreviewers', tickFormat: Math.floor, interval: 1 },
x: {
label: '',
domain: [d3.utcMonth.floor(firstUser), d3.utcMonth.ceil(now)],
},
marks: [
Plot.rectY(
users,
Plot.binX(
{ y: 'count' },
{
x: 'timestamp',
interval: d3.utcMonth,
tip: true,
},
),
),
],
})
}
```

<div class="grid grid-cols-1">
<div class="card">
${resize((width) => usersTimeline({width}))}
</div>
</div>

0 comments on commit fdeef4e

Please sign in to comment.