chart = {
const color = d3.scaleOrdinal().domain([...new Set(data.map(d => d.Delegation_type))]).range(['steelblue', 'darkorange', 'tomato'])
const root = d3.pack()
.size([width, height])
.padding(3)
(d3.hierarchy({children: delegations})
.sum(d => d.lobbyists))
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height);
const leaf = svg
.selectAll("leaf")
.data(root.leaves())
.join('g')
.attr('transform', d => `translate(${d.x},${d.y})`)
leaf.append('circle').attr('r', d => d.r).attr('fill', 'darkgrey')
leaf.append('circle').attr('r', d => d.r / 4).attr('fill', d => color(d.data.type))
.attr('transform', d => `translate(0,${d.r - (d.r / 4)})`)
leaf.append('text').text(d => d.data.lobbyists)
.attr('x', 0).attr('y', 0).attr('fill', '#FFF')
.attr('font-size', d => `${d.r / 2}px`).attr('text-anchor', 'middle')
leaf.append('text').text(d => d.data.lobbyists >= 10 ? d.data.delegation : '')
.attr('x', 0).attr('y', 30).attr('fill', '#FFF').attr('text-anchor', 'middle')
.attr('font-size', d => `${d.r / 6}px`)
return svg.node();
}