choropleth = {
const svg = newd3.create("svg")
.attr("viewBox", [45, 20, width, height])
.style("background-color", "#ed914e");
svg.append("g")
.attr("transform", "translate(550,41)")
.append(() =>
legend({
color: color,
title: data.title,
width: 250,
tickFormat: ".1f"
})
);
svg.append("g")
.selectAll("path")
.data(State_Features.features)
.join("path")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 0.5)
.attr("fill", d => color(data.get(d.properties.STATE_NAME)))
.attr("d", newpath)
.append("title")
.text(d => "Total Fire Departments : " + data.get(d.properties.STATE_NAME));
svg.append("g")
svg.append("g")
.selectAll("circle")
.data(filteredPoints.features
.map(d => (d.value = Math.sqrt(d.properties[FDept_ResptoWildfire]), d))
.sort((a, b) => b.value - a.value))
.join("circle")
.attr("transform", d => `translate(${path_points.centroid(d)})`)
.attr("r", d => radius(d.value))
.attr("fill", d => colors(d.value))
.attr("fill-opacity", 0)
.attr("stroke", "black")
.attr("stroke-width", 0.5)
.append("title")
.text(d => `${d.properties[idName]} : ${format(d.properties[FDept_ResptoWildfire])}`);
const symLegendNode = symbolLegend.cloneNode(true);
const symLegendGroup = newd3.select(symLegendNode).select("g");
svg.append("g")
.attr("transform", "translate(160,45)")
.node()
.appendChild(symLegendGroup.node());
return svg.node();
}