Skip to main content
100%

Fitted Symbols

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Oct 22, 2015

This example cycles through D3’s built-in symbol types, scaling each shape to fit a fixed rectangular bounding box. A symbol path’s type changes every two seconds, and its size is recalculated from the bounding box’s aspect ratio using `getBBox`. The SVG rendering includes a gray rectangle as the target region, with a 1.5-second transition animating the shape’s new area. The code uses `d3.svg.symbol`, `d3.svg.symbolTypes`, and path transitions to demonstrate dynamic fitting.

AI-generated description

This example demonstrates how to scale a D3 symbol to fit inside a specified rectangular bounding box using getBBox.

gpl-3.0 Licensed

Similar vizzes