           #{@start_year}: #{@main_formatter()(d.values[0].y)}</br>
           #{@end_year}: #{@main_formatter()(d.values[2].y)}
         ")
+
+    display_legend: =>
+      $(@container_selector()).find('.legend').remove()
+
+      legend_columns = if @model.series.length > 6 then 2 else 1
+
+      series = _.filter @model.series.models, (s) ->
+        Math.abs((s.safe_future_value() + s.safe_present_value())) > 1e-7
+
+      @draw_legend
+        svg: @svg
+        series: series
+        width: @width
+        vertical_offset: @series_height + @legend_margin
+        columns: legend_columns
 
     # We need to pass the chart series through the stacking function and the SVG
     # area function. To do this let's format the data as an array. An

    draw: =>
      [@width, @height] = @available_size()

      legend_columns = if @model.series.length > 6 then 2 else 1
      legend_rows = @model.series.length / legend_columns
      legend_margin = 20

      # dimensions of the chart body
      @series_height = @height - legend_margin
      @series_width  = @width - 15

      @svg = @create_svg_container @width, @series_height, @margins

      @draw_legend
        svg: @svg
        series: @model.series.models
        width: @width
        vertical_offset: @series_height + legend_margin
        columns: legend_columns

      # the stack method will filter the data and calculate the offset for every
      # item. The values function tells this method that the values it will

      sorter: -> (series) -> series.reverse()

    can_be_shown_as_table: -> true

    legend_margin: 20

    margins:
      top: 20
