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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more