function render(div) {
const selection = d3.select(div).select('svg');
const xExtent = d3.extent(penguins, d => d[xProperty]);
const x = d3.scaleLinear().domain(xExtent).range([30,width-30]);
const xAxis = d3.axisBottom(x);
selection.select("#xAxis")
.call(xAxis);
const yExtent = d3.extent(penguins, d => d[yProperty]);
const y = d3.scaleLinear().domain(yExtent).range([30,height-30]);
const yAxis = d3.axisLeft(y);
selection.select("#yAxis")
.call(yAxis);
const colorScale = d3.scaleOrdinal(d3.schemeCategory10);
selection.selectAll('circle')
.data(penguins.filter(d => d[xProperty] !== "NA"))
.join('circle')
.attr('r', 15)
.style('opacity', 0.2)
.style('fill', d => colorScale(d.species))
.transition()
.duration(3000)
.attr('cx', d => x(d[xProperty]) )
.attr('cy', d => y(d[yProperty]) );
const legend = swatches({color: colorScale});
d3.select(div).select("#legend")
.append(() => legend);
}