chart3 = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, 480])
const x = d3.scaleBand()
.domain(d3.range(data.length))
.range([margin.left, width - margin.right])
.padding(0.1);
const y = d3.scaleLinear()
.domain([0, d3.max(data, d => d.value)]).nice()
.range([480 - margin.bottom, margin.top]);
const xAxis = g => g
.attr('transform', `translate(0, ${480 - margin.bottom})`)
.call(d3.axisBottom(x).tickFormat(i => data[i].name).tickSizeOuter(0))
const yAxis = g => g
.attr('transform', `translate(${margin.left}, 0)`)
.call(d3.axisLeft(y).tickFormat(d3.format(".0%")))
.call(g => g.select(".domain").remove())
svg.append('g')
.attr('fill', '#8242a8')
.selectAll('rect')
.data(data)
.join('rect')
.attr('x', (d, i) => x(i))
.attr('y', d => y(d.value))
.attr('height', d => y(0) - y(d.value))
.attr('width', x.bandwidth())
svg.append('g')
.call(xAxis);
svg.append('g')
.call(yAxis);
const median = y(d3.median(data, d => d.value));
console.log(median);
svg.append('line')
.attr('x1', 0)
.attr('y1', median - margin.bottom)
.attr('x2', width)
.attr('y2', median - margin.bottom)
.attr('stroke', "deeppink");
return svg.node();
}