]=0;
    }

    data.forEach(function(v) {
	const ind = Math.floor((v-min)/barwidth);
	hist[ind] ++;
    });

    let n = data.length;
    for (let i=0; i<nbar; i++) {
	hist[i] = hist[i];
    }

    return hist;
}

// [plot_histogram(container, data, bandwidth, xscale, yscale)]
// draws the histogram computes with
// [histogram(data, barwidth, d3.min(data), d3.max(data)]
// in the html element [container].
//
// Axis are already defined on [container], using [xscale] and [yscale].
//
// In addition, this fu