Accepted answer

It's much easier to do the filtering before you bind the data to the DOM, rather than trying to transform it after you've drawn elements, etc. You can use a standard array filter to remove the undefined data points from your data set:

array.filter( function(d){ // your filter code here } )

In context:

    .data( ds.filter(function(d) {return d.param1 != undefined}) )

The same principle applies for the area plot:

    .datum( ds.filter(function(d){ return d.param2 != undefined }) )

Data is much easier to manipulate before it is bound to the DOM, so do as much cleaning and filtering as you can beforehand.

Related Query

More Query from same tag