{
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox",[0, 0, width, height]);
const yScale = d3.scaleLinear()
.domain([d3.min(desiredData, d => d.minTemp), d3.max(desiredData, d => d.maxTemp)]).nice()
.range([height - margin.bottom, margin.top]);
const xScale = d3.scaleUtc()
.domain(d3.extent(desiredData2, d => d.date))
.range([margin.left, width - margin.right]);
const curvedline = key => {return d3.line()
.curve(d3[curve])
.defined(d => !isNaN(d.date) && !isNaN(d[key]) )
.x(d => xScale(d.date))
.y(d => yScale(d[key]))};
const xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(xScale))
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append("path")
.datum(desiredData2)
.attr("fill", "none")
.attr("stroke", "purple")
.attr("stroke-width", 1.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("d", curvedline('maxTemp'));
svg.selectAll("circle")
.data(desiredData2)
.join("circle")
.attr("cx", d => xScale(d.date))
.attr("cy", d => yScale(d.maxTemp))
.attr("r", 3)
.style("fill", "steelblue");
return svg.node();
}