Using quantitative scales
In this recipe, we will examine the most commonly-used scales provided by D3—the quantitative scales including linear, power, and logarithmic scales.
Getting Ready
Open your local copy of the following file in your web browser:
https://github.com/NickQiZhu/d3-cookbook/blob/master/src/chapter4/quantitative-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 <= a*n + b <= 20</span> </div> <div id="pow" class="clear"><span>n^2</span></div> <div id="pow-capped" class="clear"> <span>1 <= a*n^2 + b <= 10</span> </div> <div id="log" class="clear"><span>log(n)</span></div> <div id="log-capped" class="clear"> <span>1 <= a*log(n) + b <= 10</span> </div> <script...