function smooth(d, w) {
    var result = []
    for(var i = 0, l = d.length; i < l; ++i) {
      var mn = Math.max(0, i - 5 * w),
          mx = Math.min(d.length - 1, i + 5 * w),
          s = 0.0
      result[i] = 0.0;
      for(var j = mn; j < mx; ++j) {
        var wd = Math.exp(-0.5 * (i - j) * (i - j) / w / w)
        result[i] += wd * d[j]
        s += wd
      }
      result[i] /= s
    }
    return result
  }
// Smooth some data with a given window size.
Smooth some data with a given window size.
Smooth some data with a given window size .
function smooth(d, w) {
    var result = []
    for(var i = 0, l = d.length; i < l; ++i) {
      var mn = Math.max(0, i - 5 * w),
          mx = Math.min(d.length - 1, i + 5 * w),
          s = 0.0
      result[i] = 0.0;
      for(var j = mn; j < mx; ++j) {
        var wd = Math.exp(-0.5 * (i - j) * (i - j) / w / w)
        result[i] += wd * d[j]
        s += wd
      }
      result[i] /= s
    }
    return result
  }
function smooth ( d , w ) { var result = [ ] for ( var i = 0 , l = d . length ; i < l ; ++ i ) { var mn = Math . max ( 0 , i - 5 * w ) , mx = Math . min ( d . length - 1 , i + 5 * w ) , s = 0.0 result [ i ] = 0.0 ; for ( var j = mn ; j < mx ; ++ j ) { var wd = Math . exp ( - 0.5 * ( i - j ) * ( i - j ) / w / w ) result [ i ] += wd * d [ j ] s += wd } result [ i ] /= s } return result }
Smooth some data with a given window size.
Smooth some data with a given window size .