     _.each @typeOrder.get('vehicle_type'), (vtype, idx) =>
       name = vtype.get('name')
 
-      @graph.append('svg:text').
+      graphEl.append('svg:text').
         attr('x', 100 + 50*idx).
         attr('y', 30).
         style('font-size', '14px').
         style('background-color', vehicleTypeColors[idx]).
         text(name)
 
-      @graph.append('svg:rect').
+      graphEl.append('svg:rect').
         attr('id', "legend-#{idx}").
         attr('x', 100 + 50*idx).
         attr('y', 10).

            el.attr('enabled', true)
            d3.selectAll(".vehicle-graph-#{idx}").style('visibility','visible')

    vals = @demand.demands_by_vehicle_type()

    if vals.length > 0

    windowContent = constSpan + table
    @$el.html @vizWindow(elemId: @link.id, content: windowContent)

  renderLegend: (graphEl) ->
    graphEl.append('svg:text').
      attr('x', 10).
      attr('y', 30).
      style('font-size', '20px').
