{
const dataset = d3.shuffle(d3.range(40, 200, 10));
const width = 400;
const height = 100;
const svg = d3
.create('svg')
.attr('width', width)
.attr('height', height);
const barPadding = 1;
const rects = svg
.selectAll('rect')
.data(dataset)
.join('rect');
rects
.attr('x', (d, i) => i * (width / dataset.length))
.attr('y', d => height - (d / d3.max(dataset)) * height)
.attr('width', width / dataset.length - barPadding)
.attr('height', d => (d / d3.max(dataset)) * height)
.attr('fill', d => `hsl(220, 50%, ${60 - (d / d3.max(dataset)) * 40}%)`);
return svg.node();
}