     # this method is called when we first render the chart. It is called if we
     # want a full chart refresh when the user resizes the browser window, too
     draw: =>
-      @margin = 50
-      @width = (@container_node().width()   || 490) - 2 * @margin
-      @height = (@container_node().height() || 402) - 2 * @margin
+      @margin =
+        top: 10
+        left: 45
+        bottom: 10
+        right: 10
+      @width = (@container_node().width()   || 490) - (@margin.left + @margin.right)
+      @height = (@container_node().height() || 452) - (@margin.top + @margin.bottom)
 
       # set up the scaling methods
       @x = d3.scale.linear().domain([0, 600]).range([0, @width])


      @svg = d3.select("#d3_container_sankey").
        append("svg:svg").
        attr("height", @height + 2 * @margin).
        attr("width", @width + 2 * @margin).
        append("svg:g").
        attr("transform", "translate(#{@margin}, #{@margin})")
      @links = @draw_links()
      @nodes = @draw_nodes()
      @axis = @draw_axis()

      d3.selectAll(".link").
        transition().
        duration(200).
        style("opacity", 0.6).
        selectAll(".link_label").
        transition().
        style("opacity", 0)
