chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, hist_width, hist_height]);
svg.append("g")
.attr("fill", "steelblue")
.selectAll("rect")
.data(bins)
.join("rect")
.attr("x", d => hist_x(d.x0) + 1)
.attr("width", d => Math.max(0, hist_x(d.x1) - hist_x(d.x0) - 0.1))
.attr("y", d => hist_y(d.length))
.attr("height", d => hist_y(0) - hist_y(d.length));
svg.append("text")
.attr("class", "x label")
.attr("text-anchor", "end")
.attr("x", hist_width-125)
.attr("y", hist_height - 4)
.attr("font-size", "9px")
.text("Quantity of Messages Exchanged");
svg.append("text")
.attr("class", "title")
.attr("text-anchor", "end")
.attr("x", hist_width-80)
.attr("y", 15)
.attr("font-size", "10px")
.text("Histogram of Total Message Count by Contact");
svg.append("text")
.attr("class", "y label")
.attr("text-anchor", "end")
.attr("y", 2)
.attr("x", -120)
.attr("dy", ".75em")
.attr("transform", "rotate(-90)")
.attr("font-size", "9px")
.text("Count of Contacts");
svg.append("g")
.call(hist_xAxis);
svg.append("g")
.call(hist_yAxis);
return svg.node();
}