'Why isn't the area being draw when there is only one object in an array

Why isn't the area being draw when there is only one object in an array as i have here? When I have more than one then it draws in an area, anybody knows how to fix that ?

const area = d3
      .area()
      .x0(d => x(d.startDate))
      .x1(d => {
        return x(d.endDate));
      })
      .y0(d => y(d.totalValue))
      .y1(height);

svg
      .append('path')
      .data([data.slice(1, 2)])
      .attr('class', 'area')
      .attr('d', area)
      .style('fill', 'white');


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source