chartInteractive = {
const width = 350,
height = 350;
const svg = d3.create("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom);
const g = svg.append("g")
.attr("transform", `translate(${margin.left},${margin.top})`);
g.append("g").call(d3.axisLeft(yScale));
g.append("g")
.attr("transform", `translate(0,${height})`)
.call(d3.axisBottom(xScale));
g.selectAll("circle")
.data(filtered)
.join("circle")
.attr("cx", d => xScale(d[xVar]))
.attr("cy", d => yScale(d[yVar]))
.attr("r", 4)
.attr("fill", d => color2(d.Species))
.attr("opacity", 0.8);
g.append("text")
.attr("x", width / 2)
.attr("y", height + 35)
.attr("text-anchor", "middle")
.text(xVar.replace(/_/g," "));
g.append("text")
.attr("transform", `translate(${-40},${height/2}) rotate(-90)`)
.attr("text-anchor", "middle")
.text(yVar.replace(/_/g," "));
return svg.node();
}