D3.js interpolateString()函数
D3.js 中的intepolateString()函数用于返回两个字符串之间的插值函数。对于字符串“b”中的每个数字,该函数在字符串“a”中为它找到一个数字,然后使用数字插值器函数返回这些数字的插值,并将字符串“b”的剩余部分用作模板。
句法:
d3.intepolateString(a, b);
参数:它需要两个参数:
- a:是字符串字符和数字。
- b:也是字符串字符和数字。
返回:它返回插值函数。
下面给出了上述函数的几个例子。
示例 1:
html
Document
html
Document
输出:
示例 2:
html
Document
输出: