function draw(g, data) {
const colorScale = d3.scaleSequential(d3.interpolateYlGnBu)
.domain([30, -40]);
const arc = d3.arc().startAngle(d => d.x0)
.endAngle(d => d.x1)
.innerRadius(d => d.y0)
.outerRadius(d => d.y1);
const start = arc.startAngle();
const end = arc.endAngle();
const cell = g.selectAll("g.slice")
.data(data)
.join("g")
.attr("class", "slice")
.style("pointer-events", "none");
cell.append('path')
.attr('d', arc)
.attr("fill", d => d.height != 0 ? colorScale(d.height) : 'orange');
const midArc = d3.arc()
.startAngle(d => d.x0 - 90 * Math.PI / 180)
.endAngle(d => d.x1 + 90 * Math.PI / 180)
.innerRadius(d => (d.y0 + d.y1) / 2)
.outerRadius(d => (d.y0 + d.y1) / 2);
cell.append('path')
.attr('id', d => `${d.data.name}`)
.attr('d', midArc)
.style("fill", "none")
.style("stroke", "none");
cell.filter(d => d.height !== 0)
.append("text")
.attr("dy", 2)
.append("textPath").attr("startOffset", "25%").attr("href", d => `#${d.data.name}`)
.text(d => d.data.name)
.style("text-anchor", "middle");
cell.filter(d => d.height === 0)
.append("text")
.text(d => d.data.name)
.style("text-anchor", "start")
.attr("x", 15)
.attr("transform", d =>
`translate(${arc.centroid(d)}) rotate(${(180/Math.PI * (start(d) + end(d))/2 - 90)})`)
.style("pointer-events", "none")
.style("alignment-baseline", "middle");
}