Public
Edited
Mar 27, 2023
90 forks
1 star
Insert cell
Insert cell
<svg width="1000" height="1000"> <!-- you can modify these values if you need -->
<style>
/* put styles in here. */
</style>

<!-- You can also put some things static in here, like the main Landguzzlers title and subtitle at the top. Those are not drawn from data, so can be static. -->

</svg>
Insert cell
Insert cell
Insert cell
landguzzlers = d3.select(svgContainer) // selects the cell called svgContainer and make it a d3 object.
Insert cell
Insert cell
Insert cell
data = FileAttachment("land_guzzlers.csv").csv()
Insert cell
Insert cell
// this is the part that does the drawing.
// put a whole sequence of statements inside this { } code block.

{
landguzzlers.selectAll(".guzzlerrects")
.data(data)
.join("rect")
.attr("x", replace_this_with_some_value_or_calculation)
.attr("y", replace_this_with_some_value_or_calculation_from_d)
.attr("width", replace_this_with_some_value_or_calculation_from_d)
.attr("height", replace_this_with_some_value_or_calculation_from_d)
.style("propertyname", replace_this_with_some_value_or_calculation_from_d)
.attr("class", "guzzlerrects"); // <- don't forget the ; at the end of the whole statement

landguzzlers.selectAll(".guzzlertitles")
.data(data)
.join("text")
.attr("x", replace_this_with_some_value_or_calculation)
// ...
.attr("class", "guzzlertitles");

}
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