Published
Edited
Feb 16, 2018
1 fork
Insert cell
Insert cell
function myFunction(selection) {
var bbox = selection.node().getBBox(); // This line errors on Firefox.
selection.text(`${bbox} width: ${bbox.width}, height: ${bbox.height}`);
}
Insert cell
{
var svg = d3.select(DOM.svg(width, height));
svg.append("text")
.attr("y", height / 2)
.call(myFunction);

return svg.node();
}
Insert cell
Insert cell
d3.select("text").node().getBBox().width
Insert cell
d3.select("text").node().getBBox().height
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