Accepted answer

The d3.svg.line component returns a function, but you need to call that function on your data to get a path string. Try something like:

var line = function(data) {
    var generator = d3.svg.line()
        .x(function(d,i) { ... })
        .y(function(d, i) { ...})
    return generator(data);

D3 is trying to assign the generator function itself to the d attribute, coercing it to a string, hence the weird error.

Related Query