streamGraph = {
const width = 800;
const height = 500;
const marginTop = 20;
const marginRight = 20;
const marginBottom = 30;
const marginLeft = 20;
const color = d3.scaleOrdinal()
.domain(platforms)
.range(d3.schemeSet3.concat(d3.schemeSet1));
const x = d3.scaleLinear()
.domain(d3.extent(gamesOfYear, d => d.Year))
.range([marginLeft, width - marginRight]);
const stack = d3.stack()
.keys(platforms)
.offset(d3.stackOffsetWiggle);
const gamesStack = stack(gamesOfYear);
const y = d3.scaleLinear()
.domain([
d3.min(gamesStack, layer => d3.min(layer, d => d[0])),
d3.max(gamesStack, layer => d3.max(layer, d => d[1]))
])
.range([height - marginBottom, marginTop])
const years = d3.range(
d3.min(gamesOfYear, d => d.Year),
d3.max(gamesOfYear, d => d.Year),
1
);
const area = d3.area()
.x(d => x(d.data.Year))
.y0(d => y(d[0]))
.y1(d => y(d[1]))
.curve(d3.curveCatmullRom);
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", [0, 0, width, height])
.attr("style", "max-width: 100%; height: auto;");
svg.selectAll("path")
.data(gamesStack)
.join("path")
.attr("fill", ({ key }) => color(key))
.attr("d", area)
.append("title")
.text(({ key }) => key);
svg.append("g")
.attr("transform", `translate(0,${height - marginBottom})`)
.call(d3.axisBottom(x).ticks(years.length).tickFormat(d3.format("d")));
svg.append("g")
.attr("transform", `translate(${marginLeft},0)`)
.call(d3.axisLeft(y).ticks(10));
return svg.node();
}