Reputation: 157
I am having trouble with the titles in my legend in the Blockbuilder below.
This snippet defines the scale used for the legend titles:
var color = d3.scale.ordinal()
.domain(["Pass", "Fail", "No Data"])
.range(["green", "red", "black"]);
However, I can't get them to display correctly.
Here is the link to the Blockbuilder.
Upvotes: 1
Views: 581
Reputation: 102174
Instead of passing the scale's range, pass its domain:
var legend = svg.selectAll('.legend')
.data(color.domain())
.enter()
.append('g');
Here is the updated blockbuilder: http://blockbuilder.org/anonymous/4779ee79f034c443ac0119cf26bc5392
Upvotes: 1