This post describes how to build a density chart with a slider that controls the bandwidth argument in d3.js. It is very important to play with the bandwidth of your density chart to avoid over or under-smoothing. Adding a slider that allows to do so is a great way to allow data exploration for your readers.
updateChart
function that update this chart with a new dataset