   yscale = d3.scale.linear()
   xscale = null
   lodcurve = null
+  lodvarname = "lod"
 
   ## the main function
   chart = (selection) ->
     selection.each (data) ->
       if !(ylim?)
-        ylim = [0, d3.max(data.lod)]
+        ylim = [0, d3.max(data[lodvarname])]
 
       # Select the svg element, if it exists.
       svg = d3.select(this).selectAll("svg").data([data])

    data.lodByChr[chr] = []
    for pos,j in data.pos
      data.posByChr[chr].push(pos) if data.chr[j] == chr
      data.lodByChr[chr].push(data.lod[j]) if data.chr[j] == chr
  data.markers = []
  for marker,i in data.markernames
    if marker != ""
      data.markers.push({name:marker, chr:data.chr[i], pos:data.pos[i], lod:data.lod[i]}) 
  data

# calculate chromosome start/end + scales

        yticks = yscale.ticks(nyticks)

      # reorganize lod,pos by chromosomes
      data = reorgData(data, lodvarname)
      
      # chromosome scales
      data = chrscales(data, width, chrGap)
