Published
Edited
Sep 30, 2022
6 stars
Insert cell
Insert cell
Insert cell
displaydata=data.map(d => {return {city: tracks[d.track],start: d.target}})
Insert cell
Insert cell
tracks = ["Hamburg", "Cologne", "Munich", "Remote"]
Insert cell
bootcamp_days = 12 * 7
Insert cell
t = function (d) {
return Math.trunc(d / 120);
}
Insert cell
monday = function(d){
return d3.timeDay.offset(d, - d.getDay() + 1)
}
Insert cell
formatTime = d3.timeFormat("%B %d")
Insert cell
x = d3
.scaleTime()
.domain([
new Date("2023-01-01T00:00"),
new Date(new Date("2023-12-31T24:00Z"))
])
.rangeRound([margin.left, width - margin.right])
Insert cell
interval = d3.timeDay.every(1)
Insert cell
xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(g => g.append("g")
.call(d3.axisBottom(x)
.ticks(interval)
.tickSize(-height + margin.top + margin.bottom)
.tickFormat(() => null))
.call(g => g.select(".domain")
.attr("fill", "#FB734B")
.attr("stroke", null))
.call(g => g.selectAll(".tick line")
.attr("stroke", "#FCE584")
.attr("stroke-opacity", d => d <= d3.timeMonth(d) ? 0 : 1))) // mark beginning of month
.call(g => g.append("g")
.call(d3.axisBottom(x)
.ticks(d3.timeMonth)
.tickPadding(0))
.attr("text-anchor", null)
.call(g => g.select(".domain").remove())
.call(g => g.selectAll("text").attr("x", 6)))
Insert cell
margin = ({top: 10, right: 0, bottom: 20, left: 100})
Insert cell
height = tracks.length * 120
Insert cell
d3 = require("d3@5")
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