                 "padding-right":"5px"
                 
             elem.css("padding": 0,"padding-top": "5px", "text-align": "center").html wrapper
-    
-    barcharter ".pvtVal.row#{i}" for i in [0...numRows]
+
+    barcharter ".pvtVal.row#{i}" for own i in [0...numRows]
     barcharter ".pvtTotal.colTotal"
     
     return this

    
    #cache the input in some useful form
    input = convertToArray(input)
    tblCols = (k for k of input[0])
    tblCols.push c for c of opts.derivedAttributes when (c not in tblCols)
    
    #figure out the cardinality and some stats
    axisValues = {}
    axisValues[x] = {} for x in tblCols

    forEachRow input, opts.derivedAttributes, (row) ->
        for k, v of row
            v ?= "null"
            axisValues[k][v] ?= 0
            axisValues[k][v]++

    #start building the output
    uiTable = $("<table cellpadding='5'>")
    
    #effects controls, if desired

    effectNames = (x for x, y of opts.effects)
    if effectNames.length != 0
        effectNames.unshift "None"
        controls = $("<td colspan='2' align='center'>")
        controls.append $("<strong>").text("Effects:")
        for x in effectNames
            radio = $("<input type='radio' name='effects' id='effects_#{x.replace(/\s/g, "")}'>")
              .css("margin-left":"15px", "margin-right": "5px").val(x)
            radio.attr("checked", "checked") if x=="None"
            controls.append(radio).append $("<label for='effects_#{x.replace(/\s/g, "")}'>").text(x)
        
        uiTable.append $("<tr>").append controls
    


$.fn.heatmap = (scope = "heatmap") ->
    [numRows, numCols] = @data "dimensions"

    colorGen = (color, min, max) ->
        hexGen = switch color
            when "red"   then (hex) -> "ff#{hex}#{hex}"
