我的热图不会显示我的图例。它说错误:“d3.legendColor不是一个函数”,但我不确定如何将其更改为工作。
完整图表和完整代码: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);