Public
Edited
Jan 22, 2024
Insert cell
Insert cell
boundingBox = {
let svg = d3.select(DOM.svg(textWidth, textHeight))
.style("background-color", "#e0e0e0")
.style("outline", "thin dashed black")
.style("overflow", "visible")

let label = svg
.append('text')
.text(text)
.style("text-anchor", "start")
.attr("font-family", font)
.attr("font-weight","bold")
.attr("font-size",size+"pt")
.attr("fill", 'black')
.attr('y', textY )

return svg.node()
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
measure = measureText( text, size, font )
Insert cell
textWidth = measure.width * widthCorrection
Insert cell
textHeight = (measure.fontBoundingBoxAscent + measure.fontBoundingBoxDescent) * heightCorrection
Insert cell
textY = measure.fontBoundingBoxAscent * heightCorrection
Insert cell
Insert cell
htl.html`
<link rel="stylesheet" href="${fonts_link}">
`
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