graph = {
const svg = d3
.create('svg')
.attr('width', config.width)
.attr('height', config.height);
const scaleX = d3
.scaleLinear()
.domain([0, column])
.range([0, config.width]);
const getLine = d3
.line()
.x((d, i) => scaleX(i))
.y(d => d);
const updatePathCoord = path =>
path.datum(d => d).attr('transform', (d, i) => trans(0, i * 10));
const updatePathD = path => path.attr('d', getLine);
const enterPath = path =>
path
.append('path')
.attr('fill', 'none')
.attr('stroke', 'black')
.attr('stroke-width', '1px')
.call(updatePathCoord)
.call(updatePathD);
const updatePath = path => path.call(updatePathCoord).call(updatePathD);
function render(noiseHistory) {
svg
.selectAll('path')
.data(noiseHistory, ([id]) => id)
.join(enterPath, updatePath, node => node.remove());
}
return Object.assign(svg.node(), { render });
}