draw rectangles with path elements
d3-shape provides handy tools which help with drawing many common shapes, but curiously enough, rectangles are not among them. In most situations it is sufficient to use a rect element, but rect elements do not have path strings, and thus cannot be interpolated into a different shape. This plugin is a tiny helper which draws your rectangles using path elements so they can be animated.
If you use NPM,
npm install d3-rect. Otherwise, download the latest release.
d3.rect is a function which returns a path string when passed an object containing x, y, height, and width properties.
// append a path elementd3// set the path string;