chart = {
const svg = d3.select(DOM.svg(width, height));
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
const serie = svg.append("g")
.selectAll("g")
.data(series)
.enter().append("g")
.attr("transform", d => `translate(0,${y(d.key) + 1})`);
const tip = d3tip().attr('class', 'd3-tip').html(d => (100*d).toFixed(1));
svg.call(tip)
serie.append("g")
.selectAll("rect")
.data(d => d.value)
.enter().append("rect")
.attr("fill" , d => z(d))
.attr("x" , (d,i) => x(bins[i]))
.attr("y" , 0)
.attr("height", y.bandwidth())
.attr("width" , x.bandwidth())
.on('mouseover', tip.show)
.on('mouseout' , tip.hide);
const legend = svg.append("g")
.attr("transform", d => `translate(${margin.left},0)`);
legend
.selectAll("rect")
.data(legendBins)
.enter()
.append("rect")
.attr("x", (d, i) => legendElementWidth * i)
.attr("y", height - (2*legendHeight))
.attr("width", legendElementWidth)
.attr("height", legendHeight)
.style("fill", d => z(d));
legend
.selectAll("text")
.data(legendBins)
.enter()
.append("text")
.text(d => "≥ " + (100*d).toFixed(1))
.attr("x", (d, i) => legendElementWidth * i)
.attr("y", height - (legendHeight / 2))
.style("font-size", "9pt")
.style("font-family", "Consolas, courier")
.style("fill", "#aaa");
return svg.node();
}