function legend({width, height, dataset, title}){
let svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", `0 0 ${width} ${height}`)
let scaleColors = d3.scaleSequential([0, 10], d3.interpolateBlues);
let scale = d3.scaleBand(d3.ticks(0, d3.max(dataset), 5), [0, width]);
let axis = (g) => g.call(d3.axisBottom(scale).tickFormat(d3.format(","))).attr("transform", "translate(0, 50)");
svg.append("text").classed("title", true).attr("y", 20).text(title)
svg.append("g")
.classed("boxes", true)
.selectAll("rect.box")
.data(d3.range(0, 10))
.join("rect")
.classed("box", true)
.attr("y", 30)
.attr("x", (d,i)=>{
return i * 60;
})
.attr("width", 60)
.attr("height", 20)
.attr("fill", (d, i)=>{
return scaleColors(d);
})
svg.append("g")
.call(axis)
return svg.node();
}