barras2 = {
const width = 700
const height = 200
const svg = d3.select(DOM.svg(width, height))
const dataset = [
{height: 10, color: 23},{height: 15, color: 33},
{height: 30, color: 40},{height: 50, color: 60},
{height: 80, color: 22},{height: 65, color: 10},
{height: 55, color: 5},{height: 30, color: 30},
{height: 20, color: 60},{height: 10, color: 90},
{height: 8, color: 10}]
let colorScale = d3.scaleLinear()
.domain([0, 100])
.range(["Khaki", "Gold"]);
svg.selectAll('rect')
.data(dataset)
.enter()
.append('rect')
.attr('x', (d, i) => i * 30 + 20)
.attr('y', (d) => 200 - d.height * 2)
.attr('width', 20)
.attr('height', (d) => d.height * 2)
.attr('fill', (d) => colorScale(d.color))
svg.selectAll('text')
.data(dataset)
.enter()
.append('text')
.attr('x', (d,i)=> i * 30 + 20 + 10)
.attr('y', (d) => 200 - 5 - d.height *2)
.text((d)=> d.height)
.style("font-family", "Arial")
.style("font-size", "14px")
.style("text-anchor", "middle")
return svg.node()
}