2017-02-10 64 views

回答

1

好吧,算出來。如果使用定義範圍本身的函數(如d3.interpolateBlues),則必須使用d3.scaleSequential而不是d3.scaleLinear。正確的代碼是:

var color = d3.scaleSequential(d3.interpolateBlues) 
    .domain([0, 10000]) 
console.log(color(5000)); 

https://github.com/d3/d3-scale#sequential-scales

+0

感謝你爲這個 - 我需要它。你應該接受它作爲答案,因爲大多數人掃描到解決方案的標記答案。 – absmiths

相關問題