0

I have an area chart that thanks to some people on Stack Overflow I finally got working. Now I need to add some date to the beginning and the end dates that come from the data.

dataDefect.forEach(function(d) {
  d.projectDate = parseDate(d.projectDate);
  d.severity = +d.severity[0];
});

x.domain(d3.extent(dataDefect, function(d) { return d.projectDate; }));
y.domain([0, d3.max(dataDefect, function(d) { return d.severity + 10; })]);

How do I add 30 days to the date so that I can draw some trends lines that show what might happen 30 days from now?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Jorge
  • 55
  • 8

1 Answers1

0

Found the answer here - D3.js: calculate x-axis time scale for bar graph?

var xExtent = d3.extent(data, function(d) { return d.date; });
var nxExtent = [d3.time.day.offset(xExtent[0], -20), d3.time.day.offset(xExtent[1], 20)];
x.domain(nxExtent);

Thanks!

Community
  • 1
  • 1
Jorge
  • 55
  • 8