biglinechart = {
const svg = d3.create("svg").attr("viewBox", [-80, -40, width + 80, 600]);
svg
.append("text")
.attr(
"transform",
`translate(${measurements.marginLeft +
(line_x.range()[1] - line_x.range()[0]) / 2},${550})`
)
.style("text-anchor", "middle")
.text("Averages throughout 2010-2015");
svg.node().update = game => {
svg.selectAll("*").remove();
const gx = svg
.append("g")
.call(linexAxis)
.attr("transform", `translate(0, ${500 - measurements.marginBottom})`);
const dataWithTime = [...summedLineData];
for (let i = 0; i < dataWithTime.length; i++) {
dataWithTime[i].time = formatutc(dataWithTime[i].yrs);
}
const line_x = d3
.scaleTime()
.domain([
d3.min(dataWithTime, d => d.time),
d3.max(dataWithTime, d => d.time)
])
.range([measurements.marginLeft, width - measurements.marginRight]);
const line_y = d3
.scaleBand()
.domain(dataWithTime.map(d => d[game]))
.range([500 - measurements.marginBottom, measurements.marginTop])
.padding(0.1)
.round(true);
console.log(line_y(dataWithTime[0][game]));
const lineyAxis = (g, scale = line_y) =>
g
.attr("transform", `translate(${measurements.marginLeft},0)`)
.call(d3.axisLeft(scale).ticks(500));
const gy = svg.append("g").call(lineyAxis);
const line = d3
.line()
.x(d => line_x(d.time))
.y(d => line_y(d[game]));
svg
.append("path")
.datum(dataWithTime)
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 0.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("d", line)
.call(transition);
};
return svg.node();
}