{
const height = 100;
const xValue = d => d.x;
const yValue = d => d.y;
const xScale = d3
.scaleLinear()
.domain(d3.extent(data.map(xValue)))
.range([0, width]);
const yScale = d3
.scaleLinear()
.domain([-1, 1])
.range([0, height]);
const svg = d3.create('svg').attr('viewBox', `0 0 ${width} ${height}`);
const line = d3
.line()
.x(d => xScale(xValue(d)))
.y(d => yScale(yValue(d)));
svg
.append('path')
.datum(data)
.attr('d', line)
.attr('stroke', 'steelblue')
.attr('fill', 'none');
return svg.node();
}