Published
Edited
May 3, 2021
3 forks
Importers
6 stars
Insert cell
Insert cell
Insert cell
combined = FileAttachment("combined.001.csv").csv()
Insert cell
// this file contains commits from the original d3 repo, thanks to Curran
// https://gist.github.com/curran/18287ef2c4b64ffba32000aad47c292b
combinedFull = FileAttachment("all-d3-commits.json").json()
Insert cell
authors = d3.group(combined, d => d.author)
Insert cell
Array.from(authors.keys())
Insert cell
chart = {
let height = 600;
let canvas = DOM.canvas(width, height);
let ctx = canvas.getContext("2d");

let radius = 2.5;

let xscale = d3
.scaleTime()
.domain(dateExtent)
.range([10, width - 10]);
combined.forEach(d => {
ctx.beginPath();
ctx.fillStyle = color(d.author);
ctx.arc(xscale(date(d)), yscale(d.repo), radius, 0, Math.PI * 2);
ctx.fill();
});
return canvas;
}
Insert cell
color = d3
.scaleOrdinal()
.domain(authors.keys())
.range(d3.schemeCategory10)
Insert cell
repos = d3.group(combined, d => d.repo)
Insert cell
yscale = d3
.scaleBand()
.domain(["d3"].concat(Array.from(repos.keys())))
.range([10, 550])
Insert cell
dateExtent = d3.extent(combined, d => date(d))
Insert cell
date = d => timeParser(d.date)
Insert cell
Insert cell
Insert cell
txt = FileAttachment("d3-ease.001.🔪sv").text()
Insert cell
lines = txt.split("☕")
Insert cell
commits = lines.slice(1).map(line => {
let l = line.split("🔪");
return {
hash: l[0],
date: l[1],
author: l[2],
subject: l[3],
body: l[4]
};
})
Insert cell
timeParser = d3.timeParse("%Y-%m-%d %H:%M:%S %Z")
Insert cell
d3.min(commits, d => timeParser(d.date))
Insert cell
yscale("d3-zoom")
Insert cell
d3 = require("d3@6")
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