J64 J64 - 1 year ago 138
Javascript Question

D3 legend not appearing due to legendColor

My legend won't appear for my heatmap. It says the error: "d3.legendColor is not a function" but I am unsure of how to change it to work.

full chart and full code: http://codepen.io/jeffm64/pen/gwQAyb

The code

var colorScale = d3.scaleQuantile()
.domain([minVariance + baseTemp, maxVariance + baseTemp])

//creates the legend for the heatmap
.attr("class", "legendQuant")
.attr("transform", "translate(20,20)");

var legend = d3.legendColor()


Answer Source

If you are using Susie Lu's d3 Legend (http://d3-legend.susielu.com/), you'll have to reference it:

<script src="https://cdnjs.cloudflare.com/ajax/libs/d3-legend/2.13.0/d3-legend.js"></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download