Published
Edited
Mar 11, 2021
Insert cell
Insert cell
chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("fill", "steelblue")
.selectAll("rect")
.data(rows)
.join("rect")
.attr("x", d => x(d.date))
.attr("width", x.bandwidth())
.attr("y", d => y(d.pool_amount))
.attr("height", d => y(0) - y(d.pool_amount));

svg.append("g")
.attr("fill", "lightblue")
.selectAll("rect")
.data(rows)
.join("rect")
.attr("x", d => x(d.date))
.attr("width", x.bandwidth())
.attr("y", d => y(d.match_amount + d.pool_amount))
.attr("height", d => y(0) - y(d.match_amount));
svg.append("g")
.call(xAxis);

svg.append("g")
.call(yAxis);

return svg.node();
}
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
csv = await fetch("https://zachmargolis.com/trivia.csv").then(response => {
if (!response.ok) throw new Error(response.status);
return response.text();
});
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