Public
Edited
Jul 11, 2023
2 forks
32 stars
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
data = {
if (!form.repo) {
yield [];
return;
}

let issues = [];
let pageNumber = 1;

while (true) {
const params = new URLSearchParams({
per_page: "100",
state: "all",
page: pageNumber
});
const data = await fetch(
`https://api.github.com/repos/${form.repo}/issues?${params.toString()}`,
{
headers: {
Authorization: form.token ? `token ${form.token}` : undefined,
Accept: "application/vnd.github.v3+json"
}
}
).then((r) => r.json());
issues = [...issues, ...data];
pageNumber++;
yield issues;
if (!data.length) return;
await Promises.delay(100);
}
}
Insert cell
cast = data
.filter((i) => {
switch (kind) {
case "Both":
return true;
case "Issues":
return !i.pull_request;
case "Pull requests":
return !!i.pull_request;
}
})
.map((d) => {
return {
...d,
created_at: new Date(d.created_at),
closed_at: d.closed_at && new Date(d.closed_at),
updated_at: new Date(d.updated_at)
};
})
Insert cell
Insert cell
function pulse(sources, lifeof, interval = d3.utcDay) {
return sources.flatMap((source) => {
const [start, end] = lifeof(source);
const dates = interval.range(interval.offset(interval.floor(start), -1), interval.offset(interval.floor(end), 2));
return dates.map((date, i) => {
return {
...source,
value: i === 0 || i === dates.length - 1 ? 0 : 1,
date
};
});
});
}
Insert cell
today = d3.utcDay(new Date)
Insert cell
expanded = pulse(cast, d => [d.created_at, d.closed_at ?? today])
Insert cell
Insert cell
domain = [d3.min(cast, d => d3.utcDay(d.created_at)), d3.utcDay.offset(today)]
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.
Learn more