 
     legend = d3.select("#legend")
       .append("svg")
-      .attr("width", 500)
+      .attr("width", 80)
       .attr("height", 500)
 
     keys = legend.selectAll("g")

      .attr("y", (d) -> (graphHeight - yScale(d.value) - yPadding))
      .attr("dy", (d) -> if yScale(d.value) < 10 then "-0.3em" else "1.1em")
      .attr("x", (d) -> xScale(d.name) + xScale.rangeBand() / 2)
      .attr("font-size", 5)

  # ---
  # Shows the detail view for a given element

  # names will also be used to color the bars
  colorScale = d3.scale.ordinal()
    .range(["#CD0000","#FF82AB","#FFB5C5","#87CEFF","#B0E2FF",
    "#BFEFFF","#FFDAB9","#FFDEAD","#FFE4C4",
    "#d4d8dd"])

  # yPadding is removed to make room for country names
