Interpolating compound objects

There will be cases when what you need to interpolate in your visualization is not a simple value but rather an object consisting of multiple and different values, for example, a rectangular object with width, height, and color attributes. Fortunately, D3 has a built-in support for this type of compound object interpolation.

Getting Ready

Open your local copy of the following file in your web browser:

https://github.com/NickQiZhu/d3-cookbook/blob/master/src/chapter4/compound-interpolation.html

How to do it...

In this recipe, we will examine how compound object interpolation is performed in D3. The code for the compound-interpolation.html file is as follows:

<div id="compound" class="clear"> <span>Compound Interpolation<br></span> ...

Get Data Visualization with D3.js Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.