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. This example works with d3.js v4
and v6
updateChart
function that update this chart with a new dataset