上一章介绍了量子比例尺和分位比例尺: https://www.cnblogs.com/littlespill/p/10823376.html
现在给大家简单介绍一下阈值比例尺。
1 var threshold = d3.scale.threshold() 2 .domain([10,20,30]) 3 .range(["red","green","blue","black"]) 4 5 console.log(threshold(5)) //返回值red 6 console.log(threshold(15)) //返回值green 7 console.log(threshold(25)) //返回值blue 8 console.log(threshold(35)) //返回值black
1 console.log(threshold.invertextent("red")) //返回值[undefined, 10] 2 console.log(threshold.invertextent("green")) //返回值[10, 20] 3 console.log(threshold.invertextent("blue")) //返回值[20, 30] 4 console.log(threshold.invertextent("black")) //返回值[30, undefined]
如对本文有疑问, 点击进行留言回复!!
vue源码实战render.js与$nextTick的异步调用
网友评论