This post describes how to build a histogram with d3.js and add a slider that controls bin size. It is important to play with bin size since the conclusion can become significantly different. This example works with d3.js v4
and v6
div
that will be modified by d3 later on.svg
area. It specify the chart size and its margin. Read more.d3.histogram()
function that will compute the binning and returns the coordinates of each bar..append("rect")
approach.