chart = {
const width = 900,
height = 1200;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
var projection = d3
.geoMercator()
.fitSize([width, height], coopborder);
var path1 = d3.geoPath().projection(projection);
var path2 = d3.geoPath().projection(projection);
var path3 = d3.geoPath().projection(projection);
var path4 = d3.geoPath().projection(projection);
var path5 = d3.geoPath().projection(projection);
var path6 = d3.geoPath().projection(projection);
var path7 = d3.geoPath().projection(projection);
var g = svg.selectAll('g').attr("id", "paths");
var c = svg.selectAll("circle")
var p = svg.selectAll("polyline")
var t = svg.selectAll("text")
staticLines(path1, coopborder.features,"none",'1','1',"rgb(0,0,0)")
staticLines(path2, qgistoobservable2.features,"none",'1','.25',"rgb(0,0,0)")
function staticLines(path, data, sfill, sOpac, sW, stroke){
g.enter().append("path")
.data(data)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style("fill", sfill)
.style('stroke-opacity',sOpac)
.style("stroke-width", sW)
.style("stroke", stroke)
}
const colorScale = d3.scaleLinear()
.domain([0, 255])
.range(["blue", "red"]);
g.selectAll("path")
.data(qgistoobservable2.features)
.enter()
.append("path")
.attr('class', 'outlines')
.attr("d", path2)
.style("fill", fillColor3)
.style('stroke-opacity', '1')
.style("stroke-width", '0')
.style("stroke", 'none');
function fillColor3(d, i) {
var year = d.properties.Asbestos_8 !== undefined ? 2024 - d.properties.Asbestos_8 : 0;
year = Math.min(255, Math.max(0, Math.pow(year, 1.2)));
const color = colorScale(year);
console.log(`Year: ${year}, Color: ${color}`);
return color;
}
return svg.node();
}