                 subopts.postProcessor = opts.effects[effect]
 
         pivotTable.pivot(input,subopts)
-            
+
     #the very first refresh will actually display the table
     refresh()
 

    totals = {rows:{}, cols:{}, all: opts.aggregator()}
    forEachRow input, opts.derivedAttributes, (row) ->
        if opts.filter(row)
            cA = (row[x] for x in opts.cols)
            c = cA.join("-")
            rA = (row[x] for x in opts.rows)
            r = rA.join("-")
            totals.all.push row
            if r != ""

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

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

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

    effectNames = (x for own x, y of opts.effects)
    if effectNames.length != 0
        effectNames.unshift "None"
        controls = $("<td colspan='2' align='center'>")
        form = $("<form>").addClass("form-inline")
        controls.append form

        form.append $("<strong>").text("Effects:")
        for own 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"
            form.append(radio).append $("<label class='checkbox inline' for='effects_#{x.replace(/\s/g, "")}'>").text(x)
        
        uiTable.append $("<tr>").append controls
    
