chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, 600]);
const margin={left: 50, right: 50, top: 50, bottom: 50};
const attr = 'Med_HH_Income_Percent_of_State_Total_2020'
const y = d3.scaleLinear()
.domain(colorRange).nice()
.range([600 - margin.bottom, margin.top])
const x = d3.scaleLinear()
.domain(d3.extent(county_income_unemployment, d => + (d[attr].replace(/,/g, '') ))).nice()
.range([margin.left, width - margin.right])
const yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y))
const xAxis = g => g
.attr("transform", `translate(0,${600 - margin.bottom})`)
.call(d3.axisBottom(x))
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append("g")
.selectAll("circle")
.data(county_income_unemployment)
.join("circle")
.attr("cx", d => x(+ (d[attr].replace(/,/g, '')) ))
.attr("cy", d => {
const obj = countyByFips.get(+d['FIPS_code'])
if(!obj) return 0
return y(+obj['AIGE'])
})
.attr("r", 4)
.attr('opacity', 0.2)
return svg.node();
}