Public
Edited
Mar 10, 2023
Insert cell
Insert cell
UVA_bball_allyears (1).csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
scores = FileAttachment("UVA_bball_allyears (1).csv").csv() //name and parse the file
Insert cell
Insert cell
chart = {
let mySVG = d3.select(svg);
let midline = mySVG.attr("height")/2;
let startX = 5;
let spacing = 3;

let sparklines = mySVG.selectAll("line")
.data(scores)
.join("line")
.attr("x1", (d,i) => startX + i * spacing)
.attr("x2", (d,i) => startX + i * spacing)
.attr("y1", midline)
.attr("y2", d => midline - Number(d.UVA_score) + +d.Opponent_score)
.attr("class", d => {
if (d.Location == "Charlottesville, Va.") {
return "home";
} else {
return "away";
}
})
}
Insert cell
{
scores.filter(d => d.Date="2/28/23")[0].UVA_score=64;
scores.filter(d => d.Date="2/28/23")[0].Opponent_score=57;
}
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