chart ={
let w = width;
let h = 752 * w / 1260;
const svg = d3.select(DOM.svg(w, h))
let margin = {top: 30, right: 20, bottom: 35, left: 20};
let xScale = d3.scaleTime()
.range([margin.left, w])
.domain([1990, 2050]);
let yScale = d3.scaleLinear()
.range([h, 0])
.domain([6, 8.5])
let line = d3.line()
.x( d => xScale(d.year))
.y( d =>yScale(d.observation))
const formatYears = d3.timeFormat("%Y");
let xaxis = svg.append("g")
.attr("transform", "translate(0," + (h + 5) + ")")
.attr("class", "x axis")
.call(
d3.axisBottom(xScale)
.tickSizeInner(-h - 5)
.tickFormat(formatYears)
)
.selectAll("text")
.attr('y', 5);
let yaxis = svg.append("g")
.attr("class", "y axis")
.call(
d3.axisLeft(yScale)
.ticks(5)
.tickSizeInner(-w)
)
.selectAll("text")
.style("text-anchor", "start")
.attr('x', 0)
.attr('y', -10);
svg.append("path")
.datum(data)
.attr("d", line)
.attr('class', 'temperature-line')
.call(transition);
return svg.node();
}