Skip to content

Commit

Permalink
Make the labels easier to read by using the server names
Browse files Browse the repository at this point in the history
Refs #28
  • Loading branch information
thewilkybarkid committed Jul 2, 2024
1 parent 592203a commit 455d501
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/reviews.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const parseDate = d3.utcParse('%Y-%m-%d')
const languageNames = new Intl.DisplayNames(['en-US'], { type: 'language' })
const languageName = code => (code ? languageNames.of(code) : 'Unknown')

const preprintServers = FileAttachment('./data/preprint-servers.json').json()
const reviews = FileAttachment('./data/reviews.json')
.json()
.then(data => data.map(review => ({ ...review, createdAt: parseDate(review.createdAt) })))
Expand All @@ -19,6 +20,8 @@ const reviews = FileAttachment('./data/reviews.json')
```js
const now = new Date()
const firstReview = d3.min(reviews, review => review.createdAt)

const preprintServerName = id => preprintServers[id]
```

```js
Expand Down Expand Up @@ -121,7 +124,7 @@ function reviewsByPreprintServer({ width } = {}) {
y: { label: '' },
marks: [
Plot.barX(
reviewsSelected,
reviewsSelected.map(review => ({ ...review, server: preprintServerName(review.server) })),
Plot.groupY(
{
x: 'count',
Expand All @@ -140,7 +143,7 @@ function reviewsByPreprintServer({ width } = {}) {
},
),
),
Plot.axisY({ lineWidth: 15, marginLeft: 100 }),
Plot.axisY({ lineWidth: 15, marginLeft: 115 }),
],
})
}
Expand Down

0 comments on commit 455d501

Please sign in to comment.