chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
const barsP = svg.append('g')
.attr('class', 'bars')
.selectAll("rect")
.data(data)
.attr("transform", `translate(-${width/2} -${height/2 - margin.top})`)
.join("rect")
.attr('class', 'bar')
.attr("fill", "#F0F0F0")
.attr("x", d => x(d.Pmax))
.attr("y", d => y(d.species))
.attr("x", margin.left)
.attr("y", height/4)
.attr("width", d => x(d.Pmax))
.attr("height", y.bandwidth())
svg.append("g")
.call(xAxis)
svg.append('g')
.call(yAxis)
return svg.node()
}