There's an issue where if the data set does not include a zero datapoint, the graphs end up in weird offsets (sometimes going off the edge of the graph). The yScale definition should include an extra zero point to scale properly:
// Update the y-scale.
yScale
.domain(d3.extent((data.concat([['',0]])).map(function(d) { return d[1];} )))
.range([height - margin.top - margin.bottom, 0])
.nice();