3
我的圖例不會出現在我的熱圖中。它說錯誤:「d3.legendColor不是一個函數」,但我不確定如何改變它的工作。由於legendColor D3圖例不出現
全圖和全碼:http://codepen.io/jeffm64/pen/gwQAyb
代碼
var colorScale = d3.scaleQuantile()
.domain([minVariance + baseTemp, maxVariance + baseTemp])
.range(colors);
//creates the legend for the heatmap
d3.select("svg")
.append("g")
.attr("class", "legendQuant")
.attr("transform", "translate(20,20)");
var legend = d3.legendColor()
.labelFormat(d3.format(".2f"))
.useClass(true)
.scale(colorScale);
svg.select(".legendQuant")
.call(legend);
啊,是的,這是它所需要的,非常感謝你! – J64