     .append("g")
       .attr("transform", "translate(" + margin.left + "," + margin.top + ")")
 
-  spark.append("rect")
+  tseries.append("rect")
     .attr("class", "background")
     .attr("x", 0)
     .attr("y", 0)
     .attr("width", w)
     .attr("height", h)
 
-  spark.append("g")
+  tseries.append("g")
     .attr("class", "y axis")
     .call(yAxis)
 
-  spark.append("g")
+  tseries.append("g")
     .attr("class", "x axis")
     .attr("transform", "translate(0," + h + ")")
     .call(xAxis)
 
 
-  spark
+  tseries
     .append("path")
     .attr("class", "line")
     .attr("d", line)
 
-  spark.append("circle")
+  tseries.append("circle")
     .attr("class","selAttrValue")
-    .attr("cx", x(new Date(""+selectedData.date)))
-    .attr("cy", y(+selectedData.value))
+    .attr("cx", x(data[state.selAttrIndex].date))
+    .attr("cy", y(data[state.selAttrIndex].value))
     .attr("r", 2)
 
 

              date: new Date(""+attr)
              value: +d.data[attr]

          selectedData =
            date: state.selMagnAttr()
            value: d.data[state.selMagnAttr()]

          createTimeSeries(d3.select("#sparkline"), data, selectedData)

          $(tipsy.$tip)
              .css('top', event.pageY-($(tipsy.$tip).outerHeight()/2))

mapProjPath = d3.geo.path().projection(mapProj)


createTimeSeries = (parent, data) ->
  margin = {top: 15, right: 3, bottom: 14, left: 40}
  w = 200 - margin.left - margin.right
  h = 100 - margin.top - margin.bottom
