diff --git a/dist/pivot.js b/dist/pivot.js index 98cd4585..8786443d 100644 --- a/dist/pivot.js +++ b/dist/pivot.js @@ -351,20 +351,20 @@ }; })(aggregatorTemplates); renderers = { - "Table": function(pvtData, opts) { - return pivotTableRenderer(pvtData, opts); + "Table": function(data, opts) { + return pivotTableRenderer(data, opts); }, - "Table Barchart": function(pvtData, opts) { - return $(pivotTableRenderer(pvtData, opts)).barchart(); + "Table Barchart": function(data, opts) { + return $(pivotTableRenderer(data, opts)).barchart(); }, - "Heatmap": function(pvtData, opts) { - return $(pivotTableRenderer(pvtData, opts)).heatmap(); + "Heatmap": function(data, opts) { + return $(pivotTableRenderer(data, opts)).heatmap("heatmap", opts); }, - "Row Heatmap": function(pvtData, opts) { - return $(pivotTableRenderer(pvtData, opts)).heatmap("rowheatmap"); + "Row Heatmap": function(data, opts) { + return $(pivotTableRenderer(data, opts)).heatmap("rowheatmap", opts); }, - "Col Heatmap": function(pvtData, opts) { - return $(pivotTableRenderer(pvtData, opts)).heatmap("colheatmap"); + "Col Heatmap": function(data, opts) { + return $(pivotTableRenderer(data, opts)).heatmap("colheatmap", opts); } }; locales = { @@ -1367,47 +1367,29 @@ /* Heatmap post-processing */ - $.fn.heatmap = function(scope, color) { - var colorGen, heatmapper, i, j, l, n, numCols, numRows, ref, ref1; + $.fn.heatmap = function(scope, opts) { + var colorScaleGenerator, heatmapper, i, j, l, n, numCols, numRows, ref, ref1, ref2; if (scope == null) { scope = "heatmap"; } - if (color == null) { - color = "red"; - } numRows = this.data("numrows"); numCols = this.data("numcols"); - colorGen = function(color, min, max) { - var hexGen; - hexGen = (function() { - switch (color) { - case "red": - return function(hex) { - return "ff" + hex + hex; - }; - case "green": - return function(hex) { - return hex + "ff" + hex; - }; - case "blue": - return function(hex) { - return "" + hex + hex + "ff"; - }; - } - })(); - return function(x) { - var hex, intensity; - intensity = 255 - Math.round(255 * (x - min) / (max - min)); - hex = intensity.toString(16).split(".")[0]; - if (hex.length === 1) { - hex = 0 + hex; - } - return hexGen(hex); + colorScaleGenerator = opts != null ? (ref = opts.heatmap) != null ? ref.colorScaleGenerator : void 0 : void 0; + if (colorScaleGenerator == null) { + colorScaleGenerator = function(values) { + var max, min; + min = Math.min.apply(Math, values); + max = Math.max.apply(Math, values); + return function(x) { + var nonRed; + nonRed = 255 - Math.round(255 * (x - min) / (max - min)); + return "rgb(255," + nonRed + "," + nonRed + ")"; + }; }; - }; + } heatmapper = (function(_this) { - return function(scope, color) { - var colorFor, forEachCell, values; + return function(scope) { + var colorScale, forEachCell, values; forEachCell = function(f) { return _this.find(scope).each(function() { var x; @@ -1421,28 +1403,28 @@ forEachCell(function(x) { return values.push(x); }); - colorFor = colorGen(color, Math.min.apply(Math, values), Math.max.apply(Math, values)); + colorScale = colorScaleGenerator(values); return forEachCell(function(x, elem) { - return elem.css("background-color", "#" + colorFor(x)); + return elem.css("background-color", colorScale(x)); }); }; })(this); switch (scope) { case "heatmap": - heatmapper(".pvtVal", color); + heatmapper(".pvtVal"); break; case "rowheatmap": - for (i = l = 0, ref = numRows; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) { - heatmapper(".pvtVal.row" + i, color); + for (i = l = 0, ref1 = numRows; 0 <= ref1 ? l < ref1 : l > ref1; i = 0 <= ref1 ? ++l : --l) { + heatmapper(".pvtVal.row" + i); } break; case "colheatmap": - for (j = n = 0, ref1 = numCols; 0 <= ref1 ? n < ref1 : n > ref1; j = 0 <= ref1 ? ++n : --n) { - heatmapper(".pvtVal.col" + j, color); + for (j = n = 0, ref2 = numCols; 0 <= ref2 ? n < ref2 : n > ref2; j = 0 <= ref2 ? ++n : --n) { + heatmapper(".pvtVal.col" + j); } } - heatmapper(".pvtTotal.rowTotal", color); - heatmapper(".pvtTotal.colTotal", color); + heatmapper(".pvtTotal.rowTotal"); + heatmapper(".pvtTotal.colTotal"); return this; }; diff --git a/dist/pivot.js.map b/dist/pivot.js.map index 83dd79d7..ba6ceb5f 100644 --- a/dist/pivot.js.map +++ b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AP,CAAA,GAAY,GAJtB;cAKA,kBAAA,EAAoB,MALpB;aADW,CAAf;YAOA,OAAO,CAAC,MAAR,CAAe,CAAA,CAAE,OAAF,CAAU,CAAC,IAAX,CAAgB,IAAhB,CAAqB,CAAC,GAAtB,CACX;cAAA,UAAA,EAAW,UAAX;cACA,cAAA,EAAe,KADf;cAEA,eAAA,EAAgB,KAFhB;aADW,CAAf;mBAKA,IAAI,CAAC,GAAL,CAAS;cAAA,SAAA,EAAW,CAAX;cAAa,aAAA,EAAe,KAA5B;cAAmC,YAAA,EAAc,QAAjD;aAAT,CAAmE,CAAC,IAApE,CAAyE,OAAzE;UAjBQ,CAAZ;QAVS;MAAA,CAAA,CAAA,CAAA,IAAA;AA6Bb,WAAsC,gFAAtC;QAAA,UAAA,CAAW,aAAA,GAAc,CAAzB;AAAA;MACA,UAAA,CAAW,oBAAX;AAEA,aAAO;IApCM;EA74BN,CAAf;AATA","file":"pivot.js","sourceRoot":"/source/","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n \ncallWithJQuery ($) ->\n\n ###\n Utilities\n ###\n\n addSeparators = (nStr, thousandsSep, decimalSep) ->\n nStr += ''\n x = nStr.split('.')\n x1 = x[0]\n x2 = if x.length > 1 then decimalSep + x[1] else ''\n rgx = /(\\d+)(\\d{3})/\n x1 = x1.replace(rgx, '$1' + thousandsSep + '$2') while rgx.test(x1)\n return x1 + x2\n\n numberFormat = (opts) ->\n defaults = \n digitsAfterDecimal: 2, scaler: 1, \n thousandsSep: \",\", decimalSep: \".\"\n prefix: \"\", suffix: \"\"\n showZero: false\n opts = $.extend defaults, opts\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\n return \"\" if x == 0 and not opts.showZero\n result = addSeparators (opts.scaler*x).toFixed(opts.digitsAfterDecimal), opts.thousandsSep, opts.decimalSep\n return \"\"+opts.prefix+result+opts.suffix\n\n #aggregator templates default to US number formatting but this is overrideable\n usFmt = numberFormat()\n usFmtInt = numberFormat(digitsAfterDecimal: 0)\n usFmtPct = numberFormat(digitsAfterDecimal:1, scaler: 100, suffix: \"%\")\n\n aggregatorTemplates =\n count: (formatter=usFmtInt) -> () -> (data, rowKey, colKey) ->\n count: 0\n push: -> @count++\n value: -> @count\n format: formatter\n\n countUnique: (formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> @uniq.length\n format: formatter\n numInputs: if attr? then 0 else 1\n\n listUnique: (sep) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> @uniq.join sep\n format: (x) -> x\n numInputs: if attr? then 0 else 1\n\n sum: (formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n sum: 0\n push: (record) -> @sum += parseFloat(record[attr]) if not isNaN parseFloat(record[attr])\n value: -> @sum\n format: formatter\n numInputs: if attr? then 0 else 1\n\n min: (formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n push: (record) ->\n x = parseFloat(record[attr])\n if not isNaN x then @val = Math.min(x, @val ? x)\n value: -> @val\n format: formatter\n numInputs: if attr? then 0 else 1\n\n max: (formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n push: (record) -> \n x = parseFloat(record[attr])\n if not isNaN x then @val = Math.max(x, @val ? x)\n value: -> @val\n format: formatter\n numInputs: if attr? then 0 else 1\n\n average: (formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n sum: 0\n len: 0\n push: (record) ->\n if not isNaN parseFloat(record[attr])\n @sum += parseFloat(record[attr])\n @len++\n value: -> @sum/@len\n format: formatter\n numInputs: if attr? then 0 else 1\n\n sumOverSum: (formatter=usFmt) -> ([num, denom]) -> (data, rowKey, colKey) ->\n sumNum: 0\n sumDenom: 0\n push: (record) ->\n @sumNum += parseFloat(record[num]) if not isNaN parseFloat(record[num])\n @sumDenom += parseFloat(record[denom]) if not isNaN parseFloat(record[denom])\n value: -> @sumNum/@sumDenom\n format: formatter\n numInputs: if num? and denom? then 0 else 2\n\n sumOverSumBound80: (upper=true, formatter=usFmt) -> ([num, denom]) -> (data, rowKey, colKey) ->\n sumNum: 0\n sumDenom: 0\n push: (record) ->\n @sumNum += parseFloat(record[num]) if not isNaN parseFloat(record[num])\n @sumDenom += parseFloat(record[denom]) if not isNaN parseFloat(record[denom])\n value: ->\n sign = if upper then 1 else -1\n (0.821187207574908/@sumDenom + @sumNum/@sumDenom + 1.2815515655446004*sign*\n Math.sqrt(0.410593603787454/ (@sumDenom*@sumDenom) + (@sumNum*(1 - @sumNum/ @sumDenom))/ (@sumDenom*@sumDenom)))/\n (1 + 1.642374415149816/@sumDenom)\n format: formatter\n numInputs: if num? and denom? then 0 else 2\n\n fractionOf: (wrapped, type=\"total\", formatter=usFmtPct) -> (x...) -> (data, rowKey, colKey) ->\n selector: {total:[[],[]],row:[rowKey,[]],col:[[],colKey]}[type]\n inner: wrapped(x...)(data, rowKey, colKey)\n push: (record) -> @inner.push record\n format: formatter\n value: -> @inner.value() / data.getAggregator(@selector...).inner.value()\n numInputs: wrapped(x...)().numInputs\n\n #default aggregators & renderers use US naming and number formatting\n aggregators = do (tpl = aggregatorTemplates) -> \n \"Count\": tpl.count(usFmtInt)\n \"Count Unique Values\": tpl.countUnique(usFmtInt)\n \"List Unique Values\": tpl.listUnique(\", \")\n \"Sum\": tpl.sum(usFmt)\n \"Integer Sum\": tpl.sum(usFmtInt)\n \"Average\": tpl.average(usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"Sum over Sum\": tpl.sumOverSum(usFmt)\n \"80% Upper Bound\": tpl.sumOverSumBound80(true, usFmt)\n \"80% Lower Bound\": tpl.sumOverSumBound80(false, usFmt)\n \"Sum as Fraction of Total\": tpl.fractionOf(tpl.sum(), \"total\", usFmtPct)\n \"Sum as Fraction of Rows\": tpl.fractionOf(tpl.sum(), \"row\", usFmtPct)\n \"Sum as Fraction of Columns\": tpl.fractionOf(tpl.sum(), \"col\", usFmtPct)\n \"Count as Fraction of Total\": tpl.fractionOf(tpl.count(), \"total\", usFmtPct)\n \"Count as Fraction of Rows\": tpl.fractionOf(tpl.count(), \"row\", usFmtPct)\n \"Count as Fraction of Columns\": tpl.fractionOf(tpl.count(), \"col\", usFmtPct)\n\n renderers =\n \"Table\": (pvtData, opts) -> pivotTableRenderer(pvtData, opts)\n \"Table Barchart\": (pvtData, opts) -> $(pivotTableRenderer(pvtData, opts)).barchart()\n \"Heatmap\": (pvtData, opts) -> $(pivotTableRenderer(pvtData, opts)).heatmap()\n \"Row Heatmap\": (pvtData, opts) -> $(pivotTableRenderer(pvtData, opts)).heatmap(\"rowheatmap\")\n \"Col Heatmap\": (pvtData, opts) -> $(pivotTableRenderer(pvtData, opts)).heatmap(\"colheatmap\")\n\n locales = \n en: \n aggregators: aggregators\n renderers: renderers\n localeStrings: \n renderError: \"An error occurred rendering the PivotTable results.\"\n computeError: \"An error occurred computing the PivotTable results.\"\n uiRenderError: \"An error occurred rendering the PivotTable UI.\"\n selectAll: \"Select All\"\n selectNone: \"Select None\"\n tooMany: \"(too many to list)\"\n filterResults: \"Filter results\"\n totals: \"Totals\" #for table renderer\n vs: \"vs\" #for gchart renderer\n by: \"by\" #for gchart renderer\n\n #dateFormat deriver l10n requires month and day names to be passed in directly\n mthNamesEn = [\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"]\n dayNamesEn = [\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"]\n zeroPad = (number) -> (\"0\"+number).substr(-2,2)\n\n derivers =\n bin: (col, binWidth) -> (record) -> record[col] - record[col] % binWidth\n dateFormat: (col, formatString, utcOutput=false, mthNames=mthNamesEn, dayNames=dayNamesEn) ->\n utc = if utcOutput then \"UTC\" else \"\"\n (record) -> #thanks http://stackoverflow.com/a/12213072/112871\n date = new Date(Date.parse(record[col]))\n if isNaN(date) then return \"\"\n formatString.replace /%(.)/g, (m, p) ->\n switch p\n when \"y\" then date[\"get#{utc}FullYear\"]()\n when \"m\" then zeroPad(date[\"get#{utc}Month\"]()+1)\n when \"n\" then mthNames[date[\"get#{utc}Month\"]()]\n when \"d\" then zeroPad(date[\"get#{utc}Date\"]())\n when \"w\" then dayNames[date[\"get#{utc}Day\"]()]\n when \"x\" then date[\"get#{utc}Day\"]()\n when \"H\" then zeroPad(date[\"get#{utc}Hours\"]())\n when \"M\" then zeroPad(date[\"get#{utc}Minutes\"]())\n when \"S\" then zeroPad(date[\"get#{utc}Seconds\"]())\n else \"%\" + p\n\n naturalSort = (as, bs) => #thanks http://stackoverflow.com/a/4373421/112871\n rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n if typeof as is \"number\" or typeof bs is \"number\"\n return 1 if isNaN(as)\n return -1 if isNaN(bs)\n return as - bs\n a = String(as).toLowerCase()\n b = String(bs).toLowerCase()\n return 0 if a is b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n a = a.match(rx)\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 isnt b1\n if rd.test(a1) and rd.test(b1)\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n a.length - b.length\n\n sortAs = (order) -> \n mapping = {}\n for i, x of order\n mapping[x] = i\n (a, b) ->\n if mapping[a]? and mapping[b]?\n return mapping[a] - mapping[b]\n else if mapping[a]?\n return -1\n else if mapping[b]?\n return 1\n else\n return naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n sort = sorters(attr)\n if $.isFunction(sort)\n return sort \n else\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts) ->\n @aggregator = opts.aggregator\n @aggregatorName = opts.aggregatorName\n @colAttrs = opts.cols\n @rowAttrs = opts.rows\n @valAttrs = opts.vals\n @sorters = opts.sorters\n @tree = {}\n @rowKeys = []\n @colKeys = []\n @rowTotals = {}\n @colTotals = {}\n @allTotal = @aggregator(this, [], [])\n @sorted = false\n\n # iterate through input, accumulating data for cells\n PivotData.forEachRecord input, opts.derivedAttributes, (record) =>\n @processRecord(record) if opts.filter(record)\n\n #can handle arrays or jQuery selections of tables\n @forEachRecord = (input, derivedAttributes, f) ->\n if $.isEmptyObject derivedAttributes\n addRecord = f\n else\n addRecord = (record) -> \n record[k] = v(record) ? record[k] for k, v of derivedAttributes\n f(record)\n\n #if it's a function, have it call us back\n if $.isFunction(input)\n input(addRecord)\n else if $.isArray(input)\n if $.isArray(input[0]) #array of arrays\n for own i, compactRecord of input when i > 0\n record = {}\n record[k] = compactRecord[j] for own j, k of input[0]\n addRecord(record)\n else #array of objects\n addRecord(record) for record in input\n else if input instanceof jQuery\n tblCols = []\n $(\"thead > tr > th\", input).each (i) -> tblCols.push $(this).text()\n $(\"tbody > tr\", input).each (i) ->\n record = {}\n $(\"td\", this).each (j) -> record[tblCols[j]] = $(this).text()\n addRecord(record)\n else\n throw new Error(\"unknown input format\")\n\n #converts to [{attr:val, attr:val},{attr:val, attr:val}] using method above\n @convertToArray = (input) ->\n result = []\n PivotData.forEachRecord input, {}, (record) -> result.push record\n return result\n\n arrSort: (attrs) => \n sortersArr = (getSort(@sorters, a) for a in attrs)\n (a,b) -> \n for own i, sorter of sortersArr\n comparison = sorter(a[i], b[i])\n return comparison if comparison != 0\n return 0\n\n sortKeys: () =>\n if not @sorted\n @sorted = true\n @rowKeys.sort @arrSort(@rowAttrs)\n @colKeys.sort @arrSort(@colAttrs)\n\n getColKeys: () =>\n @sortKeys()\n return @colKeys\n\n getRowKeys: () =>\n @sortKeys()\n return @rowKeys\n\n processRecord: (record) -> #this code is called in a tight loop\n colKey = []\n rowKey = []\n colKey.push record[x] ? \"null\" for x in @colAttrs \n rowKey.push record[x] ? \"null\" for x in @rowAttrs\n flatRowKey = rowKey.join(String.fromCharCode(0))\n flatColKey = colKey.join(String.fromCharCode(0))\n\n @allTotal.push record\n\n if rowKey.length != 0\n if not @rowTotals[flatRowKey]\n @rowKeys.push rowKey\n @rowTotals[flatRowKey] = @aggregator(this, rowKey, [])\n @rowTotals[flatRowKey].push record\n\n if colKey.length != 0\n if not @colTotals[flatColKey]\n @colKeys.push colKey\n @colTotals[flatColKey] = @aggregator(this, [], colKey)\n @colTotals[flatColKey].push record\n\n if colKey.length != 0 and rowKey.length != 0\n if not @tree[flatRowKey]\n @tree[flatRowKey] = {}\n if not @tree[flatRowKey][flatColKey]\n @tree[flatRowKey][flatColKey] = @aggregator(this, rowKey, colKey)\n @tree[flatRowKey][flatColKey].push record\n\n getAggregator: (rowKey, colKey) =>\n flatRowKey = rowKey.join(String.fromCharCode(0))\n flatColKey = colKey.join(String.fromCharCode(0))\n if rowKey.length == 0 and colKey.length == 0\n agg = @allTotal\n else if rowKey.length == 0\n agg = @colTotals[flatColKey]\n else if colKey.length == 0\n agg = @rowTotals[flatRowKey]\n else\n agg = @tree[flatRowKey][flatColKey]\n return agg ? {value: (-> null), format: -> \"\"}\n\n #expose these to the outside world\n $.pivotUtilities = {aggregatorTemplates, aggregators, renderers, derivers, locales,\n naturalSort, numberFormat, sortAs, PivotData}\n\n ###\n Default Renderer for hierarchical table layout\n ###\n\n pivotTableRenderer = (pivotData, opts) ->\n\n defaults =\n localeStrings:\n totals: \"Totals\"\n\n opts = $.extend defaults, opts\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n #now actually build the output\n result = document.createElement(\"table\")\n result.className = \"pvtTable\"\n\n #helper function for setting row/col-span in pivotTableRenderer\n spanSize = (arr, i, j) ->\n if i != 0\n noDraw = true\n for x in [0..j]\n if arr[i-1][x] != arr[i][x]\n noDraw = false\n if noDraw\n return -1 #do not draw cell\n len = 0\n while i+len < arr.length\n stop = false\n for x in [0..j]\n stop = true if arr[i][x] != arr[i+len][x]\n break if stop\n len++\n return len\n\n #the first few rows are for col headers\n for own j, c of colAttrs\n tr = document.createElement(\"tr\")\n if parseInt(j) == 0 and rowAttrs.length != 0\n th = document.createElement(\"th\")\n th.setAttribute(\"colspan\", rowAttrs.length)\n th.setAttribute(\"rowspan\", colAttrs.length)\n tr.appendChild th\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = c\n tr.appendChild th\n for own i, colKey of colKeys\n x = spanSize(colKeys, parseInt(i), parseInt(j))\n if x != -1\n th = document.createElement(\"th\")\n th.className = \"pvtColLabel\"\n th.textContent = colKey[j]\n th.setAttribute(\"colspan\", x)\n if parseInt(j) == colAttrs.length-1 and rowAttrs.length != 0\n th.setAttribute(\"rowspan\", 2)\n tr.appendChild th\n if parseInt(j) == 0\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"rowspan\", colAttrs.length + (if rowAttrs.length ==0 then 0 else 1))\n tr.appendChild th\n result.appendChild tr\n\n #then a row for row header headers\n if rowAttrs.length !=0\n tr = document.createElement(\"tr\")\n for own i, r of rowAttrs\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = r\n tr.appendChild th \n th = document.createElement(\"th\")\n if colAttrs.length ==0\n th.className = \"pvtTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n tr.appendChild th\n result.appendChild tr\n\n #now the actual data rows, with their row headers and totals\n for own i, rowKey of rowKeys\n tr = document.createElement(\"tr\")\n for own j, txt of rowKey\n x = spanSize(rowKeys, parseInt(i), parseInt(j))\n if x != -1\n th = document.createElement(\"th\")\n th.className = \"pvtRowLabel\"\n th.textContent = txt\n th.setAttribute(\"rowspan\", x)\n if parseInt(j) == rowAttrs.length-1 and colAttrs.length !=0\n th.setAttribute(\"colspan\",2)\n tr.appendChild th\n for own j, colKey of colKeys #this is the tight loop\n aggregator = pivotData.getAggregator(rowKey, colKey)\n val = aggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtVal row#{i} col#{j}\"\n td.textContent = aggregator.format(val)\n td.setAttribute(\"data-value\", val)\n tr.appendChild td\n\n totalAggregator = pivotData.getAggregator(rowKey, [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal rowTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n result.appendChild tr\n\n #finally, the row for col totals, and a grand total\n tr = document.createElement(\"tr\")\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"colspan\", rowAttrs.length + (if colAttrs.length == 0 then 0 else 1))\n tr.appendChild th\n for own j, colKey of colKeys\n totalAggregator = pivotData.getAggregator([], colKey)\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal colTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n td.setAttribute(\"data-for\", \"col\"+j)\n tr.appendChild td\n totalAggregator = pivotData.getAggregator([], [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtGrandTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n tr.appendChild td\n result.appendChild tr\n\n #squirrel this away for later\n result.setAttribute(\"data-numrows\", rowKeys.length)\n result.setAttribute(\"data-numcols\", colKeys.length)\n\n return result\n\n ###\n Pivot Table core: create PivotData object and call Renderer on it\n ###\n\n $.fn.pivot = (input, opts) ->\n defaults =\n cols : []\n rows: []\n vals: []\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: -> \n derivedAttributes: {},\n renderer: pivotTableRenderer\n rendererOptions: null\n localeStrings: locales.en.localeStrings\n\n opts = $.extend defaults, opts\n\n result = null\n try\n pivotData = new PivotData(input, opts)\n try\n result = opts.renderer(pivotData, opts.rendererOptions)\n catch e\n console.error(e.stack) if console?\n result = $(\"\").html opts.localeStrings.renderError\n catch e\n console.error(e.stack) if console?\n result = $(\"\").html opts.localeStrings.computeError\n \n x = this[0]\n x.removeChild(x.lastChild) while x.hasChildNodes()\n return @append result\n\n\n ###\n Pivot Table UI: calls Pivot Table core above with options set by user\n ###\n\n $.fn.pivotUI = (input, inputOpts, overwrite = false, locale=\"en\") ->\n if not locales[locale]?\n locale = \"en\"\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 200\n cols: [], rows: [], vals: []\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n rendererOptions: localeStrings: locales[locale].localeStrings\n onRefresh: null\n filter: -> true\n sorters: -> \n localeStrings: locales[locale].localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend defaults, inputOpts\n else\n opts = existingOpts\n\n try\n #cache the input in some useful form\n input = PivotData.convertToArray(input)\n tblCols = (k for own k of input[0])\n tblCols.push c for own c of opts.derivedAttributes when (c not in tblCols)\n\n #figure out the cardinality and some stats\n axisValues = {}\n axisValues[x] = {} for x in tblCols\n\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n for own k, v of record when opts.filter(record)\n v ?= \"null\"\n axisValues[k][v] ?= 0\n axisValues[k][v]++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(colList)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (c for c in tblCols when c not in opts.hiddenAttributes)\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownAttributes\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n colList.addClass('pvtVertList')\n else\n colList.addClass('pvtHorizList')\n\n for own i, c of shownAttributes\n do (c) ->\n keys = (k for k of axisValues[c])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").text(\"#{c} (#{keys.length})\")\n if keys.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n btns = $(\"

\").appendTo(valueList)\n btns.append $(\"

\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend colList\n else\n uiTable.prepend $(\"
\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(colList)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (c for c in tblCols when c not in opts.hiddenAttributes)\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownAttributes\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n colList.addClass('pvtVertList')\n else\n colList.addClass('pvtHorizList')\n\n for own i, c of shownAttributes\n do (c) ->\n keys = (k for k of axisValues[c])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").text(\"#{c} (#{keys.length})\")\n if keys.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n btns = $(\"

\").appendTo(valueList)\n btns.append $(\"

\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend colList\n else\n uiTable.prepend $(\"
",{"class":"pvtUi"}).attr("cellpadding",5),P=t("").appendTo(W),l=t("").appendTo(W),Q.append(t("").append(P).append(m)),this.html(W),U=I.cols,R=0,E=U.length;E>R;R++)G=U[R],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(G,J)));for(V=I.rows,M=0,D=V.length;D>M;M++)G=V[M],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(G,J)));null!=I.aggregatorName&&this.find(".pvtAggregator").val(I.aggregatorName),null!=I.rendererName&&this.find(".pvtRenderer").val(I.rendererName),x=!0,H=function(r){return function(){var a,o,i,s,u,c,p,h,d,g,m,v,b,A,C;if(v={derivedAttributes:I.derivedAttributes,localeStrings:I.localeStrings,rendererOptions:I.rendererOptions,sorters:I.sorters,cols:[],rows:[]},c=null!=(d=I.aggregators[l.val()]([])().numInputs)?d:0,C=[],r.find(".pvtRows li span.pvtAttr").each(function(){return v.rows.push(t(this).data("attrName"))}),r.find(".pvtCols li span.pvtAttr").each(function(){return v.cols.push(t(this).data("attrName"))}),r.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===c?t(this).remove():(c--,""!==t(this).val()?C.push(t(this).val()):void 0)}),0!==c)for(h=r.find(".pvtVals"),G=m=0,g=c;g>=0?g>m:m>g;G=g>=0?++m:--m){for(u=t("
"),B=t("").addClass("pvtAxisContainer pvtUnused"),J=function(){var t,n,r;for(r=[],n=0,t=_.length;t>n;n++)g=_[n],e.call(I.hiddenAttributes,g)<0&&r.push(g);return r}(),$=!1,Z="auto"===I.unusedAttrsVertical?120:parseInt(I.unusedAttrsVertical),!isNaN(Z)){for(c=0,k=0,F=J.length;F>k;k++)u=J[k],c+=u.length;$=c>Z}I.unusedAttrsVertical===!0||$?m.addClass("pvtVertList"):m.addClass("pvtHorizList"),y=function(n){var r,a,o,i,s,u,l,c,h,f,g,v,b,A,C;if(l=function(){var t;t=[];for(N in d[n])t.push(N);return t}(),u=!1,C=t("
").addClass("pvtFilterBox").hide(),C.append(t("

").text(n+" ("+l.length+")")),l.length>I.menuLimit)C.append(t("

").html(I.localeStrings.tooMany));else for(a=t("

").appendTo(C),a.append(t("

").addClass("pvtVals").appendTo(z).append(l).append(t("
")),t("
").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(z),Q=t("
").addClass("pvtAxisContainer pvtRows").attr("valign","top")),O=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(Q),I.unusedAttrsVertical===!0||$?(W.find("tr:nth-child(1)").prepend(P),W.find("tr:nth-child(2)").prepend(m)):W.prepend(t("
",{"class":"pvtUi"}).attr("cellpadding",5),P=t("").appendTo(Q),l=t("").appendTo(Q),G.append(t("").append(P).append(g)),this.html(Q),U=I.cols,R=0,E=U.length;E>R;R++)$=U[R],this.find(".pvtCols").append(this.find(".axis_"+t.inArray($,J)));for(V=I.rows,M=0,D=V.length;D>M;M++)$=V[M],this.find(".pvtRows").append(this.find(".axis_"+t.inArray($,J)));null!=I.aggregatorName&&this.find(".pvtAggregator").val(I.aggregatorName),null!=I.rendererName&&this.find(".pvtRenderer").val(I.rendererName),x=!0,H=function(r){return function(){var a,o,i,s,u,c,p,h,d,m,g,v,b,A,C;if(v={derivedAttributes:I.derivedAttributes,localeStrings:I.localeStrings,rendererOptions:I.rendererOptions,sorters:I.sorters,cols:[],rows:[]},c=null!=(d=I.aggregators[l.val()]([])().numInputs)?d:0,C=[],r.find(".pvtRows li span.pvtAttr").each(function(){return v.rows.push(t(this).data("attrName"))}),r.find(".pvtCols li span.pvtAttr").each(function(){return v.cols.push(t(this).data("attrName"))}),r.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===c?t(this).remove():(c--,""!==t(this).val()?C.push(t(this).val()):void 0)}),0!==c)for(h=r.find(".pvtVals"),$=g=0,m=c;m>=0?m>g:g>m;$=m>=0?++g:--g){for(u=t("
"),B=t("").addClass("pvtAxisContainer pvtUnused"),J=function(){var t,n,r;for(r=[],n=0,t=_.length;t>n;n++)m=_[n],e.call(I.hiddenAttributes,m)<0&&r.push(m);return r}(),Z=!1,W="auto"===I.unusedAttrsVertical?120:parseInt(I.unusedAttrsVertical),!isNaN(W)){for(c=0,k=0,F=J.length;F>k;k++)u=J[k],c+=u.length;Z=c>W}I.unusedAttrsVertical===!0||Z?g.addClass("pvtVertList"):g.addClass("pvtHorizList"),y=function(n){var r,a,o,i,s,u,l,c,h,f,m,v,b,A,C;if(l=function(){var t;t=[];for(N in d[n])t.push(N);return t}(),u=!1,C=t("
").addClass("pvtFilterBox").hide(),C.append(t("

").text(n+" ("+l.length+")")),l.length>I.menuLimit)C.append(t("

").html(I.localeStrings.tooMany));else for(a=t("

").appendTo(C),a.append(t("

").addClass("pvtVals").appendTo(z).append(l).append(t("
")),t("
").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(z),G=t("
").addClass("pvtAxisContainer pvtRows").attr("valign","top")),O=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(G),I.unusedAttrsVertical===!0||Z?(Q.find("tr:nth-child(1)").prepend(P),Q.find("tr:nth-child(2)").prepend(g)):Q.prepend(t("
\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(colList)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (c for c in tblCols when c not in opts.hiddenAttributes)\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownAttributes\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n colList.addClass('pvtVertList')\n else\n colList.addClass('pvtHorizList')\n\n for own i, c of shownAttributes\n do (c) ->\n keys = (k for k of axisValues[c])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").text(\"#{c} (#{keys.length})\")\n if keys.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n btns = $(\"

\").appendTo(valueList)\n btns.append $(\"

\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend colList\n else\n uiTable.prepend $(\"
\", {\n \"class\": \"pvtUi\"\n }).attr(\"cellpadding\", 5);\n rendererControl = $(\"\").appendTo(uiTable);\n aggregator = $(\"\").appendTo(uiTable);\n tr2.append($(\"\").append(rendererControl).append(colList));\n }\n this.html(uiTable);\n ref3 = opts.cols;\n for (o = 0, len3 = ref3.length; o < len3; o++) {\n x = ref3[o];\n this.find(\".pvtCols\").append(this.find(\".axis_\" + ($.inArray(x, shownAttributes))));\n }\n ref4 = opts.rows;\n for (q = 0, len4 = ref4.length; q < len4; q++) {\n x = ref4[q];\n this.find(\".pvtRows\").append(this.find(\".axis_\" + ($.inArray(x, shownAttributes))));\n }\n if (opts.aggregatorName != null) {\n this.find(\".pvtAggregator\").val(opts.aggregatorName);\n }\n if (opts.rendererName != null) {\n this.find(\".pvtRenderer\").val(opts.rendererName);\n }\n initialRender = true;\n refreshDelayed = (function(_this) {\n return function() {\n var attr, exclusions, inclusions, len5, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, ref5, ref6, s, subopts, t, unusedAttrsContainer, vals;\n subopts = {\n derivedAttributes: opts.derivedAttributes,\n localeStrings: opts.localeStrings,\n rendererOptions: opts.rendererOptions,\n sorters: opts.sorters,\n cols: [],\n rows: []\n };\n numInputsToProcess = (ref5 = opts.aggregators[aggregator.val()]([])().numInputs) != null ? ref5 : 0;\n vals = [];\n _this.find(\".pvtRows li span.pvtAttr\").each(function() {\n return subopts.rows.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtCols li span.pvtAttr\").each(function() {\n return subopts.cols.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtVals select.pvtAttrDropdown\").each(function() {\n if (numInputsToProcess === 0) {\n return $(this).remove();\n } else {\n numInputsToProcess--;\n if ($(this).val() !== \"\") {\n return vals.push($(this).val());\n }\n }\n });\n if (numInputsToProcess !== 0) {\n pvtVals = _this.find(\".pvtVals\");\n for (x = s = 0, ref6 = numInputsToProcess; 0 <= ref6 ? s < ref6 : s > ref6; x = 0 <= ref6 ? ++s : --s) {\n newDropdown = $(\"
\");\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused');\n shownAttributes = (function() {\n var len2, n, results;\n results = [];\n for (n = 0, len2 = tblCols.length; n < len2; n++) {\n c = tblCols[n];\n if (indexOf.call(opts.hiddenAttributes, c) < 0) {\n results.push(c);\n }\n }\n return results;\n })();\n unusedAttrsVerticalAutoOverride = false;\n if (opts.unusedAttrsVertical === \"auto\") {\n unusedAttrsVerticalAutoCutoff = 120;\n } else {\n unusedAttrsVerticalAutoCutoff = parseInt(opts.unusedAttrsVertical);\n }\n if (!isNaN(unusedAttrsVerticalAutoCutoff)) {\n attrLength = 0;\n for (n = 0, len2 = shownAttributes.length; n < len2; n++) {\n a = shownAttributes[n];\n attrLength += a.length;\n }\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff;\n }\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n colList.addClass('pvtVertList');\n } else {\n colList.addClass('pvtHorizList');\n }\n fn = function(c) {\n var attrElem, btns, checkContainer, filterItem, filterItemExcluded, hasExcludedItem, keys, len3, o, ref2, showFilterList, triangleLink, updateFilter, v, valueList;\n keys = (function() {\n var results;\n results = [];\n for (k in axisValues[c]) {\n results.push(k);\n }\n return results;\n })();\n hasExcludedItem = false;\n valueList = $(\"
\").addClass('pvtFilterBox').hide();\n valueList.append($(\"

\").text(c + \" (\" + keys.length + \")\"));\n if (keys.length > opts.menuLimit) {\n valueList.append($(\"

\").html(opts.localeStrings.tooMany));\n } else {\n btns = $(\"

\").appendTo(valueList);\n btns.append($(\"

\").addClass('pvtVals').appendTo(tr1).append(aggregator).append($(\"
\"));\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1);\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows').attr(\"valign\", \"top\"));\n pivotTable = $(\"\").attr(\"valign\", \"top\").addClass('pvtRendererArea').appendTo(tr2);\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n uiTable.find('tr:nth-child(1)').prepend(rendererControl);\n uiTable.find('tr:nth-child(2)').prepend(colList);\n } else {\n uiTable.prepend($(\"
\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(colList)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownAttributes)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (c for c in tblCols when c not in opts.hiddenAttributes)\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownAttributes\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n colList.addClass('pvtVertList')\n else\n colList.addClass('pvtHorizList')\n\n for own i, c of shownAttributes\n do (c) ->\n keys = (k for k of axisValues[c])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").text(\"#{c} (#{keys.length})\")\n if keys.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n btns = $(\"

\").appendTo(valueList)\n btns.append $(\"

\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend colList\n else\n uiTable.prepend $(\"
\", {\n \"class\": \"pvtUi\"\n }).attr(\"cellpadding\", 5);\n rendererControl = $(\"\").appendTo(uiTable);\n aggregator = $(\"\").appendTo(uiTable);\n tr2.append($(\"\").append(rendererControl).append(colList));\n }\n this.html(uiTable);\n ref3 = opts.cols;\n for (o = 0, len3 = ref3.length; o < len3; o++) {\n x = ref3[o];\n this.find(\".pvtCols\").append(this.find(\".axis_\" + ($.inArray(x, shownAttributes))));\n }\n ref4 = opts.rows;\n for (q = 0, len4 = ref4.length; q < len4; q++) {\n x = ref4[q];\n this.find(\".pvtRows\").append(this.find(\".axis_\" + ($.inArray(x, shownAttributes))));\n }\n if (opts.aggregatorName != null) {\n this.find(\".pvtAggregator\").val(opts.aggregatorName);\n }\n if (opts.rendererName != null) {\n this.find(\".pvtRenderer\").val(opts.rendererName);\n }\n initialRender = true;\n refreshDelayed = (function(_this) {\n return function() {\n var attr, exclusions, inclusions, len5, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, ref5, ref6, s, subopts, t, unusedAttrsContainer, vals;\n subopts = {\n derivedAttributes: opts.derivedAttributes,\n localeStrings: opts.localeStrings,\n rendererOptions: opts.rendererOptions,\n sorters: opts.sorters,\n cols: [],\n rows: []\n };\n numInputsToProcess = (ref5 = opts.aggregators[aggregator.val()]([])().numInputs) != null ? ref5 : 0;\n vals = [];\n _this.find(\".pvtRows li span.pvtAttr\").each(function() {\n return subopts.rows.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtCols li span.pvtAttr\").each(function() {\n return subopts.cols.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtVals select.pvtAttrDropdown\").each(function() {\n if (numInputsToProcess === 0) {\n return $(this).remove();\n } else {\n numInputsToProcess--;\n if ($(this).val() !== \"\") {\n return vals.push($(this).val());\n }\n }\n });\n if (numInputsToProcess !== 0) {\n pvtVals = _this.find(\".pvtVals\");\n for (x = s = 0, ref6 = numInputsToProcess; 0 <= ref6 ? s < ref6 : s > ref6; x = 0 <= ref6 ? ++s : --s) {\n newDropdown = $(\"
\");\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused');\n shownAttributes = (function() {\n var len2, n, results;\n results = [];\n for (n = 0, len2 = tblCols.length; n < len2; n++) {\n c = tblCols[n];\n if (indexOf.call(opts.hiddenAttributes, c) < 0) {\n results.push(c);\n }\n }\n return results;\n })();\n unusedAttrsVerticalAutoOverride = false;\n if (opts.unusedAttrsVertical === \"auto\") {\n unusedAttrsVerticalAutoCutoff = 120;\n } else {\n unusedAttrsVerticalAutoCutoff = parseInt(opts.unusedAttrsVertical);\n }\n if (!isNaN(unusedAttrsVerticalAutoCutoff)) {\n attrLength = 0;\n for (n = 0, len2 = shownAttributes.length; n < len2; n++) {\n a = shownAttributes[n];\n attrLength += a.length;\n }\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff;\n }\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n colList.addClass('pvtVertList');\n } else {\n colList.addClass('pvtHorizList');\n }\n fn = function(c) {\n var attrElem, btns, checkContainer, filterItem, filterItemExcluded, hasExcludedItem, keys, len3, o, ref2, showFilterList, triangleLink, updateFilter, v, valueList;\n keys = (function() {\n var results;\n results = [];\n for (k in axisValues[c]) {\n results.push(k);\n }\n return results;\n })();\n hasExcludedItem = false;\n valueList = $(\"
\").addClass('pvtFilterBox').hide();\n valueList.append($(\"

\").text(c + \" (\" + keys.length + \")\"));\n if (keys.length > opts.menuLimit) {\n valueList.append($(\"

\").html(opts.localeStrings.tooMany));\n } else {\n btns = $(\"

\").appendTo(valueList);\n btns.append($(\"

\").addClass('pvtVals').appendTo(tr1).append(aggregator).append($(\"
\"));\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1);\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows').attr(\"valign\", \"top\"));\n pivotTable = $(\"\").attr(\"valign\", \"top\").addClass('pvtRendererArea').appendTo(tr2);\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n uiTable.find('tr:nth-child(1)').prepend(rendererControl);\n uiTable.find('tr:nth-child(2)').prepend(colList);\n } else {\n uiTable.prepend($(\"