Interpolating a string
In some cases, you might need to interpolate numbers embedded in a string; perhaps a CSS style for font, for example.
In this recipe, we will examine how you can do that using D3 scale and interpolation. However, before we jump right into string interpolation, a bit of background knowledge on interpolator is due, and the following section will cover the basics of what interpolation is and how D3 implements interpolator functions.
Interpolator
In the first three recipes, we went over three different D3 scale implementations; now it is time to delve a little deeper into D3 scales. You are probably already asking the question, How do different scales know what value to use for different inputs? In fact, this question can be generalized ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access