function drawChart(data, exponent = 1, height = 600, margin = {top: 30, right: 30, bottom: 30, left: 30}) {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
var x = xScale(data, margin)
var y = yScale(data, exponent, height, margin)
const tooltip = d3.select("body").append("div")
.attr("class", "svg-tooltip")
.style("position", "absolute")
.style("visibility", "hidden")
.text("I'm a circle!");
svg.append("g")
.attr("fill", "steelblue")
.selectAll("rect")
.data(data)
.join("rect")
.attr("x", d => x(d.name))
.attr("y", d => y(d.pct))
.attr("height", d => y(0) - y(d.pct))
.attr("width", x.bandwidth())
.on('mouseover', function(){
d3.select(this)
.transition()
.attr('fill', '#0C9CDF');
})
.on('mouseout', function(){
d3.select(this)
.transition()
.attr('fill', 'steelblue');
})
.append("svg:title")
.text(function(d) { return `total: ${d.name}\ncount: ${d.count}\npct: ${d.pct.toFixed(4)}%`; });
svg.append("g")
.call(xAxis(x, data, height, margin));
svg.append("g")
.call(yAxis(y, margin));
return svg.node();
}