Using continuous scales

In this recipe, we will examine the most commonly used scales provided by D3: the continuous scales that map a continuous quantitative domain to a continuous range, including linear, power, logarithmic, and time scales.

Getting ready

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

https://github.com/NickQiZhu/d3-cookbook-v2/blob/master/src/chapter4/continuous-scales.html .

How to do it...

Let's take a look at the following code example:

<div id="linear" class="clear"><span>n</span></div> <div id="linear-capped" class="clear"> <span>1 &lt;= a*n + b &lt;= 20</span> </div> <div id="pow" class="clear"><span>n^2</span></div> <div id="pow-capped" class="clear"> <span>1 &lt;= a*n^2 + b &lt;= 10</span> </div> <div id="log" ...

Get Data Visualization with D3 4.x Cookbook - Second Edition 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.