{
const values = [{ x:1,y: 10 }, { x: 2, y: 5 }, { x: 3, y: 40 }];
const width = 700;
const height = width * 0.75;
const margin = {
left: 40,
top: 20,
right: 10,
bottom: 40
};
const node = DOM.svg(
width + margin.left + margin.right,
height + margin.top + margin.bottom
);
const x = d3
.scaleLinear()
.domain([0, d3.max(values, d => d.x)])
.range([0, width])
.interpolate(d3.interpolateRound);
const y = d3
.scaleLinear()
.domain([0,d3.max(values, d => d.y)])
.range([height, margin.top])
.interpolate(d3.interpolateRound);
const svg = d3.select(node);
const axis = svg
.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`);
axis
.append('g')
.attr('transform', `translate(0, ${height})`)
.call(d3.axisBottom(x));
axis.append('g').call(d3.axisLeft(y));
const line = d3
.line()
.x(d => x(d.x))
.y(d => y(d.y));
axis
.append('path')
.attr('d', line(values))
.attr('fill', 'none')
.attr('stroke', 'red');
return node;
}