Using d3-legend to create an legend from an ordinal scale, but with a sequential color scheme. I chose this method because the categorical values imply order, as they represent values that have been pre-binned.
For this to work, the index of each value in the categories
array is divided by the array length - 1 and passed to d3.interpolateYlGnBu()
.
Built with blockbuilder.org