           d.y0 = y0
           d.value = y)
 
+    if params.simplify
+      simplify = _.partial simplifyPoints, params.simplify
+    else
+      simplify = _.identity
+
     if params.drawNullAsZero
       transform_value = (v) -> v ? 0
-      filter_scatter_values = _.identity
-      expand_line_values = _.identity
+      filter_scatter_values = simplify
+      expand_line_values = simplify
     else
       # TODO this won't work well with stack
       transform_value = (v) -> v
       filter_scatter_values = (values) ->
-        _.filter values, (d) -> d.value?
-      expand_line_values = expandIsolatedValuesToLineSegments
+        simplify _.filter values, (d) -> d.value?
+      expand_line_values = _.compose simplify, expandIsolatedValuesToLineSegments
 
     value_min = null
     value_max = null

      value_min = Math.round(value_min) - 1
      value_max = Math.round(value_max) + 1
    y.domain [params.yMin ? value_min, params.yMax ? value_max]

    svg = d3.select(container).append('svg')
        .attr('width', width + margin.left + margin.right)

  if segment_length is 1
    result.push previous
  result

simplifyPoints = (minDistance, values) ->
  previous = null
  result = []

  _.each values, (v) ->
    if previous?
      if previous.y? != v.y? # discontinuity
        result.push v
        if v.y?
          previous = v
      else if v.y?
        deltaX = Math.abs v.x - previous.x
        deltaY = Math.abs v.y - previous.y
        if Math.sqrt(deltaX * deltaX + deltaY * deltaY) > minDistance
          previous = v
          result.push v
    else
      previous = v
      result.push v

  result
