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"]);
let maxOfNumbers = d3.max(dataset.map(d=>d.height))
svg.selectAll('rect')
.data(dataset)
.enter()
.append('rect')
.attr('x', (d, i) => i * 30 + 35)
.attr('y', d => (maxOfNumbers - d.height) *2 + 30 )
.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 + 45)
.attr('y', d => (maxOfNumbers - d.height) *2 + 28 )
.attr('text-anchor', 'middle')
.style("font", "bold 14px arial")
.text(d=>d.height)
return svg.node()
}