{
const height = 600;
const xMargin = 120;
const yMargin = 40;
const svg = d3.create("svg").attr("width",width).attr("height", height);
svg
.append("rect")
.attr("x", 0)
.attr("y", 0)
.attr("width", width)
.attr("height", height)
.attr("fill", "#FFF");
const xScale = d3
.scalePoint()
.domain(data.map((d) => d.year))
.range([xMargin, width - xMargin]);
const yScale = d3.scaleLinear()
.domain([0, d3.max(data, (d) => d.value)]).nice()
.range([height - yMargin.bottom, yMargin.top])
const yAxis = d3
.axisLeft(yScale)
.tickPadding(10)
.tickSizeInner(-width + xMargin * 2)
.tickSizeOuter(-width + xMargin * 2);
const xAxis = (g) => g
.attr('transform', `translate(0,${height - xMargin.bottom})`)
.call(d3.axisBottom(xScale));
svg
.append("g")
.attr("transform", "translate("+ xMargin +" , 0)")
.call(yAxis);
svg
.selectAll(".tick text")
.attr("font-size", 11)
.attr("fill", "black")
.attr("font-family", "menlo");
svg
.selectAll("g line")
.attr("stroke", "black")
.attr("stroke-width", 2);
svg
.selectAll("g path")
.attr("stroke", "black")
.attr("stroke-width", 2);
return svg.node();
}