Skip to main content
100%

getBBox

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 21, 2011

This example demonstrates how to retrieve and display the bounding box of SVG text using the `getBBox()` method. A large text element reading "Hello, getBBox!" is rendered in the center of the canvas, and the code then calculates its exact bounding rectangle. A semi-transparent gray rectangle is drawn over that measured area, highlighting the precise dimensions and position of the text. The implementation uses D3 v3 to append the SVG elements and calls `text.node().getBBox()` to obtain the geometry, with styling applied via inline attributes.

AI-generated description
gpl-3.0 Licensed

Similar vizzes