score:1

Accepted answer

You've not specified your scale ranges correctly:

const x = d3.scaleTime().domain(d3.extent(data.map(d => (d.x)))).range(0, width);

const y = d3.scaleLinear().domain(d3.extent(data.map(d => (d.y)))).range(height, 0);

Scale ranges, as with domains, take an array:

const x = d3.scaleTime().domain(d3.extent(data.map(d => (d.x)))).range([0, width]);

const y = d3.scaleLinear().domain(d3.extent(data.map(d => (d.y)))).range([height, 0]);

Fiddle.


More Query from same tag