Public
Edited
Oct 14, 2024
Insert cell
Insert cell
{
/* Code below is taken from assignment 3 page for rendering the map */
// // Add an SVG element to the DOM
var container = d3.create("div");
var svg = container
.append("svg")
.attr("width", mapWidth)
.attr("height", mapHeight)
.style("border", "1px solid black");

// Add SVG map at correct size, assuming map is saved in a subdirectory called `data`
svg
.append("image")
.attr("width", mapWidth)
.attr("height", mapHeight)
.attr("xlink:href", await FileAttachment("cs448b-map2.png").url());

const data = d3
.csv(
"FILE_URL_HERE",
(d) => {
// TODO: Add any data pre-processing here, if necesary
return d;
}
)
.then((data) => {
// TODO: Callback function
});
/* End of code taken from assignemnt 3 page for rendering the map */

return container.node();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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