mapSelect = {
const width = 980
const height = 600
const svg = d3.select(DOM.svg(width, height))
svg.attr('viewBox', `0 0 ${width} ${height}`)
svg.attr('preserveAspectRatio', 'xMidYMid meet')
svg.style('max-width', '100%').style('height', 'auto')
let StateValue = null;
const g = svg.append('g')
g.append('g')
.attr('class', 'states')
.selectAll('path')
.data(stateData)
.join('path')
.attr('class', 'state')
.attr('d', path)
.attr('id', 'state')
g.append('clipPath')
.attr('id', 'clip-state')
.append('use')
.attr('xlink:href', '#state')
g.append('g')
.attr('class', 'counties')
.selectAll('path')
.data(countiesData)
.join('path')
.attr('clip-path', 'url(#clip-state)')
.attr('class', 'county')
.attr('d', path)
.on('mouseover', function (d) {
this.classList.add('hovered')
tooltip.text(d.properties.name).style('display', '')
})
.on('mousemove', function () {
tooltip
.style('top', (d3.event.pageY - 10) + 'px')
.style('left', (d3.event.pageX + 10) + 'px')
})
.on('mouseout', function () {
this.classList.remove('hovered')
tooltip.style('display', 'none')
})
.on('click', function (d) {
d3.selectAll('.county').classed('selected', false);
this.classList.add('selected');
mutable mapSelectValue = d.id;
});
return svg.node();
}