Platform
Resources
Pricing
Sign in
Get started
Jung-Hua Liu
Workspace
Fork
Public
By
Jung-Hua Liu
Edited
Nov 30, 2022
Fork of
Visualizing Open-Source Code, Contributions & Communities
3
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
jobs
=
FileAttachment
(
"testJobs.json"
)
.
json
(
)
Insert cell
import
{
vl
}
from
"@vega/vega-lite-api"
Insert cell
// visualize job name, conclusion, & duration (minutes) by run
vl
.
markSquare
(
)
.
data
(
jobs
)
.
encode
(
vl
.
x
(
)
.
fieldO
(
'run_number'
)
,
vl
.
y
(
)
.
fieldN
(
'name'
)
,
vl
.
color
(
)
.
fieldN
(
'conclusion'
)
.
scale
(
{
range
:
[
"red"
,
"yellow"
,
"green"
]
}
)
,
vl
.
size
(
)
.
fieldQ
(
'minutes'
)
)
.
render
(
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof
orgRepo
=
Text
(
{
value
:
"d3/d3"
,
label
:
"owner/repo"
,
submit
:
"Go"
}
)
Insert cell
punchCard
=
(
await
fetch
(
`https://api.github.com/repos/${
orgRepo
}/stats/punch_card`
,
requestInit
)
)
.
json
(
)
Insert cell
Insert cell
// wrangle data
punchCardData
=
punchCard
.
map
(
(
[
dayIndex
,
hour
,
commits
]
)
=>
(
{
day
:
days
[
dayIndex
]
,
hour
,
commits
}
)
)
Insert cell
// visualize commit times
vl
.
markSquare
(
)
.
data
(
punchCardData
)
.
encode
(
vl
.
y
(
)
.
fieldO
(
'day'
)
.
sort
(
days
)
,
vl
.
x
(
)
.
fieldO
(
'hour'
)
,
vl
.
size
(
)
.
fieldQ
(
'commits'
)
)
.
render
(
)
Insert cell
Insert cell
Insert cell
Insert cell
contributorsJson
=
(
await
fetch
(
`https://api.github.com/repos/${
orgRepo
}/stats/contributors`
,
requestInit
)
)
.
json
(
)
Insert cell
// wrangle data
contributors
=
contributorsJson
.
map
(
c
=>
(
{
name
:
c
.
author
.
login
,
title
:
c
.
author
.
login
,
group
:
orgMembers
.
includes
(
c
.
author
.
login
)
?
'member'
:
'external'
,
// orgMembers is fetched below
value
:
c
.
total
}
)
)
Insert cell
// display the bubble chart we import below
bubbleChart
Insert cell
// import bubble chart & inject our data
import
{
chart
as
bubbleChart
}
with
{
contributors
as
data
}
from
"@d3/bubble-chart"
Insert cell
// get org members so we can group by membership
orgMembers
=
{
const
members
=
await
fetch
(
`https://api.github.com/orgs/${
orgRepo
.
split
(
'/'
)
[
0
]
}/members?per_page=100`
)
;
return
(
await
members
.
json
(
)
)
.
map
(
m
=>
m
.
login
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
jobs
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
orgRepo
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
punchCard
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
days
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
punchCardData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
contributorsJson
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
contributors
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
orgMembers
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
references
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
embedHeight
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
requestInit
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML