diff --git a/dist/c3_renderers.js b/dist/c3_renderers.js index 92fb54a3..b5f9975e 100644 --- a/dist/c3_renderers.js +++ b/dist/c3_renderers.js @@ -318,4 +318,4 @@ }).call(this); -//# sourceMappingURL=c3_renderers.js.map \ No newline at end of file +//# sourceMappingURL=c3_renderers.js.map diff --git a/dist/c3_renderers.js.map b/dist/c3_renderers.js.map index 5624f1c7..891e1621 100644 --- a/dist/c3_renderers.js.map +++ b/dist/c3_renderers.js.map @@ -1 +1 @@ -{"version":3,"sources":["c3_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;;AAAA,EAAA,cAAA,GAAiB,SAAC,WAAD,GAAA;AACb,IAAA,IAAG,MAAA,CAAA,OAAA,KAAkB,QAAlB,IAA+B,MAAA,CAAA,MAAA,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EAA+B,OAAA,CAAQ,IAAR,CAA/B,EADJ;KAAA,MAEK,IAAG,MAAA,CAAA,MAAA,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,EAAW,IAAX,CAAP,EAAyB,WAAzB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAAoB,EAApB,EAJC;KAHQ;EAAA,CAAjB,CAAA;;AAAA,EASA,cAAA,CAAe,SAAC,CAAD,EAAI,EAAJ,GAAA;AAEX,QAAA,WAAA;AAAA,IAAA,WAAA,GAAc,SAAC,SAAD,GAAA;;QAAC,YAAY;OAAO;aAAA,SAAC,SAAD,EAAY,IAAZ,GAAA;AAC9B,YAAA,2aAAA;AAAA,QAAA,QAAA,GACI;AAAA,UAAA,aAAA,EAAe;AAAA,YAAC,EAAA,EAAI,IAAL;AAAA,YAAW,EAAA,EAAI,IAAf;WAAf;AAAA,UACA,EAAA,EAAI,EADJ;SADJ,CAAA;AAAA,QAIA,IAAA,GAAO,CAAC,CAAC,MAAF,CAAS,IAAT,EAAe,EAAf,EAAmB,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M,CAAC,MAAP,CAAA,CA1JA,CAAA;AAAA,QA2JA,UAAU,CAAC,MAAX,CAAA,CA3JA,CAAA;AA4JA,eAAO,CAAA,CAAE,OAAF,CAAU,CAAC,MAAX,CAAkB,KAAlB,EAAyB,MAAzB,CAAP,CA7J8B;MAAA,EAApB;IAAA,CAAd,CAAA;WA+JA,CAAC,CAAC,cAAc,CAAC,YAAjB,GACI;AAAA,MAAA,sBAAA,EAAwB,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;AAAA,QAAa,UAAA,EAAY,IAAzB;OAAZ,CAAxB;AAAA,MACA,8BAAA,EAAgC,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;AAAA,QAAa,OAAA,EAAS,IAAtB;AAAA,QAA4B,UAAA,EAAY,IAAxC;OAAZ,CADhC;AAAA,MAEA,WAAA,EAAa,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;OAAZ,CAFb;AAAA,MAGA,mBAAA,EAAqB,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;AAAA,QAAa,OAAA,EAAS,IAAtB;OAAZ,CAHrB;AAAA,MAIA,YAAA,EAAc,WAAA,CAAA,CAJd;AAAA,MAKA,YAAA,EAAc,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,MAAN;AAAA,QAAc,OAAA,EAAS,IAAvB;OAAZ,CALd;AAAA,MAMA,eAAA,EAAiB,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,SAAN;OAAZ,CANjB;MAlKO;EAAA,CAAf,CATA,CAAA;AAAA","file":"c3_renderers.js","sourceRoot":"/source/","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"c3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"c3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, c3\n\ncallWithJQuery ($, c3) ->\n\n makeC3Chart = (chartOpts = {}) -> (pivotData, opts) ->\n defaults =\n localeStrings: {vs: \"vs\", by: \"by\"}\n c3: {}\n\n opts = $.extend(true, {}, defaults, opts)\n opts.c3.size ?= {}\n opts.c3.size.width ?= window.innerWidth / 1.4\n opts.c3.size.height ?= window.innerHeight / 1.4 - 50\n chartOpts.type ?= \"line\"\n chartOpts.horizontal ?= false\n chartOpts.stacked ?= false\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n\n headers = (h.join(\"-\") for h in colKeys)\n rotationAngle = 0\n\n fullAggName = pivotData.aggregatorName\n if pivotData.valAttrs.length\n fullAggName += \"(#{pivotData.valAttrs.join(\", \")})\"\n\n if chartOpts.type == \"scatter\"\n scatterData = x:{}, y:{}, t:{}\n attrs = pivotData.rowAttrs.concat(pivotData.colAttrs)\n vAxisTitle = attrs[0] ? \"\"\n hAxisTitle = attrs[1] ? \"\"\n groupByTitle = attrs.slice(2).join(\"-\")\n titleText = vAxisTitle\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n for rowKey in rowKeys\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n vals = rowKey.concat(colKey)\n series = vals.slice(2).join(\"-\")\n if series == \"\" then series = \"series\"\n scatterData.x[series] ?= []\n scatterData.y[series] ?= []\n scatterData.t[series] ?= []\n scatterData.y[series].push vals[0] ? 0\n scatterData.x[series].push vals[1] ? 0\n scatterData.t[series].push agg.value()\n else\n numCharsInHAxis = 0\n for x in headers\n numCharsInHAxis += x.length\n if numCharsInHAxis > 50\n rotationAngle = 45\n\n columns = []\n for rowKey in rowKeys\n rowHeader = rowKey.join(\"-\")\n row = [if rowHeader == \"\" then fullAggName else rowHeader]\n for colKey in colKeys\n val = parseFloat pivotData.getAggregator(rowKey, colKey).value()\n if isFinite(val)\n row.push(val)\n else\n row.push(null)\n columns.push row\n\n vAxisTitle = fullAggName\n\n if chartOpts.horizontal\n hAxisTitle = pivotData.rowAttrs.join(\"-\")\n groupByTitle = pivotData.colAttrs.join(\"-\")\n else\n hAxisTitle = pivotData.colAttrs.join(\"-\")\n groupByTitle = pivotData.rowAttrs.join(\"-\")\n titleText = fullAggName\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n\n title = $(\"
\", {style: \"text-align: center; font-weight: bold\"})\n title.text(titleText)\n\n formatter = pivotData.getAggregator([], []).format\n\n params =\n axis:\n rotated: chartOpts.horizontal\n y:\n label: vAxisTitle\n tick: {}\n x:\n label: hAxisTitle\n tick:\n rotate: rotationAngle\n multiline: false\n data:\n type: chartOpts.type\n order: null\n tooltip:\n grouped: false\n color:\n pattern: [ \"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\",\n \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\",\n \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\",\n \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\",\n \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\" ]\n\n\n params = $.extend(true, {}, params, opts.c3)\n if chartOpts.type == \"scatter\"\n xs = {}\n numSeries = 0\n dataColumns = []\n for s of scatterData.x\n numSeries += 1\n xs[s] = s+\"_x\"\n dataColumns.push [s+\"_x\"].concat(scatterData.x[s])\n dataColumns.push [s].concat(scatterData.y[s])\n params.data.xs = xs\n params.data.columns = dataColumns\n params.axis.x.tick = fit: false\n if numSeries == 1\n params.legend = show: false\n params.tooltip.format =\n title: -> fullAggName\n name: -> \"\"\n value: (a,b,c,d) -> formatter(scatterData.t[c][d])\n else\n params.axis.x.type= 'category'\n params.axis.y.tick.format ?= (v) -> formatter(v)\n params.tooltip.format = value: (v) -> formatter(v)\n\n if chartOpts.horizontal\n categories = (c.shift() for c in columns)\n if categories.length == 1 and categories[0] == fullAggName\n categories = [\"\"]\n params.axis.x.categories = categories\n if headers.length == 1 and headers[0] == \"\"\n headers = [fullAggName]\n columns.unshift(headers)\n params.data.rows = columns\n else\n params.axis.x.categories = headers\n params.data.columns = columns\n\n\n if chartOpts.stacked\n if chartOpts.horizontal\n params.data.groups = [x.join(\"-\") for x in colKeys]\n else\n params.data.groups = [x.join(\"-\") for x in rowKeys]\n\n renderArea = $(\"
",{style:"text-align: center; font-weight: bold"}),tt.text(et),z=r.getAggregator([],[]).format,U={axis:{rotated:n.horizontal,y:{label:nt,tick:{}},x:{label:A,tick:{rotate:M,multiline:!1}}},data:{type:n.type,order:null},tooltip:{grouped:!1},color:{pattern:["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395","#994499","#22aa99","#aaaa11","#6633cc","#e67300","#8b0707","#651067","#329262","#5574a6","#3b3eac"]}},U=t.extend(!0,{},U,a.c3),"scatter"===n.type){lt={},R=0,b=[];for(Y in Z.x)R+=1,lt[Y]=Y+"_x",b.push([Y+"_x"].concat(Z.x[Y])),b.push([Y].concat(Z.y[Y]));U.data.xs=lt,U.data.columns=b,U.axis.x.tick={fit:!1},1===R&&(U.legend={show:!1}),U.tooltip.format={title:function(){return m},name:function(){return""},value:function(t,e,n,r){return z(Z.t[n][r])}}}else U.axis.x.type="category",null==(p=U.axis.y.tick).format&&(p.format=function(t){return z(t)}),U.tooltip.format={value:function(t){return z(t)}},n.horizontal?(f=function(){var t,e,n;for(n=[],e=0,t=v.length;t>e;e++)d=v[e],n.push(d.shift());return n}(),1===f.length&&f[0]===m&&(f=[""]),U.axis.x.categories=f,1===C.length&&""===C[0]&&(C=[m]),v.unshift(C),U.data.rows=v):(U.axis.x.categories=C,U.data.columns=v);return n.stacked&&(U.data.groups=n.horizontal?[function(){var t,e,n;for(n=[],e=0,t=x.length;t>e;e++)ot=x[e],n.push(ot.join("-"));return n}()]:[function(){var t,e,n;for(n=[],e=0,t=X.length;t>e;e++)ot=X[e],n.push(ot.join("-"));return n}()]),I=t("
\",{style:\"text-align: center; font-weight: bold\"}),tt.text(et),z=r.getAggregator([],[]).format,U={axis:{rotated:n.horizontal,y:{label:nt,tick:{}},x:{label:A,tick:{rotate:M,multiline:!1}}},data:{type:n.type,order:null},tooltip:{grouped:!1},color:{pattern:[\"#3366cc\",\"#dc3912\",\"#ff9900\",\"#109618\",\"#990099\",\"#0099c6\",\"#dd4477\",\"#66aa00\",\"#b82e2e\",\"#316395\",\"#994499\",\"#22aa99\",\"#aaaa11\",\"#6633cc\",\"#e67300\",\"#8b0707\",\"#651067\",\"#329262\",\"#5574a6\",\"#3b3eac\"]}},U=t.extend(!0,{},U,a.c3),\"scatter\"===n.type){lt={},R=0,b=[];for(Y in Z.x)R+=1,lt[Y]=Y+\"_x\",b.push([Y+\"_x\"].concat(Z.x[Y])),b.push([Y].concat(Z.y[Y]));U.data.xs=lt,U.data.columns=b,U.axis.x.tick={fit:!1},1===R&&(U.legend={show:!1}),U.tooltip.format={title:function(){return m},name:function(){return\"\"},value:function(t,e,n,r){return z(Z.t[n][r])}}}else U.axis.x.type=\"category\",null==(p=U.axis.y.tick).format&&(p.format=function(t){return z(t,!0)}),U.tooltip.format={value:function(t){return z(t)}},n.horizontal?(f=function(){var t,e,n;for(n=[],e=0,t=v.length;t>e;e++)d=v[e],n.push(d.shift());return n}(),1===f.length&&f[0]===m&&(f=[\"\"]),U.axis.x.categories=f,1===C.length&&\"\"===C[0]&&(C=[m]),v.unshift(C),U.data.rows=v):(U.axis.x.categories=C,U.data.columns=v);return n.stacked&&(U.data.groups=n.horizontal?[function(){var t,e,n;for(n=[],e=0,t=x.length;t>e;e++)ot=x[e],n.push(ot.join(\"-\"));return n}()]:[function(){var t,e,n;for(n=[],e=0,t=X.length;t>e;e++)ot=X[e],n.push(ot.join(\"-\"));return n}()]),I=t(\"
\", {\n style: \"text-align: center; font-weight: bold\"\n });\n title.text(titleText);\n formatter = pivotData.getAggregator([], []).format;\n params = {\n axis: {\n rotated: chartOpts.horizontal,\n y: {\n label: vAxisTitle,\n tick: {}\n },\n x: {\n label: hAxisTitle,\n tick: {\n rotate: rotationAngle,\n multiline: false\n }\n }\n },\n data: {\n type: chartOpts.type,\n order: null\n },\n tooltip: {\n grouped: false\n },\n color: {\n pattern: [\"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\", \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\", \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\", \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\", \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\"]\n }\n };\n params = $.extend(true, {}, params, opts.c3);\n if (chartOpts.type === \"scatter\") {\n xs = {};\n numSeries = 0;\n dataColumns = [];\n for (s in scatterData.x) {\n numSeries += 1;\n xs[s] = s + \"_x\";\n dataColumns.push([s + \"_x\"].concat(scatterData.x[s]));\n dataColumns.push([s].concat(scatterData.y[s]));\n }\n params.data.xs = xs;\n params.data.columns = dataColumns;\n params.axis.x.tick = {\n fit: false\n };\n if (numSeries === 1) {\n params.legend = {\n show: false\n };\n }\n params.tooltip.format = {\n title: function() {\n return fullAggName;\n },\n name: function() {\n return \"\";\n },\n value: function(a, b, c, d) {\n return formatter(scatterData.t[c][d]);\n }\n };\n } else {\n params.axis.x.type = 'category';\n if ((base6 = params.axis.y.tick).format == null) {\n base6.format = function(v) {\n return formatter(v);\n };\n }\n params.tooltip.format = {\n value: function(v) {\n return formatter(v);\n }\n };\n if (chartOpts.horizontal) {\n categories = (function() {\n var len5, n, results;\n results = [];\n for (n = 0, len5 = columns.length; n < len5; n++) {\n c = columns[n];\n results.push(c.shift());\n }\n return results;\n })();\n if (categories.length === 1 && categories[0] === fullAggName) {\n categories = [\"\"];\n }\n params.axis.x.categories = categories;\n if (headers.length === 1 && headers[0] === \"\") {\n headers = [fullAggName];\n }\n columns.unshift(headers);\n params.data.rows = columns;\n } else {\n params.axis.x.categories = headers;\n params.data.columns = columns;\n }\n }\n if (chartOpts.stacked) {\n if (chartOpts.horizontal) {\n params.data.groups = [\n (function() {\n var len5, n, results;\n results = [];\n for (n = 0, len5 = colKeys.length; n < len5; n++) {\n x = colKeys[n];\n results.push(x.join(\"-\"));\n }\n return results;\n })()\n ];\n } else {\n params.data.groups = [\n (function() {\n var len5, n, results;\n results = [];\n for (n = 0, len5 = rowKeys.length; n < len5; n++) {\n x = rowKeys[n];\n results.push(x.join(\"-\"));\n }\n return results;\n })()\n ];\n }\n }\n renderArea = $(\"
\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"
\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n"]} \ No newline at end of file +{"version":3,"file":"pivot.js","sources":["pivot.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;IAAA;;;;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,OAAP,KAAkB,QAAlB,IAA+B,OAAO,MAAP,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EADJ;KAAA,MAEK,IAAG,OAAO,MAAP,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,CAAP,EAAmB,WAAnB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAJC;;EAHQ;;EASjB,cAAA,CAAe,SAAC,CAAD;;AAEX;;;AAAA,QAAA;IAIA,aAAA,GAAgB,SAAC,IAAD,EAAO,YAAP,EAAqB,UAArB;AACZ,UAAA;MAAA,IAAA,IAAQ;MACR,CAAA,GAAI,IAAI,CAAC,KAAL,CAAW,GAAX;MACJ,EAAA,GAAK,CAAE,CAAA,CAAA;MACP,EAAA,GAAQ,CAAC,CAAC,MAAF,GAAW,CAAd,GAAsB,UAAA,GAAa,CAAE,CAAA,CAAA,CAArC,GAA6C;MAClD,GAAA,GAAM;AAC2C,aAAM,GAAG,CAAC,IAAJ,CAAS,EAAT,CAAN;QAAjD,EAAA,GAAK,EAAE,CAAC,OAAH,CAAW,GAAX,EAAgB,IAAA,GAAO,YAAP,GAAsB,IAAtC;MAA4C;AACjD,aAAO,EAAA,GAAK;IAPA;IAShB,YAAA,GAAe,SAAC,IAAD;AACX,UAAA;MAAA,QAAA,GACI;QAAA,kBAAA,EAAoB,CAApB;QAAuB,MAAA,EAAQ,CAA/B;QACA,YAAA,EAA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;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;EAjjCN,CAAf;AATA","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\n\n \n cellRenderers =\n text: (value) -> document.createTextNode(value)\n byType: (opts, def) -> (value, type) -> (opts[type] || def || cellRenderers.text).apply(this, arguments)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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, cellRenderers, 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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n typeCellRenderer: cellRenderers.text\n headCellRenderer: cellRenderers.text\n dataCellRenderer: cellRenderers.text\n \n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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.appendChild opts.typeCellRenderer(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.appendChild opts.headCellRenderer(colKey[j], c)\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 thead.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.appendChild opts.typeCellRenderer(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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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.appendChild opts.headCellRenderer(txt, rowAttrs[j])\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.appendChild opts.dataCellRenderer(aggregator.format(val), rowKey, colKey)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n"]} \ No newline at end of file diff --git a/dist/pivot.min.js b/dist/pivot.min.js index 27181d11..13b24ce4 100644 --- a/dist/pivot.min.js +++ b/dist/pivot.min.js @@ -1,2 +1,2 @@ -(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+="",a=t.split("."),o=a[0],i=a.length>1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(o);)o=o.replace(r,"$1"+e+"$2");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:"%"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],("min"===t||"max"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),"first"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),"last"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if("mean"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes("max",t)},s.min=function(t){return s.extremes("min",t)},s.first=function(t){return s.extremes("first",t)},s.last=function(t){return s.extremes("last",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat("mean",1,t)},s["var"]=function(t,e){return s.runningStat("var",t,e)},s.stdev=function(t,e){return s.runningStat("stdev",t,e)},l=function(t){return{Count:t.count(x),"Count Unique Values":t.countUnique(x),"List Unique Values":t.listUnique(", "),Sum:t.sum(A),"Integer Sum":t.sum(x),Average:t.average(A),Median:t.median(A),"Sample Variance":t["var"](1,A),"Sample Standard Deviation":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),"Sum over Sum":t.sumOverSum(A),"80% Upper Bound":t.sumOverSumBound80(!0,A),"80% Lower Bound":t.sumOverSumBound80(!1,A),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",S),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",S),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",S),"Count as Fraction of Total":t.fractionOf(t.count(),"total",S),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",S),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",S)}}(s),b={Table:function(t,e){return g(t,e)},"Table Barchart":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(g(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(g(e,n)).heatmap("colheatmap",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],N=function(t){return("0"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?"UTC":"",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return i["get"+o+"FullYear"]();case"m":return N(i["get"+o+"Month"]()+1);case"n":return r[i["get"+o+"Month"]()];case"d":return N(i["get"+o+"Date"]());case"w":return a[i["get"+o+"Day"]()];case"x":return i["get"+o+"Day"]();case"H":return N(i["get"+o+"Hours"]());case"M":return N(i["get"+o+"Minutes"]());case"S":return N(i["get"+o+"Seconds"]());default:return"%"+e}})}}},C=/(\d+)|(\D+)/g,v=/\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,".0")-o.replace(y,".0"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:"Count",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t("thead > tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case"value_a_to_z":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case"value_z_to_a":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case"value_a_to_z":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case"value_z_to_a":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:"null");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:"null");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return""}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:"Totals"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement("table"),f.className="pvtTable",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement("thead");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement("tr"),0===parseInt(h)&&0!==m.length&&(w=document.createElement("th"),w.setAttribute("colspan",m.length),w.setAttribute("rowspan",i.length),S.appendChild(w)),w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtColLabel",w.textContent=s[h],w.setAttribute("colspan",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute("rowspan",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("rowspan",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement("tr");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=p,S.appendChild(w));w=document.createElement("th"),0===i.length&&(w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement("tbody");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement("tr");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtRowLabel",w.textContent=N,w.setAttribute("rowspan",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute("colspan",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement("td"),y.className="pvtVal row"+d+" col"+h,y.textContent=r.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement("td"),y.className="pvtTotal rowTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute("data-for","row"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement("tr"),w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("colspan",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement("td"),y.className="pvtTotal colTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute("data-for","col"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement("td"),y.className="pvtGrandTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute("data-numrows",v.length),f.setAttribute("data-numcols",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r="en"),null==h[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.renderError)}}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s="en"),null==h[s]&&(s="en"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e]["null"]=I));for(e in m)o=null!=(r=t[e])?r:"null",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$="auto"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?"pvtVertList":"pvtHorizList"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>D.menuLimit)x.append(t("").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t("").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("")),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(""),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!l).data("filter",[n,y]).appendTo(s).bind("change",function(){return t(this).toggleClass("changed")}),s.append(t("").addClass("value").text(y)),s.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(s));return o=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=D.menuLimit&&t("",{type:"button"}).text(D.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),o()}),t("",{type:"button"}).text(D.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),o()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=D.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(M={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",D.rowOrder).html(M[D.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",D.colOrder).html(M[D.colOrder].colSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),R=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),D.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=D.cols,F=0,N=q.length;N>F;F++)X=q[F],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(X,W)));for(z=D.rows,E=0,T=z.length;T>E;E++)X=z[E],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(X,W)));null!=D.aggregatorName&&this.find(".pvtAggregator").val(D.aggregatorName),null!=D.rendererName&&this.find(".pvtRenderer").val(D.rendererName),A=!0,V=function(n){return function(){var r,a,o,i,s,l,d,h,p,m,v,b,C,y;if(m={derivedAttributes:D.derivedAttributes,localeStrings:D.localeStrings,rendererOptions:D.rendererOptions,sorters:D.sorters,cols:[],rows:[],dataClass:D.dataClass},s=null!=(h=D.aggregators[u.val()]([])().numInputs)?h:0,y=[],n.find(".pvtRows li span.pvtAttr").each(function(){return m.rows.push(t(this).data("attrName"))}),n.find(".pvtCols li span.pvtAttr").each(function(){return m.cols.push(t(this).data("attrName"))}),n.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===s?t(this).remove():(s--,""!==t(this).val()?y.push(t(this).val()):void 0)}),0!==s)for(d=n.find(".pvtVals"),X=v=0,p=s;p>=0?p>v:v>p;X=p>=0?++v:--v){for(i=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,o=W.length;o>b;b++)c=W[b],i.append(t("").val(c).text(c));d.append(i)}return A&&(y=D.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),m.aggregatorName=u.val(),m.vals=y,m.aggregator=D.aggregators[u.val()](y),m.renderer=D.renderers[j.val()],m.rowOrder=B.data("order"),m.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]:void 0}),m.filter=function(t){var n,a,o,i;if(!D.filter(t))return!1;for(a in r)if(n=r[a],o=""+(null!=(i=t[a])?i:"null"),e.call(n,o)>=0)return!1;return!0},R.pivot(O,m),l=t.extend({},D,{cols:m.cols,rows:m.rows,colOrder:m.colOrder,rowOrder:m.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",l),D.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(C)),R.css("opacity",1),null!=D.onRefresh?D.onRefresh(l):void 0}}(this),U=function(t){return function(){return R.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?U():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(D.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,o,i,s,l,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,o,i;return o=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],o(function(t){return i.push(t)}),a=r(i),o(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(o=s=0,h=c;h>=0?h>s:s>h;o=h>=0?++s:--s)a(".pvtVal.row"+o);break;case"colheatmap":for(i=l=0,p=u;p>=0?p>l:l>p;i=p>=0?++l:--l)a(".pvtVal.col"+i)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,o,i;for(o=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,o,i;return r=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],r(function(t){return i.push(t)}),a=Math.max.apply(Math,i),o=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,i=o;i>=0?i>r:r>i;n=i>=0?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); -//# sourceMappingURL=pivot.min.js.map \ No newline at end of file +(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;e1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(i);)i=i.replace(r,"$1"+e+"$2");return i+o},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=o((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},x=g(),S=g({digitsAfterDecimal:0}),N=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),l={count:function(t){return null==t&&(t=S),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=S),function(r){var a;return a=r[0],function(r,i,o){return{uniq:[],push:function(t){var n;if(n=t[a],e.call(this.uniq,n)<0)return this.uniq.push(t[a])},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=x),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){if(!isNaN(parseFloat(t[n])))return this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{val:null,sorter:h(null!=n?n.sorters:void 0,r),push:function(e){var n,a,i,o;if(o=e[r],"min"!==t&&"max"!==t||(o=parseFloat(o),isNaN(o)||(this.val=Math[t](o,null!=(n=this.val)?n:o))),"first"===t&&this.sorter(o,null!=(a=this.val)?a:o)<=0&&(this.val=o),"last"===t&&this.sorter(o,null!=(i=this.val)?i:o)>=0)return this.val=o},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{vals:[],push:function(t){var e;if(e=parseFloat(t[r]),!isNaN(e))return this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=x),function(r){var a;return a=r[0],function(r,i,o){return{n:0,m:0,s:0,push:function(t){var e,n;if(n=parseFloat(t[a]),!isNaN(n))return this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e)},value:function(){if("mean"===t)return 0===this.n?NaN:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=x),function(e){var n,r;return r=e[0],n=e[1],function(e,a,i){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),!isNaN(parseFloat(t[n])))return this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=x),function(n){var r,a;return a=n[0],r=n[1],function(n,i,o){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),!isNaN(parseFloat(t[r])))return this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=N),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,i,o){return{selector:{total:[[],[]],row:[i,[]],col:[[],o]}[e],inner:t.apply(null,a)(n,i,o),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},l.countUnique=function(t){return l.uniques(function(t){return t.length},t)},l.listUnique=function(t){return l.uniques(function(e){return e.join(t)},function(t){return t})},l.max=function(t){return l.extremes("max",t)},l.min=function(t){return l.extremes("min",t)},l.first=function(t){return l.extremes("first",t)},l.last=function(t){return l.extremes("last",t)},l.median=function(t){return l.quantile(.5,t)},l.average=function(t){return l.runningStat("mean",1,t)},l["var"]=function(t,e){return l.runningStat("var",t,e)},l.stdev=function(t,e){return l.runningStat("stdev",t,e)},s=function(t){return{Count:t.count(S),"Count Unique Values":t.countUnique(S),"List Unique Values":t.listUnique(", "),Sum:t.sum(x),"Integer Sum":t.sum(S),Average:t.average(x),Median:t.median(x),"Sample Variance":t["var"](1,x),"Sample Standard Deviation":t.stdev(1,x),Minimum:t.min(x),Maximum:t.max(x),First:t.first(x),Last:t.last(x),"Sum over Sum":t.sumOverSum(x),"80% Upper Bound":t.sumOverSumBound80(!0,x),"80% Lower Bound":t.sumOverSumBound80(!1,x),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",N),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",N),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",N),"Count as Fraction of Total":t.fractionOf(t.count(),"total",N),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",N),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",N)}}(l),C={Table:function(t,e){return v(t,e)},"Table Barchart":function(e,n){return t(v(e,n)).barchart()},Heatmap:function(e,n){return t(v(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(v(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(v(e,n)).heatmap("colheatmap",n)}},u={text:function(t){return document.createTextNode(t)},byType:function(t,e){return function(n,r){return(t[r]||e||u.text).apply(this,arguments)}}},p={en:{aggregators:s,renderers:C,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T=function(t){return("0"+t).substr(-2,2)},d={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var i;return null==n&&(n=!1),null==r&&(r=f),null==a&&(a=c),i=n?"UTC":"",function(n){var o;return o=new Date(Date.parse(n[t])),isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o["get"+i+"FullYear"]();case"m":return T(o["get"+i+"Month"]()+1);case"n":return r[o["get"+i+"Month"]()];case"d":return T(o["get"+i+"Date"]());case"w":return a[o["get"+i+"Day"]()];case"x":return o["get"+i+"Day"]();case"H":return T(o["get"+i+"Hours"]());case"M":return T(o["get"+i+"Minutes"]());case"S":return T(o["get"+i+"Seconds"]());default:return"%"+e}})}}},y=/(\d+)|(\D+)/g,b=/\d/,w=/^0/,m=function(t){return function(t,e){var n,r,a,i,o,l;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(o=+t,l=+e,ol)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(l)&&!isNaN(o))return-1;if(isNaN(o)&&!isNaN(l))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!b.test(n)||!b.test(a))return n>a?1:-1;for(n=n.match(y),a=a.match(y);n.length&&a.length;)if(r=n.shift(),i=a.shift(),r!==i)return b.test(r)&&b.test(i)?r.replace(w,".0")-i.replace(w,".0"):r>i?1:-1;return n.length-a.length}}(this),A=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:m(t,e)}},h=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return m},i=function(){function e(t,n){var a,i,o,s,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:l.count()(),this.aggregatorName=null!=(i=n.aggregatorName)?i:"Count",this.colAttrs=null!=(o=n.cols)?o:[],this.rowAttrs=null!=(s=n.rows)?s:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){if(t.filter(e))return t.processRecord(e)}}(this))}return e.forEachRecord=function(e,n,r){var i,o,l,s,u,c,d,h,p,f,m,g;if(i=t.isEmptyObject(n)?r:function(t){var e,a,i;for(e in n)i=n[e],t[e]=null!=(a=i(t))?a:t[e];return r(t)},t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(l in e)if(a.call(e,l)&&(o=e[l],l>0)){h={},p=e[0];for(s in p)a.call(p,s)&&(u=p[s],h[u]=o[s]);f.push(i(h))}return f}for(m=[],c=0,d=e.length;c tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),i(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,i,o;if(e.filter(r)){for(a in t)if(o=t[a],o!==(null!=(i=r[a])?i:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;n=l;c=0<=l?++r:--r)t[e-1][c]!==t[e][c]&&(o=!1);if(o)return-1}for(a=0;e+a=s;c=0<=s?++i:--i)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},x=document.createElement("thead");for(p in o)if(a.call(o,p)){i=o[p],N=document.createElement("tr"),0===parseInt(p)&&0!==g.length&&(A=document.createElement("th"),A.setAttribute("colspan",g.length),A.setAttribute("rowspan",o.length),N.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(i)),N.appendChild(A);for(h in s)a.call(s,h)&&(l=s[h],_=C(s,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtColLabel",A.appendChild(n.headCellRenderer(l[p],i)),A.setAttribute("colspan",_),parseInt(p)===o.length-1&&0!==g.length&&A.setAttribute("rowspan",2),N.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",o.length+(0===g.length?0:1)),N.appendChild(A)),x.appendChild(N)}if(0!==g.length){N=document.createElement("tr");for(h in g)a.call(g,h)&&(f=g[h],A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(f)),N.appendChild(A));A=document.createElement("th"),0===o.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),N.appendChild(A),x.appendChild(N)}m.appendChild(x),y=document.createElement("tbody");for(h in b)if(a.call(b,h)){v=b[h],N=document.createElement("tr");for(p in v)a.call(v,p)&&(T=v[p],_=C(b,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtRowLabel",A.appendChild(n.headCellRenderer(T,g[p])),A.setAttribute("rowspan",_),parseInt(p)===g.length-1&&0!==o.length&&A.setAttribute("colspan",2),N.appendChild(A)));for(p in s)a.call(s,p)&&(l=s[p],r=e.getAggregator(v,l),k=r.value(),w=document.createElement("td"),w.className="pvtVal row"+h+" col"+p,w.appendChild(n.dataCellRenderer(r.format(k),v,l)),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,l)),N.appendChild(w));S=e.getAggregator(v,[]),k=S.value(),w=document.createElement("td"),w.className="pvtTotal rowTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,[])),w.setAttribute("data-for","row"+h),N.appendChild(w),y.appendChild(N)}N=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",g.length+(0===o.length?0:1)),N.appendChild(A);for(p in s)a.call(s,p)&&(l=s[p],S=e.getAggregator([],l),k=S.value(),w=document.createElement("td"),w.className="pvtTotal colTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],l)),w.setAttribute("data-for","col"+p),N.appendChild(w));return S=e.getAggregator([],[]),k=S.value(),w=document.createElement("td"),w.className="pvtGrandTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],[])),N.appendChild(w),y.appendChild(N),m.appendChild(y),m.setAttribute("data-numrows",b.length),m.setAttribute("data-numcols",s.length),m},t.fn.pivot=function(e,n,r){var a,o,s,u,c,d,h,f;null==r&&(r="en"),null==p[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:v},u=t.extend(!0,{},p.en.localeStrings,p[r].localeStrings),s={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},s,t.extend({},a,n)),h=null;try{d=new c.dataClass(e,c);try{h=c.renderer(d,c.rendererOptions)}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.renderError)}}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(h)},t.fn.pivotUI=function(n,r,o,l){var s,u,c,d,f,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,R,E,D,M,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==o&&(o=!1),null==l&&(l="en"),null==p[l]&&(l="en"),v={derivedAttributes:{},aggregators:p[l].aggregators,renderers:p[l].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},p.en.localeStrings,p[l].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),E=null==C||o?t.extend(!0,{},k,t.extend({},v,r)):C;try{f={},O=[],I=0,i.forEachRecord(n,E.derivedAttributes,function(t){var e,n,r,i;if(E.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==f[e]&&(f[e]={},I>0&&(f[e]["null"]=I));for(e in f)i=null!=(r=t[e])?r:"null",null==(n=f[e])[i]&&(n[i]=0),f[e][i]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=E.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(s in f)e.call(E.hiddenAttributes,s)<0&&t.push(s);return t}(),Y=!1,$="auto"===E.unusedAttrsVertical?120:parseInt(E.unusedAttrsVertical),!isNaN($)){for(d=0,x=0,S=W.length;x$}E.unusedAttrsVertical===!0||Y?Q.addClass("pvtVertList"):Q.addClass("pvtHorizList"),y=function(n){var r,a,i,o,l,s,u,c,d,p,m,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in f[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>E.menuLimit)x.append(t("").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC,EAAAC,KAAAC,OAAAF,EAAAD,EAAAA,IAAA,GAAAA,IAAAE,OAAAA,KAAAF,KAAAD,EAAA,MAAAC,EAAA,OAAA,ICGII,KAAWA,MACXC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,aAChEC,KAAaC,gBDLjBd,EAAiB,SAACe,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,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1B,EAAEjB,OAAP,UAERmW,KACA2D,EAAY,SAACnX,GC6oBb,MD7oBmBwT,GAAOlS,KAAKtB,KAC/B+E,EAAMrC,KAAKqC,IAALpH,MAAA+E,KAAS8Q,GACf/S,EAAS,SAACT,GC+oBV,MD/oBgB,KAAIA,GAAG,IAAI+E,IAC3BoS,EAAY,SAACnX,EAAGoX,GACZ,GAAA1K,GAAA4K,CCmqBJ,ODnqBI5K,GAAO0K,EAAK1K,OACZ4K,EAAUhZ,EAAE,SAASqW,KACjBD,SAAY,WACZ6C,OAAU,SACdD,EAAQ/G,OAAOjS,EAAE,SAASqW,KACtBD,SAAY,WACZ8C,OAAU,EACVjD,KAAQ,EACRkD,MAAS,EACTF,OAAU9W,EAAOT,GAAK,IACtB0X,mBAAoB,UACxBJ,EAAQ/G,OAAOjS,EAAE,SAASoO,KAAKA,GAAMiI,KACjCD,SAAW,WACXiD,eAAe,MACfC,gBAAgB,SAEpBR,EAAKzC,KAAIkD,QAAW,EAAEC,cAAe,MAAOC,aAAc,WAAU5H,KAAKmH,OA3BpEja,MA6ByBF,EAAAC,EAAA,EAAA0E,EAAAiV,EAAAjV,GAAA,EAAAA,EAAA1E,EAAAA,EAAA0E,EAAA3E,EAAA2E,GAAA,IAAA1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"
\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n"]} \ No newline at end of file +{"version":3,"file":"pivot.js","sources":["pivot.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;IAAA;;;;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,I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(\"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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\n\n \n cellRenderers =\n text: (value) -> document.createTextNode(value)\n byType: (opts, def) -> (value, type) -> (opts[type] || def || cellRenderers.text).apply(this, arguments)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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, cellRenderers, 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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n typeCellRenderer: cellRenderers.text\n headCellRenderer: cellRenderers.text\n dataCellRenderer: cellRenderers.text\n \n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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.appendChild opts.typeCellRenderer(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.appendChild opts.headCellRenderer(colKey[j], c)\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 thead.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.appendChild opts.typeCellRenderer(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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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.appendChild opts.headCellRenderer(txt, rowAttrs[j])\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.appendChild opts.dataCellRenderer(aggregator.format(val), rowKey, colKey)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n"]} \ No newline at end of file diff --git a/dist/pivot.min.js b/dist/pivot.min.js index 27181d11..13b24ce4 100644 --- a/dist/pivot.min.js +++ b/dist/pivot.min.js @@ -1,2 +1,2 @@ -(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+="",a=t.split("."),o=a[0],i=a.length>1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(o);)o=o.replace(r,"$1"+e+"$2");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:"%"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],("min"===t||"max"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),"first"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),"last"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if("mean"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes("max",t)},s.min=function(t){return s.extremes("min",t)},s.first=function(t){return s.extremes("first",t)},s.last=function(t){return s.extremes("last",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat("mean",1,t)},s["var"]=function(t,e){return s.runningStat("var",t,e)},s.stdev=function(t,e){return s.runningStat("stdev",t,e)},l=function(t){return{Count:t.count(x),"Count Unique Values":t.countUnique(x),"List Unique Values":t.listUnique(", "),Sum:t.sum(A),"Integer Sum":t.sum(x),Average:t.average(A),Median:t.median(A),"Sample Variance":t["var"](1,A),"Sample Standard Deviation":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),"Sum over Sum":t.sumOverSum(A),"80% Upper Bound":t.sumOverSumBound80(!0,A),"80% Lower Bound":t.sumOverSumBound80(!1,A),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",S),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",S),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",S),"Count as Fraction of Total":t.fractionOf(t.count(),"total",S),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",S),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",S)}}(s),b={Table:function(t,e){return g(t,e)},"Table Barchart":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(g(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(g(e,n)).heatmap("colheatmap",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],N=function(t){return("0"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?"UTC":"",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return i["get"+o+"FullYear"]();case"m":return N(i["get"+o+"Month"]()+1);case"n":return r[i["get"+o+"Month"]()];case"d":return N(i["get"+o+"Date"]());case"w":return a[i["get"+o+"Day"]()];case"x":return i["get"+o+"Day"]();case"H":return N(i["get"+o+"Hours"]());case"M":return N(i["get"+o+"Minutes"]());case"S":return N(i["get"+o+"Seconds"]());default:return"%"+e}})}}},C=/(\d+)|(\D+)/g,v=/\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,".0")-o.replace(y,".0"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:"Count",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t("thead > tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case"value_a_to_z":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case"value_z_to_a":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case"value_a_to_z":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case"value_z_to_a":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:"null");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:"null");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return""}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:"Totals"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement("table"),f.className="pvtTable",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement("thead");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement("tr"),0===parseInt(h)&&0!==m.length&&(w=document.createElement("th"),w.setAttribute("colspan",m.length),w.setAttribute("rowspan",i.length),S.appendChild(w)),w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtColLabel",w.textContent=s[h],w.setAttribute("colspan",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute("rowspan",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("rowspan",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement("tr");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=p,S.appendChild(w));w=document.createElement("th"),0===i.length&&(w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement("tbody");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement("tr");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtRowLabel",w.textContent=N,w.setAttribute("rowspan",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute("colspan",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement("td"),y.className="pvtVal row"+d+" col"+h,y.textContent=r.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement("td"),y.className="pvtTotal rowTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute("data-for","row"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement("tr"),w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("colspan",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement("td"),y.className="pvtTotal colTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute("data-for","col"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement("td"),y.className="pvtGrandTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute("data-numrows",v.length),f.setAttribute("data-numcols",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r="en"),null==h[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.renderError)}}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s="en"),null==h[s]&&(s="en"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e]["null"]=I));for(e in m)o=null!=(r=t[e])?r:"null",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$="auto"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?"pvtVertList":"pvtHorizList"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>D.menuLimit)x.append(t("").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t("").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("")),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(""),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!l).data("filter",[n,y]).appendTo(s).bind("change",function(){return t(this).toggleClass("changed")}),s.append(t("").addClass("value").text(y)),s.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(s));return o=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=D.menuLimit&&t("",{type:"button"}).text(D.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),o()}),t("",{type:"button"}).text(D.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),o()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=D.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(M={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",D.rowOrder).html(M[D.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",D.colOrder).html(M[D.colOrder].colSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),R=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),D.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=D.cols,F=0,N=q.length;N>F;F++)X=q[F],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(X,W)));for(z=D.rows,E=0,T=z.length;T>E;E++)X=z[E],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(X,W)));null!=D.aggregatorName&&this.find(".pvtAggregator").val(D.aggregatorName),null!=D.rendererName&&this.find(".pvtRenderer").val(D.rendererName),A=!0,V=function(n){return function(){var r,a,o,i,s,l,d,h,p,m,v,b,C,y;if(m={derivedAttributes:D.derivedAttributes,localeStrings:D.localeStrings,rendererOptions:D.rendererOptions,sorters:D.sorters,cols:[],rows:[],dataClass:D.dataClass},s=null!=(h=D.aggregators[u.val()]([])().numInputs)?h:0,y=[],n.find(".pvtRows li span.pvtAttr").each(function(){return m.rows.push(t(this).data("attrName"))}),n.find(".pvtCols li span.pvtAttr").each(function(){return m.cols.push(t(this).data("attrName"))}),n.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===s?t(this).remove():(s--,""!==t(this).val()?y.push(t(this).val()):void 0)}),0!==s)for(d=n.find(".pvtVals"),X=v=0,p=s;p>=0?p>v:v>p;X=p>=0?++v:--v){for(i=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,o=W.length;o>b;b++)c=W[b],i.append(t("").val(c).text(c));d.append(i)}return A&&(y=D.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),m.aggregatorName=u.val(),m.vals=y,m.aggregator=D.aggregators[u.val()](y),m.renderer=D.renderers[j.val()],m.rowOrder=B.data("order"),m.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]:void 0}),m.filter=function(t){var n,a,o,i;if(!D.filter(t))return!1;for(a in r)if(n=r[a],o=""+(null!=(i=t[a])?i:"null"),e.call(n,o)>=0)return!1;return!0},R.pivot(O,m),l=t.extend({},D,{cols:m.cols,rows:m.rows,colOrder:m.colOrder,rowOrder:m.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",l),D.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(C)),R.css("opacity",1),null!=D.onRefresh?D.onRefresh(l):void 0}}(this),U=function(t){return function(){return R.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?U():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(D.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,o,i,s,l,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,o,i;return o=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],o(function(t){return i.push(t)}),a=r(i),o(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(o=s=0,h=c;h>=0?h>s:s>h;o=h>=0?++s:--s)a(".pvtVal.row"+o);break;case"colheatmap":for(i=l=0,p=u;p>=0?p>l:l>p;i=p>=0?++l:--l)a(".pvtVal.col"+i)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,o,i;for(o=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,o,i;return r=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],r(function(t){return i.push(t)}),a=Math.max.apply(Math,i),o=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,i=o;i>=0?i>r:r>i;n=i>=0?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); -//# sourceMappingURL=pivot.min.js.map \ No newline at end of file +(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;e1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(i);)i=i.replace(r,"$1"+e+"$2");return i+o},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=o((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},x=g(),S=g({digitsAfterDecimal:0}),N=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),l={count:function(t){return null==t&&(t=S),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=S),function(r){var a;return a=r[0],function(r,i,o){return{uniq:[],push:function(t){var n;if(n=t[a],e.call(this.uniq,n)<0)return this.uniq.push(t[a])},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=x),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){if(!isNaN(parseFloat(t[n])))return this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{val:null,sorter:h(null!=n?n.sorters:void 0,r),push:function(e){var n,a,i,o;if(o=e[r],"min"!==t&&"max"!==t||(o=parseFloat(o),isNaN(o)||(this.val=Math[t](o,null!=(n=this.val)?n:o))),"first"===t&&this.sorter(o,null!=(a=this.val)?a:o)<=0&&(this.val=o),"last"===t&&this.sorter(o,null!=(i=this.val)?i:o)>=0)return this.val=o},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{vals:[],push:function(t){var e;if(e=parseFloat(t[r]),!isNaN(e))return this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=x),function(r){var a;return a=r[0],function(r,i,o){return{n:0,m:0,s:0,push:function(t){var e,n;if(n=parseFloat(t[a]),!isNaN(n))return this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e)},value:function(){if("mean"===t)return 0===this.n?NaN:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=x),function(e){var n,r;return r=e[0],n=e[1],function(e,a,i){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),!isNaN(parseFloat(t[n])))return this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=x),function(n){var r,a;return a=n[0],r=n[1],function(n,i,o){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),!isNaN(parseFloat(t[r])))return this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=N),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,i,o){return{selector:{total:[[],[]],row:[i,[]],col:[[],o]}[e],inner:t.apply(null,a)(n,i,o),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},l.countUnique=function(t){return l.uniques(function(t){return t.length},t)},l.listUnique=function(t){return l.uniques(function(e){return e.join(t)},function(t){return t})},l.max=function(t){return l.extremes("max",t)},l.min=function(t){return l.extremes("min",t)},l.first=function(t){return l.extremes("first",t)},l.last=function(t){return l.extremes("last",t)},l.median=function(t){return l.quantile(.5,t)},l.average=function(t){return l.runningStat("mean",1,t)},l["var"]=function(t,e){return l.runningStat("var",t,e)},l.stdev=function(t,e){return l.runningStat("stdev",t,e)},s=function(t){return{Count:t.count(S),"Count Unique Values":t.countUnique(S),"List Unique Values":t.listUnique(", "),Sum:t.sum(x),"Integer Sum":t.sum(S),Average:t.average(x),Median:t.median(x),"Sample Variance":t["var"](1,x),"Sample Standard Deviation":t.stdev(1,x),Minimum:t.min(x),Maximum:t.max(x),First:t.first(x),Last:t.last(x),"Sum over Sum":t.sumOverSum(x),"80% Upper Bound":t.sumOverSumBound80(!0,x),"80% Lower Bound":t.sumOverSumBound80(!1,x),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",N),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",N),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",N),"Count as Fraction of Total":t.fractionOf(t.count(),"total",N),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",N),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",N)}}(l),C={Table:function(t,e){return v(t,e)},"Table Barchart":function(e,n){return t(v(e,n)).barchart()},Heatmap:function(e,n){return t(v(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(v(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(v(e,n)).heatmap("colheatmap",n)}},u={text:function(t){return document.createTextNode(t)},byType:function(t,e){return function(n,r){return(t[r]||e||u.text).apply(this,arguments)}}},p={en:{aggregators:s,renderers:C,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T=function(t){return("0"+t).substr(-2,2)},d={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var i;return null==n&&(n=!1),null==r&&(r=f),null==a&&(a=c),i=n?"UTC":"",function(n){var o;return o=new Date(Date.parse(n[t])),isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o["get"+i+"FullYear"]();case"m":return T(o["get"+i+"Month"]()+1);case"n":return r[o["get"+i+"Month"]()];case"d":return T(o["get"+i+"Date"]());case"w":return a[o["get"+i+"Day"]()];case"x":return o["get"+i+"Day"]();case"H":return T(o["get"+i+"Hours"]());case"M":return T(o["get"+i+"Minutes"]());case"S":return T(o["get"+i+"Seconds"]());default:return"%"+e}})}}},y=/(\d+)|(\D+)/g,b=/\d/,w=/^0/,m=function(t){return function(t,e){var n,r,a,i,o,l;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(o=+t,l=+e,ol)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(l)&&!isNaN(o))return-1;if(isNaN(o)&&!isNaN(l))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!b.test(n)||!b.test(a))return n>a?1:-1;for(n=n.match(y),a=a.match(y);n.length&&a.length;)if(r=n.shift(),i=a.shift(),r!==i)return b.test(r)&&b.test(i)?r.replace(w,".0")-i.replace(w,".0"):r>i?1:-1;return n.length-a.length}}(this),A=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:m(t,e)}},h=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return m},i=function(){function e(t,n){var a,i,o,s,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:l.count()(),this.aggregatorName=null!=(i=n.aggregatorName)?i:"Count",this.colAttrs=null!=(o=n.cols)?o:[],this.rowAttrs=null!=(s=n.rows)?s:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){if(t.filter(e))return t.processRecord(e)}}(this))}return e.forEachRecord=function(e,n,r){var i,o,l,s,u,c,d,h,p,f,m,g;if(i=t.isEmptyObject(n)?r:function(t){var e,a,i;for(e in n)i=n[e],t[e]=null!=(a=i(t))?a:t[e];return r(t)},t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(l in e)if(a.call(e,l)&&(o=e[l],l>0)){h={},p=e[0];for(s in p)a.call(p,s)&&(u=p[s],h[u]=o[s]);f.push(i(h))}return f}for(m=[],c=0,d=e.length;c tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),i(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,i,o;if(e.filter(r)){for(a in t)if(o=t[a],o!==(null!=(i=r[a])?i:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;n=l;c=0<=l?++r:--r)t[e-1][c]!==t[e][c]&&(o=!1);if(o)return-1}for(a=0;e+a=s;c=0<=s?++i:--i)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},x=document.createElement("thead");for(p in o)if(a.call(o,p)){i=o[p],N=document.createElement("tr"),0===parseInt(p)&&0!==g.length&&(A=document.createElement("th"),A.setAttribute("colspan",g.length),A.setAttribute("rowspan",o.length),N.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(i)),N.appendChild(A);for(h in s)a.call(s,h)&&(l=s[h],_=C(s,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtColLabel",A.appendChild(n.headCellRenderer(l[p],i)),A.setAttribute("colspan",_),parseInt(p)===o.length-1&&0!==g.length&&A.setAttribute("rowspan",2),N.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",o.length+(0===g.length?0:1)),N.appendChild(A)),x.appendChild(N)}if(0!==g.length){N=document.createElement("tr");for(h in g)a.call(g,h)&&(f=g[h],A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(f)),N.appendChild(A));A=document.createElement("th"),0===o.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),N.appendChild(A),x.appendChild(N)}m.appendChild(x),y=document.createElement("tbody");for(h in b)if(a.call(b,h)){v=b[h],N=document.createElement("tr");for(p in v)a.call(v,p)&&(T=v[p],_=C(b,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtRowLabel",A.appendChild(n.headCellRenderer(T,g[p])),A.setAttribute("rowspan",_),parseInt(p)===g.length-1&&0!==o.length&&A.setAttribute("colspan",2),N.appendChild(A)));for(p in s)a.call(s,p)&&(l=s[p],r=e.getAggregator(v,l),k=r.value(),w=document.createElement("td"),w.className="pvtVal row"+h+" col"+p,w.appendChild(n.dataCellRenderer(r.format(k),v,l)),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,l)),N.appendChild(w));S=e.getAggregator(v,[]),k=S.value(),w=document.createElement("td"),w.className="pvtTotal rowTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,[])),w.setAttribute("data-for","row"+h),N.appendChild(w),y.appendChild(N)}N=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",g.length+(0===o.length?0:1)),N.appendChild(A);for(p in s)a.call(s,p)&&(l=s[p],S=e.getAggregator([],l),k=S.value(),w=document.createElement("td"),w.className="pvtTotal colTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],l)),w.setAttribute("data-for","col"+p),N.appendChild(w));return S=e.getAggregator([],[]),k=S.value(),w=document.createElement("td"),w.className="pvtGrandTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],[])),N.appendChild(w),y.appendChild(N),m.appendChild(y),m.setAttribute("data-numrows",b.length),m.setAttribute("data-numcols",s.length),m},t.fn.pivot=function(e,n,r){var a,o,s,u,c,d,h,f;null==r&&(r="en"),null==p[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:v},u=t.extend(!0,{},p.en.localeStrings,p[r].localeStrings),s={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},s,t.extend({},a,n)),h=null;try{d=new c.dataClass(e,c);try{h=c.renderer(d,c.rendererOptions)}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.renderError)}}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(h)},t.fn.pivotUI=function(n,r,o,l){var s,u,c,d,f,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,R,E,D,M,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==o&&(o=!1),null==l&&(l="en"),null==p[l]&&(l="en"),v={derivedAttributes:{},aggregators:p[l].aggregators,renderers:p[l].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},p.en.localeStrings,p[l].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),E=null==C||o?t.extend(!0,{},k,t.extend({},v,r)):C;try{f={},O=[],I=0,i.forEachRecord(n,E.derivedAttributes,function(t){var e,n,r,i;if(E.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==f[e]&&(f[e]={},I>0&&(f[e]["null"]=I));for(e in f)i=null!=(r=t[e])?r:"null",null==(n=f[e])[i]&&(n[i]=0),f[e][i]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=E.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(s in f)e.call(E.hiddenAttributes,s)<0&&t.push(s);return t}(),Y=!1,$="auto"===E.unusedAttrsVertical?120:parseInt(E.unusedAttrsVertical),!isNaN($)){for(d=0,x=0,S=W.length;x$}E.unusedAttrsVertical===!0||Y?Q.addClass("pvtVertList"):Q.addClass("pvtHorizList"),y=function(n){var r,a,i,o,l,s,u,c,d,p,m,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in f[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>E.menuLimit)x.append(t("").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC,EAAAC,KAAAC,OAAAF,EAAAD,EAAAA,IAAA,GAAAA,IAAAE,OAAAA,KAAAF,KAAAD,EAAA,MAAAC,EAAA,OAAA,ICGII,KAAWA,MACXC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,aAChEC,KAAaC,gBDLjBd,EAAiB,SAACe,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,WACC,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GAEZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CC6qDA,ODzqDAnB,GAAgB,SAACoB,EAAMC,EAAcC,GAC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hZ,EAAE,SAASqW,KACjBD,SAAY,WACZ6C,OAAU,SACdD,EAAQ/G,OAAOjS,EAAE,SAASqW,KACtBD,SAAY,WACZ8C,OAAU,EACVjD,KAAQ,EACRkD,MAAS,EACTF,OAAU9W,EAAOT,GAAK,IACtB0X,mBAAoB,UACxBJ,EAAQ/G,OAAOjS,EAAE,SAASoO,KAAKA,GAAMiI,KACjCD,SAAW,WACXiD,eAAe,MACfC,gBAAgB,SAEpBR,EAAKzC,KAAIkD,QAAW,EAAEC,cAAe,MAAOC,aAAc,WAAU5H,KAAKmH,OA3BpEja,MA6ByBF,EAAAC,EAAA,EAAA0E,EAAAiV,EAAAjV,GAAA,EAAAA,EAAA1E,EAAAA,EAAA0E,EAAA3E,EAAA2E,GAAA,IAAA1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n"]} \ No newline at end of file diff --git a/dist/pivot.min.js b/dist/pivot.min.js index 27181d11..13b24ce4 100644 --- a/dist/pivot.min.js +++ b/dist/pivot.min.js @@ -1,2 +1,2 @@ -(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+="",a=t.split("."),o=a[0],i=a.length>1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(o);)o=o.replace(r,"$1"+e+"$2");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:"%"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],("min"===t||"max"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),"first"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),"last"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if("mean"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes("max",t)},s.min=function(t){return s.extremes("min",t)},s.first=function(t){return s.extremes("first",t)},s.last=function(t){return s.extremes("last",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat("mean",1,t)},s["var"]=function(t,e){return s.runningStat("var",t,e)},s.stdev=function(t,e){return s.runningStat("stdev",t,e)},l=function(t){return{Count:t.count(x),"Count Unique Values":t.countUnique(x),"List Unique Values":t.listUnique(", "),Sum:t.sum(A),"Integer Sum":t.sum(x),Average:t.average(A),Median:t.median(A),"Sample Variance":t["var"](1,A),"Sample Standard Deviation":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),"Sum over Sum":t.sumOverSum(A),"80% Upper Bound":t.sumOverSumBound80(!0,A),"80% Lower Bound":t.sumOverSumBound80(!1,A),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",S),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",S),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",S),"Count as Fraction of Total":t.fractionOf(t.count(),"total",S),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",S),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",S)}}(s),b={Table:function(t,e){return g(t,e)},"Table Barchart":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(g(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(g(e,n)).heatmap("colheatmap",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],N=function(t){return("0"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?"UTC":"",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return i["get"+o+"FullYear"]();case"m":return N(i["get"+o+"Month"]()+1);case"n":return r[i["get"+o+"Month"]()];case"d":return N(i["get"+o+"Date"]());case"w":return a[i["get"+o+"Day"]()];case"x":return i["get"+o+"Day"]();case"H":return N(i["get"+o+"Hours"]());case"M":return N(i["get"+o+"Minutes"]());case"S":return N(i["get"+o+"Seconds"]());default:return"%"+e}})}}},C=/(\d+)|(\D+)/g,v=/\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,".0")-o.replace(y,".0"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:"Count",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t("thead > tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case"value_a_to_z":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case"value_z_to_a":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case"value_a_to_z":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case"value_z_to_a":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:"null");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:"null");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return""}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:"Totals"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement("table"),f.className="pvtTable",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement("thead");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement("tr"),0===parseInt(h)&&0!==m.length&&(w=document.createElement("th"),w.setAttribute("colspan",m.length),w.setAttribute("rowspan",i.length),S.appendChild(w)),w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtColLabel",w.textContent=s[h],w.setAttribute("colspan",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute("rowspan",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("rowspan",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement("tr");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=p,S.appendChild(w));w=document.createElement("th"),0===i.length&&(w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement("tbody");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement("tr");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtRowLabel",w.textContent=N,w.setAttribute("rowspan",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute("colspan",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement("td"),y.className="pvtVal row"+d+" col"+h,y.textContent=r.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement("td"),y.className="pvtTotal rowTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute("data-for","row"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement("tr"),w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("colspan",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement("td"),y.className="pvtTotal colTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute("data-for","col"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement("td"),y.className="pvtGrandTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute("data-numrows",v.length),f.setAttribute("data-numcols",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r="en"),null==h[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.renderError)}}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s="en"),null==h[s]&&(s="en"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e]["null"]=I));for(e in m)o=null!=(r=t[e])?r:"null",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$="auto"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?"pvtVertList":"pvtHorizList"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>D.menuLimit)x.append(t("").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t("").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("")),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(""),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!l).data("filter",[n,y]).appendTo(s).bind("change",function(){return t(this).toggleClass("changed")}),s.append(t("").addClass("value").text(y)),s.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(s));return o=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=D.menuLimit&&t("",{type:"button"}).text(D.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),o()}),t("",{type:"button"}).text(D.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),o()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=D.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(M={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",D.rowOrder).html(M[D.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",D.colOrder).html(M[D.colOrder].colSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),R=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),D.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=D.cols,F=0,N=q.length;N>F;F++)X=q[F],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(X,W)));for(z=D.rows,E=0,T=z.length;T>E;E++)X=z[E],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(X,W)));null!=D.aggregatorName&&this.find(".pvtAggregator").val(D.aggregatorName),null!=D.rendererName&&this.find(".pvtRenderer").val(D.rendererName),A=!0,V=function(n){return function(){var r,a,o,i,s,l,d,h,p,m,v,b,C,y;if(m={derivedAttributes:D.derivedAttributes,localeStrings:D.localeStrings,rendererOptions:D.rendererOptions,sorters:D.sorters,cols:[],rows:[],dataClass:D.dataClass},s=null!=(h=D.aggregators[u.val()]([])().numInputs)?h:0,y=[],n.find(".pvtRows li span.pvtAttr").each(function(){return m.rows.push(t(this).data("attrName"))}),n.find(".pvtCols li span.pvtAttr").each(function(){return m.cols.push(t(this).data("attrName"))}),n.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===s?t(this).remove():(s--,""!==t(this).val()?y.push(t(this).val()):void 0)}),0!==s)for(d=n.find(".pvtVals"),X=v=0,p=s;p>=0?p>v:v>p;X=p>=0?++v:--v){for(i=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,o=W.length;o>b;b++)c=W[b],i.append(t("").val(c).text(c));d.append(i)}return A&&(y=D.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),m.aggregatorName=u.val(),m.vals=y,m.aggregator=D.aggregators[u.val()](y),m.renderer=D.renderers[j.val()],m.rowOrder=B.data("order"),m.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]:void 0}),m.filter=function(t){var n,a,o,i;if(!D.filter(t))return!1;for(a in r)if(n=r[a],o=""+(null!=(i=t[a])?i:"null"),e.call(n,o)>=0)return!1;return!0},R.pivot(O,m),l=t.extend({},D,{cols:m.cols,rows:m.rows,colOrder:m.colOrder,rowOrder:m.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",l),D.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(C)),R.css("opacity",1),null!=D.onRefresh?D.onRefresh(l):void 0}}(this),U=function(t){return function(){return R.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?U():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(D.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,o,i,s,l,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,o,i;return o=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],o(function(t){return i.push(t)}),a=r(i),o(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(o=s=0,h=c;h>=0?h>s:s>h;o=h>=0?++s:--s)a(".pvtVal.row"+o);break;case"colheatmap":for(i=l=0,p=u;p>=0?p>l:l>p;i=p>=0?++l:--l)a(".pvtVal.col"+i)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,o,i;for(o=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,o,i;return r=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],r(function(t){return i.push(t)}),a=Math.max.apply(Math,i),o=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,i=o;i>=0?i>r:r>i;n=i>=0?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); -//# sourceMappingURL=pivot.min.js.map \ No newline at end of file +(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;e1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(i);)i=i.replace(r,"$1"+e+"$2");return i+o},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=o((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},x=g(),S=g({digitsAfterDecimal:0}),N=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),l={count:function(t){return null==t&&(t=S),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=S),function(r){var a;return a=r[0],function(r,i,o){return{uniq:[],push:function(t){var n;if(n=t[a],e.call(this.uniq,n)<0)return this.uniq.push(t[a])},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=x),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){if(!isNaN(parseFloat(t[n])))return this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{val:null,sorter:h(null!=n?n.sorters:void 0,r),push:function(e){var n,a,i,o;if(o=e[r],"min"!==t&&"max"!==t||(o=parseFloat(o),isNaN(o)||(this.val=Math[t](o,null!=(n=this.val)?n:o))),"first"===t&&this.sorter(o,null!=(a=this.val)?a:o)<=0&&(this.val=o),"last"===t&&this.sorter(o,null!=(i=this.val)?i:o)>=0)return this.val=o},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{vals:[],push:function(t){var e;if(e=parseFloat(t[r]),!isNaN(e))return this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=x),function(r){var a;return a=r[0],function(r,i,o){return{n:0,m:0,s:0,push:function(t){var e,n;if(n=parseFloat(t[a]),!isNaN(n))return this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e)},value:function(){if("mean"===t)return 0===this.n?NaN:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=x),function(e){var n,r;return r=e[0],n=e[1],function(e,a,i){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),!isNaN(parseFloat(t[n])))return this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=x),function(n){var r,a;return a=n[0],r=n[1],function(n,i,o){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),!isNaN(parseFloat(t[r])))return this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=N),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,i,o){return{selector:{total:[[],[]],row:[i,[]],col:[[],o]}[e],inner:t.apply(null,a)(n,i,o),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},l.countUnique=function(t){return l.uniques(function(t){return t.length},t)},l.listUnique=function(t){return l.uniques(function(e){return e.join(t)},function(t){return t})},l.max=function(t){return l.extremes("max",t)},l.min=function(t){return l.extremes("min",t)},l.first=function(t){return l.extremes("first",t)},l.last=function(t){return l.extremes("last",t)},l.median=function(t){return l.quantile(.5,t)},l.average=function(t){return l.runningStat("mean",1,t)},l["var"]=function(t,e){return l.runningStat("var",t,e)},l.stdev=function(t,e){return l.runningStat("stdev",t,e)},s=function(t){return{Count:t.count(S),"Count Unique Values":t.countUnique(S),"List Unique Values":t.listUnique(", "),Sum:t.sum(x),"Integer Sum":t.sum(S),Average:t.average(x),Median:t.median(x),"Sample Variance":t["var"](1,x),"Sample Standard Deviation":t.stdev(1,x),Minimum:t.min(x),Maximum:t.max(x),First:t.first(x),Last:t.last(x),"Sum over Sum":t.sumOverSum(x),"80% Upper Bound":t.sumOverSumBound80(!0,x),"80% Lower Bound":t.sumOverSumBound80(!1,x),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",N),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",N),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",N),"Count as Fraction of Total":t.fractionOf(t.count(),"total",N),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",N),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",N)}}(l),C={Table:function(t,e){return v(t,e)},"Table Barchart":function(e,n){return t(v(e,n)).barchart()},Heatmap:function(e,n){return t(v(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(v(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(v(e,n)).heatmap("colheatmap",n)}},u={text:function(t){return document.createTextNode(t)},byType:function(t,e){return function(n,r){return(t[r]||e||u.text).apply(this,arguments)}}},p={en:{aggregators:s,renderers:C,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T=function(t){return("0"+t).substr(-2,2)},d={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var i;return null==n&&(n=!1),null==r&&(r=f),null==a&&(a=c),i=n?"UTC":"",function(n){var o;return o=new Date(Date.parse(n[t])),isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o["get"+i+"FullYear"]();case"m":return T(o["get"+i+"Month"]()+1);case"n":return r[o["get"+i+"Month"]()];case"d":return T(o["get"+i+"Date"]());case"w":return a[o["get"+i+"Day"]()];case"x":return o["get"+i+"Day"]();case"H":return T(o["get"+i+"Hours"]());case"M":return T(o["get"+i+"Minutes"]());case"S":return T(o["get"+i+"Seconds"]());default:return"%"+e}})}}},y=/(\d+)|(\D+)/g,b=/\d/,w=/^0/,m=function(t){return function(t,e){var n,r,a,i,o,l;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(o=+t,l=+e,ol)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(l)&&!isNaN(o))return-1;if(isNaN(o)&&!isNaN(l))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!b.test(n)||!b.test(a))return n>a?1:-1;for(n=n.match(y),a=a.match(y);n.length&&a.length;)if(r=n.shift(),i=a.shift(),r!==i)return b.test(r)&&b.test(i)?r.replace(w,".0")-i.replace(w,".0"):r>i?1:-1;return n.length-a.length}}(this),A=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:m(t,e)}},h=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return m},i=function(){function e(t,n){var a,i,o,s,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:l.count()(),this.aggregatorName=null!=(i=n.aggregatorName)?i:"Count",this.colAttrs=null!=(o=n.cols)?o:[],this.rowAttrs=null!=(s=n.rows)?s:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){if(t.filter(e))return t.processRecord(e)}}(this))}return e.forEachRecord=function(e,n,r){var i,o,l,s,u,c,d,h,p,f,m,g;if(i=t.isEmptyObject(n)?r:function(t){var e,a,i;for(e in n)i=n[e],t[e]=null!=(a=i(t))?a:t[e];return r(t)},t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(l in e)if(a.call(e,l)&&(o=e[l],l>0)){h={},p=e[0];for(s in p)a.call(p,s)&&(u=p[s],h[u]=o[s]);f.push(i(h))}return f}for(m=[],c=0,d=e.length;c tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),i(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,i,o;if(e.filter(r)){for(a in t)if(o=t[a],o!==(null!=(i=r[a])?i:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;n=l;c=0<=l?++r:--r)t[e-1][c]!==t[e][c]&&(o=!1);if(o)return-1}for(a=0;e+a=s;c=0<=s?++i:--i)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},x=document.createElement("thead");for(p in o)if(a.call(o,p)){i=o[p],N=document.createElement("tr"),0===parseInt(p)&&0!==g.length&&(A=document.createElement("th"),A.setAttribute("colspan",g.length),A.setAttribute("rowspan",o.length),N.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(i)),N.appendChild(A);for(h in s)a.call(s,h)&&(l=s[h],_=C(s,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtColLabel",A.appendChild(n.headCellRenderer(l[p],i)),A.setAttribute("colspan",_),parseInt(p)===o.length-1&&0!==g.length&&A.setAttribute("rowspan",2),N.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",o.length+(0===g.length?0:1)),N.appendChild(A)),x.appendChild(N)}if(0!==g.length){N=document.createElement("tr");for(h in g)a.call(g,h)&&(f=g[h],A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(f)),N.appendChild(A));A=document.createElement("th"),0===o.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),N.appendChild(A),x.appendChild(N)}m.appendChild(x),y=document.createElement("tbody");for(h in b)if(a.call(b,h)){v=b[h],N=document.createElement("tr");for(p in v)a.call(v,p)&&(T=v[p],_=C(b,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtRowLabel",A.appendChild(n.headCellRenderer(T,g[p])),A.setAttribute("rowspan",_),parseInt(p)===g.length-1&&0!==o.length&&A.setAttribute("colspan",2),N.appendChild(A)));for(p in s)a.call(s,p)&&(l=s[p],r=e.getAggregator(v,l),k=r.value(),w=document.createElement("td"),w.className="pvtVal row"+h+" col"+p,w.appendChild(n.dataCellRenderer(r.format(k),v,l)),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,l)),N.appendChild(w));S=e.getAggregator(v,[]),k=S.value(),w=document.createElement("td"),w.className="pvtTotal rowTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,[])),w.setAttribute("data-for","row"+h),N.appendChild(w),y.appendChild(N)}N=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",g.length+(0===o.length?0:1)),N.appendChild(A);for(p in s)a.call(s,p)&&(l=s[p],S=e.getAggregator([],l),k=S.value(),w=document.createElement("td"),w.className="pvtTotal colTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],l)),w.setAttribute("data-for","col"+p),N.appendChild(w));return S=e.getAggregator([],[]),k=S.value(),w=document.createElement("td"),w.className="pvtGrandTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],[])),N.appendChild(w),y.appendChild(N),m.appendChild(y),m.setAttribute("data-numrows",b.length),m.setAttribute("data-numcols",s.length),m},t.fn.pivot=function(e,n,r){var a,o,s,u,c,d,h,f;null==r&&(r="en"),null==p[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:v},u=t.extend(!0,{},p.en.localeStrings,p[r].localeStrings),s={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},s,t.extend({},a,n)),h=null;try{d=new c.dataClass(e,c);try{h=c.renderer(d,c.rendererOptions)}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.renderError)}}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(h)},t.fn.pivotUI=function(n,r,o,l){var s,u,c,d,f,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,R,E,D,M,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==o&&(o=!1),null==l&&(l="en"),null==p[l]&&(l="en"),v={derivedAttributes:{},aggregators:p[l].aggregators,renderers:p[l].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},p.en.localeStrings,p[l].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),E=null==C||o?t.extend(!0,{},k,t.extend({},v,r)):C;try{f={},O=[],I=0,i.forEachRecord(n,E.derivedAttributes,function(t){var e,n,r,i;if(E.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==f[e]&&(f[e]={},I>0&&(f[e]["null"]=I));for(e in f)i=null!=(r=t[e])?r:"null",null==(n=f[e])[i]&&(n[i]=0),f[e][i]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=E.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(s in f)e.call(E.hiddenAttributes,s)<0&&t.push(s);return t}(),Y=!1,$="auto"===E.unusedAttrsVertical?120:parseInt(E.unusedAttrsVertical),!isNaN($)){for(d=0,x=0,S=W.length;x$}E.unusedAttrsVertical===!0||Y?Q.addClass("pvtVertList"):Q.addClass("pvtHorizList"),y=function(n){var r,a,i,o,l,s,u,c,d,p,m,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in f[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>E.menuLimit)x.append(t("").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC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C8D,KAAK,WAEhBkW,EAAa,SAAAtO,GCuoBb,MDvoBa,UAAC4N,GACV,GAAAQ,GAAApS,EAAAtE,EAAA+S,CCypBF,ODzpBE2D,GAAc,SAACvS,GCyoBf,MDxoBImE,GAACkL,KAAK0C,GAAOlK,KAAK,WACd,GAAAzM,EACA,OADAA,GAAI1B,EAAEjB,MAAM8D,KAAK,SACA,MAAAnB,GAAOe,SAASf,GAAjC4E,EAAE5E,EAAG1B,EAAEjB,OAAP,UAERmW,KACA2D,EAAY,SAACnX,GC6oBb,MD7oBmBwT,GAAOlS,KAAKtB,KAC/B+E,EAAMrC,KAAKqC,IAALpH,MAAA+E,KAAS8Q,GACf/S,EAAS,SAACT,GC+oBV,MD/oBgB,KAAIA,GAAG,IAAI+E,IAC3BoS,EAAY,SAACnX,EAAGoX,GACZ,GAAA1K,GAAA4K,CCmqBJ,ODnqBI5K,GAAO0K,EAAK1K,OACZ4K,EAAUhZ,EAAE,SAASqW,KACjBD,SAAY,WACZ6C,OAAU,SACdD,EAAQ/G,OAAOjS,EAAE,SAASqW,KACtBD,SAAY,WACZ8C,OAAU,EACVjD,KAAQ,EACRkD,MAAS,EACTF,OAAU9W,EAAOT,GAAK,IACtB0X,mBAAoB,UACxBJ,EAAQ/G,OAAOjS,EAAE,SAASoO,KAAKA,GAAMiI,KACjCD,SAAW,WACXiD,eAAe,MACfC,gBAAgB,SAEpBR,EAAKzC,KAAIkD,QAAW,EAAEC,cAAe,MAAOC,aAAc,WAAU5H,KAAKmH,OA3BpEja,MA6ByBF,EAAAC,EAAA,EAAA0E,EAAAiV,EAAAjV,GAAA,EAAAA,EAAA1E,EAAAA,EAAA0E,EAAA3E,EAAA2E,GAAA,IAAA1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n"]} \ No newline at end of file diff --git a/dist/pivot.min.js b/dist/pivot.min.js index 27181d11..13b24ce4 100644 --- a/dist/pivot.min.js +++ b/dist/pivot.min.js @@ -1,2 +1,2 @@ -(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+="",a=t.split("."),o=a[0],i=a.length>1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(o);)o=o.replace(r,"$1"+e+"$2");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:"%"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],("min"===t||"max"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),"first"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),"last"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if("mean"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes("max",t)},s.min=function(t){return s.extremes("min",t)},s.first=function(t){return s.extremes("first",t)},s.last=function(t){return s.extremes("last",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat("mean",1,t)},s["var"]=function(t,e){return s.runningStat("var",t,e)},s.stdev=function(t,e){return s.runningStat("stdev",t,e)},l=function(t){return{Count:t.count(x),"Count Unique Values":t.countUnique(x),"List Unique Values":t.listUnique(", "),Sum:t.sum(A),"Integer Sum":t.sum(x),Average:t.average(A),Median:t.median(A),"Sample Variance":t["var"](1,A),"Sample Standard Deviation":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),"Sum over Sum":t.sumOverSum(A),"80% Upper Bound":t.sumOverSumBound80(!0,A),"80% Lower Bound":t.sumOverSumBound80(!1,A),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",S),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",S),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",S),"Count as Fraction of Total":t.fractionOf(t.count(),"total",S),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",S),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",S)}}(s),b={Table:function(t,e){return g(t,e)},"Table Barchart":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(g(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(g(e,n)).heatmap("colheatmap",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],N=function(t){return("0"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?"UTC":"",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return i["get"+o+"FullYear"]();case"m":return N(i["get"+o+"Month"]()+1);case"n":return r[i["get"+o+"Month"]()];case"d":return N(i["get"+o+"Date"]());case"w":return a[i["get"+o+"Day"]()];case"x":return i["get"+o+"Day"]();case"H":return N(i["get"+o+"Hours"]());case"M":return N(i["get"+o+"Minutes"]());case"S":return N(i["get"+o+"Seconds"]());default:return"%"+e}})}}},C=/(\d+)|(\D+)/g,v=/\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,".0")-o.replace(y,".0"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:"Count",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t("thead > tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case"value_a_to_z":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case"value_z_to_a":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case"value_a_to_z":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case"value_z_to_a":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:"null");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:"null");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return""}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:"Totals"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement("table"),f.className="pvtTable",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement("thead");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement("tr"),0===parseInt(h)&&0!==m.length&&(w=document.createElement("th"),w.setAttribute("colspan",m.length),w.setAttribute("rowspan",i.length),S.appendChild(w)),w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtColLabel",w.textContent=s[h],w.setAttribute("colspan",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute("rowspan",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("rowspan",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement("tr");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement("th"),w.className="pvtAxisLabel",w.textContent=p,S.appendChild(w));w=document.createElement("th"),0===i.length&&(w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement("tbody");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement("tr");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement("th"),w.className="pvtRowLabel",w.textContent=N,w.setAttribute("rowspan",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute("colspan",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement("td"),y.className="pvtVal row"+d+" col"+h,y.textContent=r.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement("td"),y.className="pvtTotal rowTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute("data-for","row"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement("tr"),w=document.createElement("th"),w.className="pvtTotalLabel",w.innerHTML=n.localeStrings.totals,w.setAttribute("colspan",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement("td"),y.className="pvtTotal colTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute("data-for","col"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement("td"),y.className="pvtGrandTotal",y.textContent=x.format(T),y.setAttribute("data-value",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute("data-numrows",v.length),f.setAttribute("data-numcols",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r="en"),null==h[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.renderError)}}catch(m){i=m,"undefined"!=typeof console&&null!==console&&console.error(i.stack),p=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s="en"),null==h[s]&&(s="en"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e]["null"]=I));for(e in m)o=null!=(r=t[e])?r:"null",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$="auto"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?"pvtVertList":"pvtHorizList"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>D.menuLimit)x.append(t("").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t("").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("")),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(""),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!l).data("filter",[n,y]).appendTo(s).bind("change",function(){return t(this).toggleClass("changed")}),s.append(t("").addClass("value").text(y)),s.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(s));return o=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=D.menuLimit&&t("",{type:"button"}).text(D.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),o()}),t("",{type:"button"}).text(D.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),o()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=D.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(M={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",D.rowOrder).html(M[D.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",D.colOrder).html(M[D.colOrder].colSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),R=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),D.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=D.cols,F=0,N=q.length;N>F;F++)X=q[F],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(X,W)));for(z=D.rows,E=0,T=z.length;T>E;E++)X=z[E],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(X,W)));null!=D.aggregatorName&&this.find(".pvtAggregator").val(D.aggregatorName),null!=D.rendererName&&this.find(".pvtRenderer").val(D.rendererName),A=!0,V=function(n){return function(){var r,a,o,i,s,l,d,h,p,m,v,b,C,y;if(m={derivedAttributes:D.derivedAttributes,localeStrings:D.localeStrings,rendererOptions:D.rendererOptions,sorters:D.sorters,cols:[],rows:[],dataClass:D.dataClass},s=null!=(h=D.aggregators[u.val()]([])().numInputs)?h:0,y=[],n.find(".pvtRows li span.pvtAttr").each(function(){return m.rows.push(t(this).data("attrName"))}),n.find(".pvtCols li span.pvtAttr").each(function(){return m.cols.push(t(this).data("attrName"))}),n.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===s?t(this).remove():(s--,""!==t(this).val()?y.push(t(this).val()):void 0)}),0!==s)for(d=n.find(".pvtVals"),X=v=0,p=s;p>=0?p>v:v>p;X=p>=0?++v:--v){for(i=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,o=W.length;o>b;b++)c=W[b],i.append(t("").val(c).text(c));d.append(i)}return A&&(y=D.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),m.aggregatorName=u.val(),m.vals=y,m.aggregator=D.aggregators[u.val()](y),m.renderer=D.renderers[j.val()],m.rowOrder=B.data("order"),m.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]:void 0}),m.filter=function(t){var n,a,o,i;if(!D.filter(t))return!1;for(a in r)if(n=r[a],o=""+(null!=(i=t[a])?i:"null"),e.call(n,o)>=0)return!1;return!0},R.pivot(O,m),l=t.extend({},D,{cols:m.cols,rows:m.rows,colOrder:m.colOrder,rowOrder:m.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",l),D.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(C)),R.css("opacity",1),null!=D.onRefresh?D.onRefresh(l):void 0}}(this),U=function(t){return function(){return R.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?U():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(D.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,o,i,s,l,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,o,i;return o=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],o(function(t){return i.push(t)}),a=r(i),o(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(o=s=0,h=c;h>=0?h>s:s>h;o=h>=0?++s:--s)a(".pvtVal.row"+o);break;case"colheatmap":for(i=l=0,p=u;p>=0?p>l:l>p;i=p>=0?++l:--l)a(".pvtVal.col"+i)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,o,i;for(o=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,o,i;return r=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],r(function(t){return i.push(t)}),a=Math.max.apply(Math,i),o=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,i=o;i>=0?i>r:r>i;n=i>=0?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); -//# sourceMappingURL=pivot.min.js.map \ No newline at end of file +(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;e1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(i);)i=i.replace(r,"$1"+e+"$2");return i+o},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=o((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},x=g(),S=g({digitsAfterDecimal:0}),N=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),l={count:function(t){return null==t&&(t=S),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=S),function(r){var a;return a=r[0],function(r,i,o){return{uniq:[],push:function(t){var n;if(n=t[a],e.call(this.uniq,n)<0)return this.uniq.push(t[a])},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=x),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){if(!isNaN(parseFloat(t[n])))return this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{val:null,sorter:h(null!=n?n.sorters:void 0,r),push:function(e){var n,a,i,o;if(o=e[r],"min"!==t&&"max"!==t||(o=parseFloat(o),isNaN(o)||(this.val=Math[t](o,null!=(n=this.val)?n:o))),"first"===t&&this.sorter(o,null!=(a=this.val)?a:o)<=0&&(this.val=o),"last"===t&&this.sorter(o,null!=(i=this.val)?i:o)>=0)return this.val=o},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{vals:[],push:function(t){var e;if(e=parseFloat(t[r]),!isNaN(e))return this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=x),function(r){var a;return a=r[0],function(r,i,o){return{n:0,m:0,s:0,push:function(t){var e,n;if(n=parseFloat(t[a]),!isNaN(n))return this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e)},value:function(){if("mean"===t)return 0===this.n?NaN:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=x),function(e){var n,r;return r=e[0],n=e[1],function(e,a,i){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),!isNaN(parseFloat(t[n])))return this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=x),function(n){var r,a;return a=n[0],r=n[1],function(n,i,o){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),!isNaN(parseFloat(t[r])))return this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=N),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,i,o){return{selector:{total:[[],[]],row:[i,[]],col:[[],o]}[e],inner:t.apply(null,a)(n,i,o),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},l.countUnique=function(t){return l.uniques(function(t){return t.length},t)},l.listUnique=function(t){return l.uniques(function(e){return e.join(t)},function(t){return t})},l.max=function(t){return l.extremes("max",t)},l.min=function(t){return l.extremes("min",t)},l.first=function(t){return l.extremes("first",t)},l.last=function(t){return l.extremes("last",t)},l.median=function(t){return l.quantile(.5,t)},l.average=function(t){return l.runningStat("mean",1,t)},l["var"]=function(t,e){return l.runningStat("var",t,e)},l.stdev=function(t,e){return l.runningStat("stdev",t,e)},s=function(t){return{Count:t.count(S),"Count Unique Values":t.countUnique(S),"List Unique Values":t.listUnique(", "),Sum:t.sum(x),"Integer Sum":t.sum(S),Average:t.average(x),Median:t.median(x),"Sample Variance":t["var"](1,x),"Sample Standard Deviation":t.stdev(1,x),Minimum:t.min(x),Maximum:t.max(x),First:t.first(x),Last:t.last(x),"Sum over Sum":t.sumOverSum(x),"80% Upper Bound":t.sumOverSumBound80(!0,x),"80% Lower Bound":t.sumOverSumBound80(!1,x),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",N),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",N),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",N),"Count as Fraction of Total":t.fractionOf(t.count(),"total",N),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",N),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",N)}}(l),C={Table:function(t,e){return v(t,e)},"Table Barchart":function(e,n){return t(v(e,n)).barchart()},Heatmap:function(e,n){return t(v(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(v(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(v(e,n)).heatmap("colheatmap",n)}},u={text:function(t){return document.createTextNode(t)},byType:function(t,e){return function(n,r){return(t[r]||e||u.text).apply(this,arguments)}}},p={en:{aggregators:s,renderers:C,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T=function(t){return("0"+t).substr(-2,2)},d={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var i;return null==n&&(n=!1),null==r&&(r=f),null==a&&(a=c),i=n?"UTC":"",function(n){var o;return o=new Date(Date.parse(n[t])),isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o["get"+i+"FullYear"]();case"m":return T(o["get"+i+"Month"]()+1);case"n":return r[o["get"+i+"Month"]()];case"d":return T(o["get"+i+"Date"]());case"w":return a[o["get"+i+"Day"]()];case"x":return o["get"+i+"Day"]();case"H":return T(o["get"+i+"Hours"]());case"M":return T(o["get"+i+"Minutes"]());case"S":return T(o["get"+i+"Seconds"]());default:return"%"+e}})}}},y=/(\d+)|(\D+)/g,b=/\d/,w=/^0/,m=function(t){return function(t,e){var n,r,a,i,o,l;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(o=+t,l=+e,ol)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(l)&&!isNaN(o))return-1;if(isNaN(o)&&!isNaN(l))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!b.test(n)||!b.test(a))return n>a?1:-1;for(n=n.match(y),a=a.match(y);n.length&&a.length;)if(r=n.shift(),i=a.shift(),r!==i)return b.test(r)&&b.test(i)?r.replace(w,".0")-i.replace(w,".0"):r>i?1:-1;return n.length-a.length}}(this),A=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:m(t,e)}},h=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return m},i=function(){function e(t,n){var a,i,o,s,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:l.count()(),this.aggregatorName=null!=(i=n.aggregatorName)?i:"Count",this.colAttrs=null!=(o=n.cols)?o:[],this.rowAttrs=null!=(s=n.rows)?s:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){if(t.filter(e))return t.processRecord(e)}}(this))}return e.forEachRecord=function(e,n,r){var i,o,l,s,u,c,d,h,p,f,m,g;if(i=t.isEmptyObject(n)?r:function(t){var e,a,i;for(e in n)i=n[e],t[e]=null!=(a=i(t))?a:t[e];return r(t)},t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(l in e)if(a.call(e,l)&&(o=e[l],l>0)){h={},p=e[0];for(s in p)a.call(p,s)&&(u=p[s],h[u]=o[s]);f.push(i(h))}return f}for(m=[],c=0,d=e.length;c tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),i(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,i,o;if(e.filter(r)){for(a in t)if(o=t[a],o!==(null!=(i=r[a])?i:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;n=l;c=0<=l?++r:--r)t[e-1][c]!==t[e][c]&&(o=!1);if(o)return-1}for(a=0;e+a=s;c=0<=s?++i:--i)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},x=document.createElement("thead");for(p in o)if(a.call(o,p)){i=o[p],N=document.createElement("tr"),0===parseInt(p)&&0!==g.length&&(A=document.createElement("th"),A.setAttribute("colspan",g.length),A.setAttribute("rowspan",o.length),N.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(i)),N.appendChild(A);for(h in s)a.call(s,h)&&(l=s[h],_=C(s,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtColLabel",A.appendChild(n.headCellRenderer(l[p],i)),A.setAttribute("colspan",_),parseInt(p)===o.length-1&&0!==g.length&&A.setAttribute("rowspan",2),N.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",o.length+(0===g.length?0:1)),N.appendChild(A)),x.appendChild(N)}if(0!==g.length){N=document.createElement("tr");for(h in g)a.call(g,h)&&(f=g[h],A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(f)),N.appendChild(A));A=document.createElement("th"),0===o.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),N.appendChild(A),x.appendChild(N)}m.appendChild(x),y=document.createElement("tbody");for(h in b)if(a.call(b,h)){v=b[h],N=document.createElement("tr");for(p in v)a.call(v,p)&&(T=v[p],_=C(b,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtRowLabel",A.appendChild(n.headCellRenderer(T,g[p])),A.setAttribute("rowspan",_),parseInt(p)===g.length-1&&0!==o.length&&A.setAttribute("colspan",2),N.appendChild(A)));for(p in s)a.call(s,p)&&(l=s[p],r=e.getAggregator(v,l),k=r.value(),w=document.createElement("td"),w.className="pvtVal row"+h+" col"+p,w.appendChild(n.dataCellRenderer(r.format(k),v,l)),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,l)),N.appendChild(w));S=e.getAggregator(v,[]),k=S.value(),w=document.createElement("td"),w.className="pvtTotal rowTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,[])),w.setAttribute("data-for","row"+h),N.appendChild(w),y.appendChild(N)}N=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",g.length+(0===o.length?0:1)),N.appendChild(A);for(p in s)a.call(s,p)&&(l=s[p],S=e.getAggregator([],l),k=S.value(),w=document.createElement("td"),w.className="pvtTotal colTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],l)),w.setAttribute("data-for","col"+p),N.appendChild(w));return S=e.getAggregator([],[]),k=S.value(),w=document.createElement("td"),w.className="pvtGrandTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],[])),N.appendChild(w),y.appendChild(N),m.appendChild(y),m.setAttribute("data-numrows",b.length),m.setAttribute("data-numcols",s.length),m},t.fn.pivot=function(e,n,r){var a,o,s,u,c,d,h,f;null==r&&(r="en"),null==p[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:v},u=t.extend(!0,{},p.en.localeStrings,p[r].localeStrings),s={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},s,t.extend({},a,n)),h=null;try{d=new c.dataClass(e,c);try{h=c.renderer(d,c.rendererOptions)}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.renderError)}}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(h)},t.fn.pivotUI=function(n,r,o,l){var s,u,c,d,f,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,R,E,D,M,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==o&&(o=!1),null==l&&(l="en"),null==p[l]&&(l="en"),v={derivedAttributes:{},aggregators:p[l].aggregators,renderers:p[l].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},p.en.localeStrings,p[l].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),E=null==C||o?t.extend(!0,{},k,t.extend({},v,r)):C;try{f={},O=[],I=0,i.forEachRecord(n,E.derivedAttributes,function(t){var e,n,r,i;if(E.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==f[e]&&(f[e]={},I>0&&(f[e]["null"]=I));for(e in f)i=null!=(r=t[e])?r:"null",null==(n=f[e])[i]&&(n[i]=0),f[e][i]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=E.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(s in f)e.call(E.hiddenAttributes,s)<0&&t.push(s);return t}(),Y=!1,$="auto"===E.unusedAttrsVertical?120:parseInt(E.unusedAttrsVertical),!isNaN($)){for(d=0,x=0,S=W.length;x$}E.unusedAttrsVertical===!0||Y?Q.addClass("pvtVertList"):Q.addClass("pvtHorizList"),y=function(n){var r,a,i,o,l,s,u,c,d,p,m,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in f[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>E.menuLimit)x.append(t("").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC,EAAAC,KAAAC,OAAAF,EAAAD,EAAAA,IAAA,GAAAA,IAAAE,OAAAA,KAAAF,KAAAD,EAAA,MAAAC,EAAA,OAAA,ICGII,KAAWA,MACXC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,aAChEC,KAAaC,gBDLjBd,EAAiB,SAACe,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,WACC,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GAEZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CC6qDA,ODzqDAnB,GAAgB,SAACoB,EAAMC,EAAcC,GACjC,GAAAC,GAAAC,EAAAC,EAAAC,CAKiD,KALjDN,GAAQ,GACRI,EAAIJ,EAAKO,MAAM,KACfF,EAAKD,EAAE,GACPE,EAAQF,EAAE1C,OAAS,EAAQwC,EAAaE,EAAE,GAAQ,GAClDD,EAAM,eACiDA,EAAIK,KAAKH,IAAhEA,EAAKA,EAAGI,QAAQN,EAAK,KAAOF,EAAe,KAC3C,OAAOI,GAAKC,GAEhBjB,EAAe,SAACqB,GACZ,GAAAC,ECqBF,ODrBEA,IACIC,mBAAoB,EAAGC,OAAQ,EAC/BZ,aAAc,IAAKC,WAAY,IAC/BY,OAAQ,GAAIC,OAAQ,IACxBL,EAAOhC,EAAEsC,UAAWL,EAAUD,GAC9B,SAACN,GACG,GAAAa,EAAA,OAA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1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t("
").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("")),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(i).html(D.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(""),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!l).data("filter",[n,y]).appendTo(s).bind("change",function(){return t(this).toggleClass("changed")}),s.append(t("").addClass("value").text(y)),s.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(s));return o=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=D.menuLimit&&t("",{type:"button"}).text(D.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),o()}),t("",{type:"button"}).text(D.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),o()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=D.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(M={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",D.rowOrder).html(M[D.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",D.colOrder).html(M[D.colOrder].colSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),R=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),D.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=D.cols,F=0,N=q.length;N>F;F++)X=q[F],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(X,W)));for(z=D.rows,E=0,T=z.length;T>E;E++)X=z[E],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(X,W)));null!=D.aggregatorName&&this.find(".pvtAggregator").val(D.aggregatorName),null!=D.rendererName&&this.find(".pvtRenderer").val(D.rendererName),A=!0,V=function(n){return function(){var r,a,o,i,s,l,d,h,p,m,v,b,C,y;if(m={derivedAttributes:D.derivedAttributes,localeStrings:D.localeStrings,rendererOptions:D.rendererOptions,sorters:D.sorters,cols:[],rows:[],dataClass:D.dataClass},s=null!=(h=D.aggregators[u.val()]([])().numInputs)?h:0,y=[],n.find(".pvtRows li span.pvtAttr").each(function(){return m.rows.push(t(this).data("attrName"))}),n.find(".pvtCols li span.pvtAttr").each(function(){return m.cols.push(t(this).data("attrName"))}),n.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===s?t(this).remove():(s--,""!==t(this).val()?y.push(t(this).val()):void 0)}),0!==s)for(d=n.find(".pvtVals"),X=v=0,p=s;p>=0?p>v:v>p;X=p>=0?++v:--v){for(i=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,o=W.length;o>b;b++)c=W[b],i.append(t("").val(c).text(c));d.append(i)}return A&&(y=D.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),m.aggregatorName=u.val(),m.vals=y,m.aggregator=D.aggregators[u.val()](y),m.renderer=D.renderers[j.val()],m.rowOrder=B.data("order"),m.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]:void 0}),m.filter=function(t){var n,a,o,i;if(!D.filter(t))return!1;for(a in r)if(n=r[a],o=""+(null!=(i=t[a])?i:"null"),e.call(n,o)>=0)return!1;return!0},R.pivot(O,m),l=t.extend({},D,{cols:m.cols,rows:m.rows,colOrder:m.colOrder,rowOrder:m.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",l),D.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(C)),R.css("opacity",1),null!=D.onRefresh?D.onRefresh(l):void 0}}(this),U=function(t){return function(){return R.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?U():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(D.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,o,i,s,l,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,o,i;return o=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],o(function(t){return i.push(t)}),a=r(i),o(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(o=s=0,h=c;h>=0?h>s:s>h;o=h>=0?++s:--s)a(".pvtVal.row"+o);break;case"colheatmap":for(i=l=0,p=u;p>=0?p>l:l>p;i=p>=0?++l:--l)a(".pvtVal.col"+i)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,o,i;for(o=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,o,i;return r=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],r(function(t){return i.push(t)}),a=Math.max.apply(Math,i),o=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,i=o;i>=0?i>r:r>i;n=i>=0?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); -//# sourceMappingURL=pivot.min.js.map \ No newline at end of file +(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;e1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(i);)i=i.replace(r,"$1"+e+"$2");return i+o},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=o((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},x=g(),S=g({digitsAfterDecimal:0}),N=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),l={count:function(t){return null==t&&(t=S),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=S),function(r){var a;return a=r[0],function(r,i,o){return{uniq:[],push:function(t){var n;if(n=t[a],e.call(this.uniq,n)<0)return this.uniq.push(t[a])},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=x),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){if(!isNaN(parseFloat(t[n])))return this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{val:null,sorter:h(null!=n?n.sorters:void 0,r),push:function(e){var n,a,i,o;if(o=e[r],"min"!==t&&"max"!==t||(o=parseFloat(o),isNaN(o)||(this.val=Math[t](o,null!=(n=this.val)?n:o))),"first"===t&&this.sorter(o,null!=(a=this.val)?a:o)<=0&&(this.val=o),"last"===t&&this.sorter(o,null!=(i=this.val)?i:o)>=0)return this.val=o},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{vals:[],push:function(t){var e;if(e=parseFloat(t[r]),!isNaN(e))return this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=x),function(r){var a;return a=r[0],function(r,i,o){return{n:0,m:0,s:0,push:function(t){var e,n;if(n=parseFloat(t[a]),!isNaN(n))return this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e)},value:function(){if("mean"===t)return 0===this.n?NaN:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=x),function(e){var n,r;return r=e[0],n=e[1],function(e,a,i){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),!isNaN(parseFloat(t[n])))return this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=x),function(n){var r,a;return a=n[0],r=n[1],function(n,i,o){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),!isNaN(parseFloat(t[r])))return this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=N),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,i,o){return{selector:{total:[[],[]],row:[i,[]],col:[[],o]}[e],inner:t.apply(null,a)(n,i,o),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},l.countUnique=function(t){return l.uniques(function(t){return t.length},t)},l.listUnique=function(t){return l.uniques(function(e){return e.join(t)},function(t){return t})},l.max=function(t){return l.extremes("max",t)},l.min=function(t){return l.extremes("min",t)},l.first=function(t){return l.extremes("first",t)},l.last=function(t){return l.extremes("last",t)},l.median=function(t){return l.quantile(.5,t)},l.average=function(t){return l.runningStat("mean",1,t)},l["var"]=function(t,e){return l.runningStat("var",t,e)},l.stdev=function(t,e){return l.runningStat("stdev",t,e)},s=function(t){return{Count:t.count(S),"Count Unique Values":t.countUnique(S),"List Unique Values":t.listUnique(", "),Sum:t.sum(x),"Integer Sum":t.sum(S),Average:t.average(x),Median:t.median(x),"Sample Variance":t["var"](1,x),"Sample Standard Deviation":t.stdev(1,x),Minimum:t.min(x),Maximum:t.max(x),First:t.first(x),Last:t.last(x),"Sum over Sum":t.sumOverSum(x),"80% Upper Bound":t.sumOverSumBound80(!0,x),"80% Lower Bound":t.sumOverSumBound80(!1,x),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",N),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",N),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",N),"Count as Fraction of Total":t.fractionOf(t.count(),"total",N),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",N),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",N)}}(l),C={Table:function(t,e){return v(t,e)},"Table Barchart":function(e,n){return t(v(e,n)).barchart()},Heatmap:function(e,n){return t(v(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(v(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(v(e,n)).heatmap("colheatmap",n)}},u={text:function(t){return document.createTextNode(t)},byType:function(t,e){return function(n,r){return(t[r]||e||u.text).apply(this,arguments)}}},p={en:{aggregators:s,renderers:C,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T=function(t){return("0"+t).substr(-2,2)},d={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var i;return null==n&&(n=!1),null==r&&(r=f),null==a&&(a=c),i=n?"UTC":"",function(n){var o;return o=new Date(Date.parse(n[t])),isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o["get"+i+"FullYear"]();case"m":return T(o["get"+i+"Month"]()+1);case"n":return r[o["get"+i+"Month"]()];case"d":return T(o["get"+i+"Date"]());case"w":return a[o["get"+i+"Day"]()];case"x":return o["get"+i+"Day"]();case"H":return T(o["get"+i+"Hours"]());case"M":return T(o["get"+i+"Minutes"]());case"S":return T(o["get"+i+"Seconds"]());default:return"%"+e}})}}},y=/(\d+)|(\D+)/g,b=/\d/,w=/^0/,m=function(t){return function(t,e){var n,r,a,i,o,l;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(o=+t,l=+e,ol)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(l)&&!isNaN(o))return-1;if(isNaN(o)&&!isNaN(l))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!b.test(n)||!b.test(a))return n>a?1:-1;for(n=n.match(y),a=a.match(y);n.length&&a.length;)if(r=n.shift(),i=a.shift(),r!==i)return b.test(r)&&b.test(i)?r.replace(w,".0")-i.replace(w,".0"):r>i?1:-1;return n.length-a.length}}(this),A=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:m(t,e)}},h=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return m},i=function(){function e(t,n){var a,i,o,s,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:l.count()(),this.aggregatorName=null!=(i=n.aggregatorName)?i:"Count",this.colAttrs=null!=(o=n.cols)?o:[],this.rowAttrs=null!=(s=n.rows)?s:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){if(t.filter(e))return t.processRecord(e)}}(this))}return e.forEachRecord=function(e,n,r){var i,o,l,s,u,c,d,h,p,f,m,g;if(i=t.isEmptyObject(n)?r:function(t){var e,a,i;for(e in n)i=n[e],t[e]=null!=(a=i(t))?a:t[e];return r(t)},t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(l in e)if(a.call(e,l)&&(o=e[l],l>0)){h={},p=e[0];for(s in p)a.call(p,s)&&(u=p[s],h[u]=o[s]);f.push(i(h))}return f}for(m=[],c=0,d=e.length;c tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),i(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,i,o;if(e.filter(r)){for(a in t)if(o=t[a],o!==(null!=(i=r[a])?i:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;n=l;c=0<=l?++r:--r)t[e-1][c]!==t[e][c]&&(o=!1);if(o)return-1}for(a=0;e+a=s;c=0<=s?++i:--i)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},x=document.createElement("thead");for(p in o)if(a.call(o,p)){i=o[p],N=document.createElement("tr"),0===parseInt(p)&&0!==g.length&&(A=document.createElement("th"),A.setAttribute("colspan",g.length),A.setAttribute("rowspan",o.length),N.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(i)),N.appendChild(A);for(h in s)a.call(s,h)&&(l=s[h],_=C(s,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtColLabel",A.appendChild(n.headCellRenderer(l[p],i)),A.setAttribute("colspan",_),parseInt(p)===o.length-1&&0!==g.length&&A.setAttribute("rowspan",2),N.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",o.length+(0===g.length?0:1)),N.appendChild(A)),x.appendChild(N)}if(0!==g.length){N=document.createElement("tr");for(h in g)a.call(g,h)&&(f=g[h],A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(f)),N.appendChild(A));A=document.createElement("th"),0===o.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),N.appendChild(A),x.appendChild(N)}m.appendChild(x),y=document.createElement("tbody");for(h in b)if(a.call(b,h)){v=b[h],N=document.createElement("tr");for(p in v)a.call(v,p)&&(T=v[p],_=C(b,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtRowLabel",A.appendChild(n.headCellRenderer(T,g[p])),A.setAttribute("rowspan",_),parseInt(p)===g.length-1&&0!==o.length&&A.setAttribute("colspan",2),N.appendChild(A)));for(p in s)a.call(s,p)&&(l=s[p],r=e.getAggregator(v,l),k=r.value(),w=document.createElement("td"),w.className="pvtVal row"+h+" col"+p,w.appendChild(n.dataCellRenderer(r.format(k),v,l)),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,l)),N.appendChild(w));S=e.getAggregator(v,[]),k=S.value(),w=document.createElement("td"),w.className="pvtTotal rowTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,[])),w.setAttribute("data-for","row"+h),N.appendChild(w),y.appendChild(N)}N=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",g.length+(0===o.length?0:1)),N.appendChild(A);for(p in s)a.call(s,p)&&(l=s[p],S=e.getAggregator([],l),k=S.value(),w=document.createElement("td"),w.className="pvtTotal colTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],l)),w.setAttribute("data-for","col"+p),N.appendChild(w));return S=e.getAggregator([],[]),k=S.value(),w=document.createElement("td"),w.className="pvtGrandTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],[])),N.appendChild(w),y.appendChild(N),m.appendChild(y),m.setAttribute("data-numrows",b.length),m.setAttribute("data-numcols",s.length),m},t.fn.pivot=function(e,n,r){var a,o,s,u,c,d,h,f;null==r&&(r="en"),null==p[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:v},u=t.extend(!0,{},p.en.localeStrings,p[r].localeStrings),s={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},s,t.extend({},a,n)),h=null;try{d=new c.dataClass(e,c);try{h=c.renderer(d,c.rendererOptions)}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.renderError)}}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(h)},t.fn.pivotUI=function(n,r,o,l){var s,u,c,d,f,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,R,E,D,M,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==o&&(o=!1),null==l&&(l="en"),null==p[l]&&(l="en"),v={derivedAttributes:{},aggregators:p[l].aggregators,renderers:p[l].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},p.en.localeStrings,p[l].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),E=null==C||o?t.extend(!0,{},k,t.extend({},v,r)):C;try{f={},O=[],I=0,i.forEachRecord(n,E.derivedAttributes,function(t){var e,n,r,i;if(E.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==f[e]&&(f[e]={},I>0&&(f[e]["null"]=I));for(e in f)i=null!=(r=t[e])?r:"null",null==(n=f[e])[i]&&(n[i]=0),f[e][i]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=E.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(s in f)e.call(E.hiddenAttributes,s)<0&&t.push(s);return t}(),Y=!1,$="auto"===E.unusedAttrsVertical?120:parseInt(E.unusedAttrsVertical),!isNaN($)){for(d=0,x=0,S=W.length;x$}E.unusedAttrsVertical===!0||Y?Q.addClass("pvtVertList"):Q.addClass("pvtHorizList"),y=function(n){var r,a,i,o,l,s,u,c,d,p,m,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in f[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>E.menuLimit)x.append(t("").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC,EAAAC,KAAAC,OAAAF,EAAAD,EAAAA,IAAA,GAAAA,IAAAE,OAAAA,KAAAF,KAAAD,EAAA,MAAAC,EAAA,OAAA,ICGII,KAAWA,MACXC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,aAChEC,KAAaC,gBDLjBd,EAAiB,SAACe,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,WACC,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GAEZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CC6qDA,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ODnqBI5K,GAAO0K,EAAK1K,OACZ4K,EAAUhZ,EAAE,SAASqW,KACjBD,SAAY,WACZ6C,OAAU,SACdD,EAAQ/G,OAAOjS,EAAE,SAASqW,KACtBD,SAAY,WACZ8C,OAAU,EACVjD,KAAQ,EACRkD,MAAS,EACTF,OAAU9W,EAAOT,GAAK,IACtB0X,mBAAoB,UACxBJ,EAAQ/G,OAAOjS,EAAE,SAASoO,KAAKA,GAAMiI,KACjCD,SAAW,WACXiD,eAAe,MACfC,gBAAgB,SAEpBR,EAAKzC,KAAIkD,QAAW,EAAEC,cAAe,MAAOC,aAAc,WAAU5H,KAAKmH,OA3BpEja,MA6ByBF,EAAAC,EAAA,EAAA0E,EAAAiV,EAAAjV,GAAA,EAAAA,EAAA1E,EAAAA,EAAA0E,EAAA3E,EAAA2E,GAAA,IAAA1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
").append(s));return o=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("
").appendTo(x),S.length<=D.menuLimit&&t("",{type:"button"}).text(D.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),o()}),t("",{type:"button"}).text(D.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),o()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=D.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(M={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",D.rowOrder).html(M[D.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",D.colOrder).html(M[D.colOrder].colSymbol).bind("click",function(){return t(this).data("order",M[t(this).data("order")].next),t(this).html(M[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),R=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),D.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=D.cols,F=0,N=q.length;N>F;F++)X=q[F],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(X,W)));for(z=D.rows,E=0,T=z.length;T>E;E++)X=z[E],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(X,W)));null!=D.aggregatorName&&this.find(".pvtAggregator").val(D.aggregatorName),null!=D.rendererName&&this.find(".pvtRenderer").val(D.rendererName),A=!0,V=function(n){return function(){var r,a,o,i,s,l,d,h,p,m,v,b,C,y;if(m={derivedAttributes:D.derivedAttributes,localeStrings:D.localeStrings,rendererOptions:D.rendererOptions,sorters:D.sorters,cols:[],rows:[],dataClass:D.dataClass},s=null!=(h=D.aggregators[u.val()]([])().numInputs)?h:0,y=[],n.find(".pvtRows li span.pvtAttr").each(function(){return m.rows.push(t(this).data("attrName"))}),n.find(".pvtCols li span.pvtAttr").each(function(){return m.cols.push(t(this).data("attrName"))}),n.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===s?t(this).remove():(s--,""!==t(this).val()?y.push(t(this).val()):void 0)}),0!==s)for(d=n.find(".pvtVals"),X=v=0,p=s;p>=0?p>v:v>p;X=p>=0?++v:--v){for(i=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,o=W.length;o>b;b++)c=W[b],i.append(t("").val(c).text(c));d.append(i)}return A&&(y=D.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),m.aggregatorName=u.val(),m.vals=y,m.aggregator=D.aggregators[u.val()](y),m.renderer=D.renderers[j.val()],m.rowOrder=B.data("order"),m.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]:void 0}),m.filter=function(t){var n,a,o,i;if(!D.filter(t))return!1;for(a in r)if(n=r[a],o=""+(null!=(i=t[a])?i:"null"),e.call(n,o)>=0)return!1;return!0},R.pivot(O,m),l=t.extend({},D,{cols:m.cols,rows:m.rows,colOrder:m.colOrder,rowOrder:m.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",l),D.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(C)),R.css("opacity",1),null!=D.onRefresh?D.onRefresh(l):void 0}}(this),U=function(t){return function(){return R.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?U():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(D.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,o,i,s,l,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,o,i;return o=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],o(function(t){return i.push(t)}),a=r(i),o(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(o=s=0,h=c;h>=0?h>s:s>h;o=h>=0?++s:--s)a(".pvtVal.row"+o);break;case"colheatmap":for(i=l=0,p=u;p>=0?p>l:l>p;i=p>=0?++l:--l)a(".pvtVal.col"+i)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,o,i;for(o=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,o,i;return r=function(r){return e.find(n).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?r(e,t(this)):void 0})},i=[],r(function(t){return i.push(t)}),a=Math.max.apply(Math,i),o=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,i=o;i>=0?i>r:r>i;n=i>=0?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); -//# sourceMappingURL=pivot.min.js.map \ No newline at end of file +(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;e1?n+a[1]:"",r=/(\d+)(\d{3})/;r.test(i);)i=i.replace(r,"$1"+e+"$2");return i+o},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":(n=o((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix)}},x=g(),S=g({digitsAfterDecimal:0}),N=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),l={count:function(t){return null==t&&(t=S),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=S),function(r){var a;return a=r[0],function(r,i,o){return{uniq:[],push:function(t){var n;if(n=t[a],e.call(this.uniq,n)<0)return this.uniq.push(t[a])},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=x),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){if(!isNaN(parseFloat(t[n])))return this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{val:null,sorter:h(null!=n?n.sorters:void 0,r),push:function(e){var n,a,i,o;if(o=e[r],"min"!==t&&"max"!==t||(o=parseFloat(o),isNaN(o)||(this.val=Math[t](o,null!=(n=this.val)?n:o))),"first"===t&&this.sorter(o,null!=(a=this.val)?a:o)<=0&&(this.val=o),"last"===t&&this.sorter(o,null!=(i=this.val)?i:o)>=0)return this.val=o},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=x),function(n){var r;return r=n[0],function(n,a,i){return{vals:[],push:function(t){var e;if(e=parseFloat(t[r]),!isNaN(e))return this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t="mean"),null==e&&(e=1),null==n&&(n=x),function(r){var a;return a=r[0],function(r,i,o){return{n:0,m:0,s:0,push:function(t){var e,n;if(n=parseFloat(t[a]),!isNaN(n))return this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e)},value:function(){if("mean"===t)return 0===this.n?NaN:this.m;if(this.n<=e)return 0;switch(t){case"var":return this.s/(this.n-e);case"stdev":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=x),function(e){var n,r;return r=e[0],n=e[1],function(e,a,i){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),!isNaN(parseFloat(t[n])))return this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=x),function(n){var r,a;return a=n[0],r=n[1],function(n,i,o){return{sumNum:0,sumDenom:0,push:function(t){if(isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),!isNaN(parseFloat(t[r])))return this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=N),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,i,o){return{selector:{total:[[],[]],row:[i,[]],col:[[],o]}[e],inner:t.apply(null,a)(n,i,o),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},l.countUnique=function(t){return l.uniques(function(t){return t.length},t)},l.listUnique=function(t){return l.uniques(function(e){return e.join(t)},function(t){return t})},l.max=function(t){return l.extremes("max",t)},l.min=function(t){return l.extremes("min",t)},l.first=function(t){return l.extremes("first",t)},l.last=function(t){return l.extremes("last",t)},l.median=function(t){return l.quantile(.5,t)},l.average=function(t){return l.runningStat("mean",1,t)},l["var"]=function(t,e){return l.runningStat("var",t,e)},l.stdev=function(t,e){return l.runningStat("stdev",t,e)},s=function(t){return{Count:t.count(S),"Count Unique Values":t.countUnique(S),"List Unique Values":t.listUnique(", "),Sum:t.sum(x),"Integer Sum":t.sum(S),Average:t.average(x),Median:t.median(x),"Sample Variance":t["var"](1,x),"Sample Standard Deviation":t.stdev(1,x),Minimum:t.min(x),Maximum:t.max(x),First:t.first(x),Last:t.last(x),"Sum over Sum":t.sumOverSum(x),"80% Upper Bound":t.sumOverSumBound80(!0,x),"80% Lower Bound":t.sumOverSumBound80(!1,x),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",N),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",N),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",N),"Count as Fraction of Total":t.fractionOf(t.count(),"total",N),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",N),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",N)}}(l),C={Table:function(t,e){return v(t,e)},"Table Barchart":function(e,n){return t(v(e,n)).barchart()},Heatmap:function(e,n){return t(v(e,n)).heatmap("heatmap",n)},"Row Heatmap":function(e,n){return t(v(e,n)).heatmap("rowheatmap",n)},"Col Heatmap":function(e,n){return t(v(e,n)).heatmap("colheatmap",n)}},u={text:function(t){return document.createTextNode(t)},byType:function(t,e){return function(n,r){return(t[r]||e||u.text).apply(this,arguments)}}},p={en:{aggregators:s,renderers:C,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter values",apply:"Apply",cancel:"Cancel",totals:"Totals",vs:"vs",by:"by"}}},f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T=function(t){return("0"+t).substr(-2,2)},d={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var i;return null==n&&(n=!1),null==r&&(r=f),null==a&&(a=c),i=n?"UTC":"",function(n){var o;return o=new Date(Date.parse(n[t])),isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o["get"+i+"FullYear"]();case"m":return T(o["get"+i+"Month"]()+1);case"n":return r[o["get"+i+"Month"]()];case"d":return T(o["get"+i+"Date"]());case"w":return a[o["get"+i+"Day"]()];case"x":return o["get"+i+"Day"]();case"H":return T(o["get"+i+"Hours"]());case"M":return T(o["get"+i+"Minutes"]());case"S":return T(o["get"+i+"Seconds"]());default:return"%"+e}})}}},y=/(\d+)|(\D+)/g,b=/\d/,w=/^0/,m=function(t){return function(t,e){var n,r,a,i,o,l;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(o=+t,l=+e,ol)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(l)&&!isNaN(o))return-1;if(isNaN(o)&&!isNaN(l))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!b.test(n)||!b.test(a))return n>a?1:-1;for(n=n.match(y),a=a.match(y);n.length&&a.length;)if(r=n.shift(),i=a.shift(),r!==i)return b.test(r)&&b.test(i)?r.replace(w,".0")-i.replace(w,".0"):r>i?1:-1;return n.length-a.length}}(this),A=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,"string"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:m(t,e)}},h=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return m},i=function(){function e(t,n){var a,i,o,s,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:l.count()(),this.aggregatorName=null!=(i=n.aggregatorName)?i:"Count",this.colAttrs=null!=(o=n.cols)?o:[],this.rowAttrs=null!=(s=n.rows)?s:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:"key_a_to_z",this.colOrder=null!=(h=n.colOrder)?h:"key_a_to_z",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){if(t.filter(e))return t.processRecord(e)}}(this))}return e.forEachRecord=function(e,n,r){var i,o,l,s,u,c,d,h,p,f,m,g;if(i=t.isEmptyObject(n)?r:function(t){var e,a,i;for(e in n)i=n[e],t[e]=null!=(a=i(t))?a:t[e];return r(t)},t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(l in e)if(a.call(e,l)&&(o=e[l],l>0)){h={},p=e[0];for(s in p)a.call(p,s)&&(u=p[s],h[u]=o[s]);f.push(i(h))}return f}for(m=[],c=0,d=e.length;c tr > th",e).each(function(e){return g.push(t(this).text())}),t("tbody > tr",e).each(function(e){return h={},t("td",this).each(function(e){return h[g[e]]=t(this).text()}),i(h)});throw new Error("unknown input format")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,i,o;if(e.filter(r)){for(a in t)if(o=t[a],o!==(null!=(i=r[a])?i:"null"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;n=l;c=0<=l?++r:--r)t[e-1][c]!==t[e][c]&&(o=!1);if(o)return-1}for(a=0;e+a=s;c=0<=s?++i:--i)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},x=document.createElement("thead");for(p in o)if(a.call(o,p)){i=o[p],N=document.createElement("tr"),0===parseInt(p)&&0!==g.length&&(A=document.createElement("th"),A.setAttribute("colspan",g.length),A.setAttribute("rowspan",o.length),N.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(i)),N.appendChild(A);for(h in s)a.call(s,h)&&(l=s[h],_=C(s,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtColLabel",A.appendChild(n.headCellRenderer(l[p],i)),A.setAttribute("colspan",_),parseInt(p)===o.length-1&&0!==g.length&&A.setAttribute("rowspan",2),N.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",o.length+(0===g.length?0:1)),N.appendChild(A)),x.appendChild(N)}if(0!==g.length){N=document.createElement("tr");for(h in g)a.call(g,h)&&(f=g[h],A=document.createElement("th"),A.className="pvtAxisLabel",A.appendChild(n.typeCellRenderer(f)),N.appendChild(A));A=document.createElement("th"),0===o.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),N.appendChild(A),x.appendChild(N)}m.appendChild(x),y=document.createElement("tbody");for(h in b)if(a.call(b,h)){v=b[h],N=document.createElement("tr");for(p in v)a.call(v,p)&&(T=v[p],_=C(b,parseInt(h),parseInt(p)),_!==-1&&(A=document.createElement("th"),A.className="pvtRowLabel",A.appendChild(n.headCellRenderer(T,g[p])),A.setAttribute("rowspan",_),parseInt(p)===g.length-1&&0!==o.length&&A.setAttribute("colspan",2),N.appendChild(A)));for(p in s)a.call(s,p)&&(l=s[p],r=e.getAggregator(v,l),k=r.value(),w=document.createElement("td"),w.className="pvtVal row"+h+" col"+p,w.appendChild(n.dataCellRenderer(r.format(k),v,l)),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,l)),N.appendChild(w));S=e.getAggregator(v,[]),k=S.value(),w=document.createElement("td"),w.className="pvtTotal rowTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,v,[])),w.setAttribute("data-for","row"+h),N.appendChild(w),y.appendChild(N)}N=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",g.length+(0===o.length?0:1)),N.appendChild(A);for(p in s)a.call(s,p)&&(l=s[p],S=e.getAggregator([],l),k=S.value(),w=document.createElement("td"),w.className="pvtTotal colTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],l)),w.setAttribute("data-for","col"+p),N.appendChild(w));return S=e.getAggregator([],[]),k=S.value(),w=document.createElement("td"),w.className="pvtGrandTotal",w.textContent=S.format(k),w.setAttribute("data-value",k),null!=d&&(w.onclick=d(k,[],[])),N.appendChild(w),y.appendChild(N),m.appendChild(y),m.setAttribute("data-numrows",b.length),m.setAttribute("data-numcols",s.length),m},t.fn.pivot=function(e,n,r){var a,o,s,u,c,d,h,f;null==r&&(r="en"),null==p[r]&&(r="en"),a={cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",sorters:{},derivedAttributes:{},renderer:v},u=t.extend(!0,{},p.en.localeStrings,p[r].localeStrings),s={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},s,t.extend({},a,n)),h=null;try{d=new c.dataClass(e,c);try{h=c.renderer(d,c.rendererOptions)}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.renderError)}}catch(m){o=m,"undefined"!=typeof console&&null!==console&&console.error(o.stack),h=t("").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(h)},t.fn.pivotUI=function(n,r,o,l){var s,u,c,d,f,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,R,E,D,M,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==o&&(o=!1),null==l&&(l="en"),null==p[l]&&(l="en"),v={derivedAttributes:{},aggregators:p[l].aggregators,renderers:p[l].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:"key_a_to_z",colOrder:"key_a_to_z",dataClass:i,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},p.en.localeStrings,p[l].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data("pivotUIOptions"),E=null==C||o?t.extend(!0,{},k,t.extend({},v,r)):C;try{f={},O=[],I=0,i.forEachRecord(n,E.derivedAttributes,function(t){var e,n,r,i;if(E.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==f[e]&&(f[e]={},I>0&&(f[e]["null"]=I));for(e in f)i=null!=(r=t[e])?r:"null",null==(n=f[e])[i]&&(n[i]=0),f[e][i]++;return I++}}),G=t("",{"class":"pvtUi"}).attr("cellpadding",5),H=t(""),j=t("").addClass("pvtRenderer").appendTo(H).bind("change",function(){return U()}),K=E.renderers;for(X in K)a.call(K,X)&&t("").val(X).html(X).appendTo(j);if(Q=t("").addClass("pvtAxisContainer pvtUnused"),W=function(){var t;t=[];for(s in f)e.call(E.hiddenAttributes,s)<0&&t.push(s);return t}(),Y=!1,$="auto"===E.unusedAttrsVertical?120:parseInt(E.unusedAttrsVertical),!isNaN($)){for(d=0,x=0,S=W.length;x$}E.unusedAttrsVertical===!0||Y?Q.addClass("pvtVertList"):Q.addClass("pvtHorizList"),y=function(n){var r,a,i,o,l,s,u,c,d,p,m,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in f[n])t.push(C);return t}(),c=!1,x=t("").addClass("pvtFilterBox").hide(),x.append(t("").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>E.menuLimit)x.append(t("").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter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AFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
").html(E.localeStrings.tooMany));else for(S.length>5&&(o=t("
").appendTo(x),v=h(E.sorters,n),m=E.localeStrings.filterResults,t("",{type:"text"}).appendTo(o).attr({placeholder:m,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var i,o;return i=a.substring(t.length).trim(),0===i.length||(o=Math.sign(v(r.toLowerCase(),i)),e.call(n,o)>=0)}},n=a.startsWith(">=")?r(">=",[1,0]):a.startsWith("<=")?r("<=",[-1,0]):a.startsWith(">")?r(">",[1]):a.startsWith("<")?r("<",[-1]):a.startsWith("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),o.append(t("")),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectAll).bind("click",function(){return x.find("input:visible:not(:checked)").prop("checked",!0).toggleClass("changed"),!1}),t("",{type:"button"}).appendTo(o).html(E.localeStrings.selectNone).bind("click",function(){return x.find("input:visible:checked").prop("checked",!1).toggleClass("changed"),!1})),a=t("").addClass("pvtCheckContainer").appendTo(x),g=S.sort(h(E.sorters,n)),p=0,d=g.length;p"),s=!1,E.inclusions[n]?s=e.call(E.inclusions[n],y)<0:E.exclusions[n]&&(s=e.call(E.exclusions[n],y)>=0),c||(c=s),t("").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,y]).appendTo(l).bind("change",function(){return t(this).toggleClass("changed")}),l.append(t("").addClass("value").text(y)),l.append(t("").addClass("count").text("("+A+")")),a.append(t("").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC,EAAAC,KAAAC,OAAAF,EAAAD,EAAAA,IAAA,GAAAA,IAAAE,OAAAA,KAAAF,KAAAD,EAAA,MAAAC,EAAA,OAAA,ICGII,KAAWA,MACXC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,aAChEC,KAAaC,gBDLjBd,EAAiB,SAACe,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,WACC,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GAEZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EA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oX,GACZ,GAAA1K,GAAA4K,CCmqBJ,ODnqBI5K,GAAO0K,EAAK1K,OACZ4K,EAAUhZ,EAAE,SAASqW,KACjBD,SAAY,WACZ6C,OAAU,SACdD,EAAQ/G,OAAOjS,EAAE,SAASqW,KACtBD,SAAY,WACZ8C,OAAU,EACVjD,KAAQ,EACRkD,MAAS,EACTF,OAAU9W,EAAOT,GAAK,IACtB0X,mBAAoB,UACxBJ,EAAQ/G,OAAOjS,EAAE,SAASoO,KAAKA,GAAMiI,KACjCD,SAAW,WACXiD,eAAe,MACfC,gBAAgB,SAEpBR,EAAKzC,KAAIkD,QAAW,EAAEC,cAAe,MAAOC,aAAc,WAAU5H,KAAKmH,OA3BpEja,MA6ByBF,EAAAC,EAAA,EAAA0E,EAAAiV,EAAAjV,GAAA,EAAAA,EAAA1E,EAAAA,EAAA0E,EAAA3E,EAAA2E,GAAA,IAAA1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
").append(l));return i=function(){return x.find("[type='checkbox']").length>x.find("[type='checkbox']:checked").length?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),x.find(".pvtSearch").val(""),x.find(".pvtCheckContainer p").show(),x.hide()},u=t("
").appendTo(x),S.length<=E.menuLimit&&t("",{type:"button"}).text(E.localeStrings.apply).appendTo(u).bind("click",function(){return x.find(".changed").removeClass("changed").length&&U(),i()}),t("",{type:"button"}).text(E.localeStrings.cancel).appendTo(u).bind("click",function(){return x.find(".changed:checked").removeClass("changed").prop("checked",!1),x.find(".changed:not(:checked)").removeClass("changed").prop("checked",!0),i()}),b=t("").addClass("pvtTriangle").html(" ▾").bind("click",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t("").addClass("axis_"+w).append(t("").addClass("pvtAttr").text(n).data("attrName",n).append(b)),c&&r.addClass("pvtFilteredAttribute"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t("").appendTo(G),u=t("").addClass("pvtAggregator").bind("change",function(){return U()}),L=E.aggregators;for(X in L)a.call(L,X)&&u.append(t("").val(X).html(X));for(D={key_a_to_z:{rowSymbol:"↕",colSymbol:"↔",next:"value_a_to_z"},value_a_to_z:{rowSymbol:"↓",colSymbol:"→",next:"value_z_to_a"},value_z_to_a:{rowSymbol:"↑",colSymbol:"←",next:"key_a_to_z"}},B=t("",{role:"button"}).addClass("pvtRowOrder").data("order",E.rowOrder).html(D[E.rowOrder].rowSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].rowSymbol),U()}),g=t("",{role:"button"}).addClass("pvtColOrder").data("order",E.colOrder).html(D[E.colOrder].colSymbol).bind("click",function(){return t(this).data("order",D[t(this).data("order")].next),t(this).html(D[t(this).data("order")].colSymbol),U()}),t("").addClass("pvtVals").appendTo(P).append(u).append(B).append(g).append(t("")),t("").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(P),J=t("").appendTo(G),J.append(t("").addClass("pvtAxisContainer pvtRows").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(J),E.unusedAttrsVertical===!0||Y?(G.find("tr:nth-child(1)").prepend(H),G.find("tr:nth-child(2)").prepend(Q)):G.prepend(t("").append(H).append(Q)),this.html(G),q=E.cols,F=0,N=q.length;Fp;X=0<=p?++v:--v){for(o=t("").addClass("pvtAttrDropdown").append(t("")).bind("change",function(){return U()}),b=0,i=W.length;b").val(c).text(c));d.append(o)}if(A&&(y=E.vals,w=0,n.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(y[w]),w++}),A=!1),f.aggregatorName=u.val(),f.vals=y,f.aggregator=E.aggregators[u.val()](y),f.renderer=E.renderers[j.val()],f.rowOrder=B.data("order"),f.colOrder=g.data("order"),r={},n.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=r[e[0]]?r[e[0]].push(e[1]):r[e[0]]=[e[1]]}),a={},n.find("input.pvtFilter:checked").each(function(){var e;if(e=t(this).data("filter"),null!=r[e[0]])return null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),f.filter=function(t){var n,a,i,o;if(!E.filter(t))return!1;for(a in r)if(n=r[a],i=""+(null!=(o=t[a])?o:"null"),e.call(n,i)>=0)return!1;return!0},M.pivot(O,f),s=t.extend({},E,{cols:f.cols,rows:f.rows,colOrder:f.colOrder,rowOrder:f.rowOrder,vals:y,exclusions:r,inclusions:a,inclusionsInfo:a,aggregatorName:u.val(),rendererName:j.val()}),n.data("pivotUIOptions",s),E.autoSortUnusedAttrs&&(C=n.find("td.pvtUnused.pvtAxisContainer"),t(C).children("li").sort(function(e,n){return m(t(e).text(),t(n).text())}).appendTo(C)),M.css("opacity",1),null!=E.onRefresh)return E.onRefresh(s)}}(this),U=function(t){return function(){return M.css("opacity",.5),setTimeout(V,10)}}(this),U(),this.find(".pvtAxisContainer").sortable({update:function(t,e){if(null==e.sender)return U()},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Z){b=Z,"undefined"!=typeof console&&null!==console&&console.error(b.stack),this.html(E.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e,n){var r,a,i,o,l,s,u,c,d,h,p;switch(null==e&&(e="heatmap"),c=this.data("numrows"),u=this.data("numcols"),r=null!=n&&null!=(d=n.heatmap)?d.colorScaleGenerator:void 0,null==r&&(r=function(t){var e,n;return n=Math.min.apply(Math,t),e=Math.max.apply(Math,t),function(t){var r;return r=255-Math.round(255*(t-n)/(e-n)),"rgb(255,"+r+","+r+")"}}),a=function(e){return function(n){var a,i,o;return i=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],i(function(t){return o.push(t)}),a=r(o),i(function(t,e){return e.css("background-color",a(t))})}}(this),e){case"heatmap":a(".pvtVal");break;case"rowheatmap":for(i=l=0,h=c;0<=h?lh;i=0<=h?++l:--l)a(".pvtVal.row"+i);break;case"colheatmap":for(o=s=0,p=u;0<=p?sp;o=0<=p?++s:--s)a(".pvtVal.col"+o)}return a(".pvtTotal.rowTotal"),a(".pvtTotal.colTotal"),this},t.fn.barchart=function(){var e,n,r,a,i,o;for(i=this.data("numrows"),a=this.data("numcols"),e=function(e){return function(n){var r,a,i,o;return r=function(r){return e.find(n).each(function(){var e;if(e=t(this).data("value"),null!=e&&isFinite(e))return r(e,t(this))})},o=[],r(function(t){return o.push(t)}),a=Math.max.apply(Math,o),i=function(t){return 100*t/(1.4*a)},r(function(e,n){var r,a;return r=n.text(),a=t("").css({position:"relative",height:"55px"}),a.append(t("").css({position:"absolute",bottom:0,left:0,right:0,height:i(e)+"%","background-color":"gray"})),a.append(t("").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(a)})}}(this),n=r=0,o=i;0<=o?ro;n=0<=o?++r:--r)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); +//# sourceMappingURL=pivot.min.js.map diff --git a/dist/pivot.min.js.map b/dist/pivot.min.js.map index 02c1d8d2..be1c18b1 100644 --- a/dist/pivot.min.js.map +++ b/dist/pivot.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/pivot.coffee","pivot.min.js"],"names":["callWithJQuery","indexOf","item","i","l","this","length","slice","bind","fn","me","apply","arguments","hasProp","hasOwnProperty","pivotModule","exports","module","require","define","amd","jQuery","$","PivotData","addSeparators","aggregatorTemplates","aggregators","dayNamesEn","derivers","getSort","locales","mthNamesEn","naturalSort","numberFormat","pivotTableRenderer","rd","renderers","rx","rz","sortAs","usFmt","usFmtInt","usFmtPct","zeroPad","nStr","thousandsSep","decimalSep","rgx","x","x1","x2","split","test","replace","opts","defaults","digitsAfterDecimal","scaler","prefix","suffix","extend","result","isNaN","isFinite","toFixed","count","formatter","data","rowKey","colKey","push","value","format","uniques","arg","attr","uniq","record","ref","call","numInputs","sum","parseFloat","extremes","mode","val","sorter","sorters","ref1","ref2","Math","quantile","q","vals","sort","a","b","floor","ceil","runningStat","ddof","n","m","s","m_new","sqrt","sumOverSum","denom","num","sumNum","sumDenom","sumOverSumBound80","upper","sign","fractionOf","wrapped","type","selector","total","row","col","inner","getAggregator","countUnique","f","listUnique","join","max","min","first","last","median","average","stdev","tpl","Count","Count Unique Values","List Unique Values","Sum","Integer Sum","Average","Median","Sample Variance","Sample Standard Deviation","Minimum","Maximum","First","Last","Sum over Sum","80% Upper Bound","80% Lower Bound","Sum as Fraction of Total","Sum as Fraction of Rows","Sum as Fraction of Columns","Count as Fraction of Total","Count as Fraction of Rows","Count as Fraction of Columns","Table","Table Barchart","barchart","Heatmap","heatmap","Row Heatmap","Col Heatmap","en","localeStrings","renderError","computeError","uiRenderError","selectAll","selectNone","tooMany","filterResults","cancel","totals","vs","by","number","substr","bin","binWidth","dateFormat","formatString","utcOutput","mthNames","dayNames","utc","date","Date","parse","p","_this","as","bs","a1","b1","nas","nbs","String","match","shift","order","l_mapping","mapping","toLowerCase","isFunction","input","ref3","ref4","ref5","ref6","ref7","ref8","ref9","getRowKeys","getColKeys","sortKeys","arrSort","aggregator","aggregatorName","colAttrs","cols","rowAttrs","rows","valAttrs","rowOrder","colOrder","derivedAttributes","filter","tree","rowKeys","colKeys","rowTotals","colTotals","allTotal","sorted","forEachRecord","processRecord","addRecord","compactRecord","j","k","len1","results","results1","tblCols","isEmptyObject","v","isArray","each","text","Error","prototype","forEachMatchingRecord","criteria","callback","attrs","sortersArr","comparison","r","c","flatColKey","flatRowKey","len2","fromCharCode","agg","pivotUtilities","pivotData","getClickHandler","spanSize","tbody","td","th","thead","totalAggregator","tr","txt","table","clickCallback","rowValues","colValues","filters","e","document","createElement","className","arr","len","noDraw","stop","parseInt","setAttribute","appendChild","textContent","innerHTML","onclick","pivot","inputOpts","locale","localeDefaults","dataClass","renderer","rendererOptions","_error","console","error","stack","html","hasChildNodes","removeChild","lastChild","append","pivotUI","overwrite","attrLength","attrValues","colOrderArrow","existingOpts","fn1","initialRender","len3","materializedInput","o","ordering","pivotTable","recordsProcessed","refresh","refreshDelayed","rendererControl","rowOrderArrow","shownAttributes","tr1","tr2","uiTable","unused","unusedAttrsVerticalAutoCutoff","unusedAttrsVerticalAutoOverride","hiddenAttributes","menuLimit","exclusions","inclusions","unusedAttrsVertical","autoSortUnusedAttrs","onRefresh","base","class","addClass","appendTo","attrElem","checkContainer","closeFilterBox","controls","filterItem","filterItemExcluded","finalButtons","hasExcludedItem","placeholder","triangleLink","valueCount","valueList","values","hide","accept","accept_gen","trim","accepted","real_filter","substring","startsWith","find","parent","show","prop","toggleClass","removeClass","left","top","currentTarget","position","css","key_a_to_z","rowSymbol","colSymbol","next","value_a_to_z","value_z_to_a","role","prepend","inArray","rendererName","len4","newDropdown","numInputsToProcess","pivotUIOptions","pvtVals","subopts","t","u","unusedAttrsContainer","remove","not","excludedItems","inclusionsInfo","children","setTimeout","sortable","update","ui","sender","connectWith","items","scope","colorScaleGenerator","heatmapper","numCols","numRows","nonRed","round","colorScale","forEachCell","elem","barcharter","wrapper","height","bottom","right","background-color","padding-left","padding-right","padding","padding-top","text-align"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAA,SAAA,SAAAC,GAAA,IAAA,GAAAC,GAAA,EAAAC,EAAAC,KAAAC,OAAAF,EAAAD,EAAAA,IAAA,GAAAA,IAAAE,OAAAA,KAAAF,KAAAD,EAAA,MAAAC,EAAA,OAAA,ICGII,KAAWA,MACXC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,aAChEC,KAAaC,gBDLjBd,EAAiB,SAACe,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,WACC,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GAEZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CC6qDA,ODzqDAnB,GAAgB,SAACoB,EAAMC,EAAcC,GACjC,GAAAC,GAAAC,EAAAC,EAAAC,CAKiD,KALjDN,GAAQ,GACRI,EAAIJ,EAAKO,MAAM,KACfF,EAAKD,EAAE,GACPE,EAAQF,EAAE1C,OAAS,EAAQwC,EAAaE,EAAE,GAAQ,GAClDD,EAAM,eACiDA,EAAIK,KAAKH,IAAhEA,EAAKA,EAAGI,QAAQN,EAAK,KAAOF,EAAe,KAC3C,OAAOI,GAAKC,GAEhBjB,EAAe,SAACqB,GACZ,GAAAC,ECqBF,ODrBEA,IACIC,mBAAoB,EAAGC,OAAQ,EAC/BZ,aAAc,IAAKC,W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ByBF,EAAAC,EAAA,EAAA0E,EAAAiV,EAAAjV,GAAA,EAAAA,EAAA1E,EAAAA,EAAA0E,EAAA3E,EAAA2E,GAAA,IAAA1E,IAAAA,EAAtCia,EAAW,cAAcla,EAGzB,OAFAka,GAAW,sBAEJha,UC8pBZ0E,KAAK1E","file":"pivot.min.js","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 opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\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 uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\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 extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\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 aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\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 \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(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\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\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 values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\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 rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\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, @derivedAttributes, (record) =>\n @processRecord(record) if @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 forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\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 v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @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 table: clickCallback: null\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\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 thead = document.createElement(\"thead\")\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 thead.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 thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.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 if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\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 if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\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, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(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 locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\")\n\n renderer = $(\"\")\n .addClass('pvtRenderer')\n .appendTo(rendererControl)\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.renderers\n $(\"\").val(x).html(x).appendTo(renderer)\n\n\n #axis list, including the double-click menu\n unused = $(\"\").addClass('pvtAxisContainer pvtUnused')\n shownAttributes = (a for a of attrValues when a 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 unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownAttributes\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.startsWith(\">=\") then accept_gen(\">=\", [1,0])\n else if filter.startsWith(\"<=\") then accept_gen(\"<=\", [-1,0])\n else if filter.startsWith(\">\") then accept_gen(\">\", [1])\n else if filter.startsWith(\"<\") then accept_gen(\"<\", [-1])\n else if filter.startsWith(\"~\") then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"\")\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectAll)\n .bind \"click\", ->\n valueList.find(\"input:visible:not(:checked)\")\n .prop(\"checked\", true).toggleClass(\"changed\")\n return false\n $(\"\", {type:\"button\"}).appendTo(controls)\n .html(opts.localeStrings.selectNone)\n .bind \"click\", ->\n valueList.find(\"input:visible:checked\")\n .prop(\"checked\", false).toggleClass(\"changed\")\n return false\n\n checkContainer = $(\"\").addClass(\"pvtCheckContainer\").appendTo(valueList)\n\n for value in values.sort(getSort(opts.sorters, attr))\n valueCount = attrValues[attr][value]\n filterItem = $(\"\")\n filterItemExcluded = false\n if opts.inclusions[attr]\n filterItemExcluded = (value not in opts.inclusions[attr])\n else if opts.exclusions[attr]\n filterItemExcluded = (value in opts.exclusions[attr])\n hasExcludedItem ||= filterItemExcluded\n $(\"\")\n .attr(\"type\", \"checkbox\").addClass('pvtFilter')\n .attr(\"checked\", !filterItemExcluded).data(\"filter\", [attr,value])\n .appendTo(filterItem)\n .bind \"change\", -> $(this).toggleClass(\"changed\")\n filterItem.append $(\"\").addClass(\"value\").text(value)\n filterItem.append $(\"\").addClass(\"count\").text(\"(\"+valueCount+\")\")\n checkContainer.append $(\"\").append(filterItem)\n\n closeFilterBox = ->\n if valueList.find(\"[type='checkbox']\").length >\n valueList.find(\"[type='checkbox']:checked\").length\n attrElem.addClass \"pvtFilteredAttribute\"\n else\n attrElem.removeClass \"pvtFilteredAttribute\"\n\n valueList.find('.pvtSearch').val('')\n valueList.find('.pvtCheckContainer p').show()\n valueList.hide()\n\n finalButtons = $(\"\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").appendTo(valueList)\n\n if values.length <= opts.menuLimit\n $(\"\", {type: \"button\"}).text(opts.localeStrings.apply)\n .appendTo(finalButtons).bind \"click\", ->\n if valueList.find(\".changed\").removeClass(\"changed\").length\n refresh()\n closeFilterBox()\n\n $(\"\", {type: \"button\"}).text(opts.localeStrings.cancel)\n .appendTo(finalButtons).bind \"click\", ->\n valueList.find(\".changed:checked\")\n .removeClass(\"changed\").prop(\"checked\", false)\n valueList.find(\".changed:not(:checked)\")\n .removeClass(\"changed\").prop(\"checked\", true)\n closeFilterBox()\n\n triangleLink = $(\"\").addClass('pvtTriangle')\n .html(\" ▾\").bind \"click\", (e) ->\n {left, top} = $(e.currentTarget).position()\n valueList.css(left: left+10, top: top+10).show()\n\n attrElem = $(\"\").addClass(\"axis_#{i}\")\n .append $(\"\").addClass('pvtAttr').text(attr).data(\"attrName\", attr).append(triangleLink)\n\n attrElem.addClass('pvtFilteredAttribute') if hasExcludedItem\n unused.append(attrElem).append(valueList)\n\n tr1 = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").addClass('pvtAggregator')\n .bind \"change\", -> refresh() #capture reference\n for own x of opts.aggregators\n aggregator.append $(\"\").val(x).html(x)\n\n ordering =\n key_a_to_z: {rowSymbol: \"↕\", colSymbol: \"↔\", next: \"value_a_to_z\"}\n value_a_to_z: {rowSymbol: \"↓\", colSymbol: \"→\", next: \"value_z_to_a\"}\n value_z_to_a: {rowSymbol: \"↑\", colSymbol: \"←\", next: \"key_a_to_z\"}\n\n rowOrderArrow = $(\"\", role: \"button\").addClass(\"pvtRowOrder\")\n .data(\"order\", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].rowSymbol)\n refresh()\n\n colOrderArrow = $(\"\", role: \"button\").addClass(\"pvtColOrder\")\n .data(\"order\", opts.colOrder).html(ordering[opts.colOrder].colSymbol)\n .bind \"click\", ->\n $(this).data(\"order\", ordering[$(this).data(\"order\")].next)\n $(this).html(ordering[$(this).data(\"order\")].colSymbol)\n refresh()\n\n $(\"\").addClass('pvtVals')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"\"))\n\n #column axes\n $(\"\").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1)\n\n tr2 = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").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 unused\n else\n uiTable.prepend $(\"\").append(rendererControl).append(unused)\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 dataClass: opts.dataClass\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 .addClass('pvtAttrDropdown')\n .append($(\"\"))\n .bind \"change\", -> refresh()\n for attr in shownAttributes\n newDropdown.append($(\"\").val(attr).text(attr))\n pvtVals.append(newDropdown)\n\n if initialRender\n vals = opts.vals\n i = 0\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n $(this).val vals[i]\n i++\n initialRender = false\n\n subopts.aggregatorName = aggregator.val()\n subopts.vals = vals\n subopts.aggregator = opts.aggregators[aggregator.val()](vals)\n subopts.renderer = opts.renderers[renderer.val()]\n subopts.rowOrder = rowOrderArrow.data(\"order\")\n subopts.colOrder = colOrderArrow.data(\"order\")\n #construct filter here\n exclusions = {}\n @find('input.pvtFilter').not(':checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n exclusions[filter[0]].push( filter[1] )\n else\n exclusions[filter[0]] = [ filter[1] ]\n #include inclusions when exclusions present\n inclusions = {}\n @find('input.pvtFilter:checked').each ->\n filter = $(this).data(\"filter\")\n if exclusions[filter[0]]?\n if inclusions[filter[0]]?\n inclusions[filter[0]].push( filter[1] )\n else\n inclusions[filter[0]] = [ filter[1] ]\n\n subopts.filter = (record) ->\n return false if not opts.filter(record)\n for k,excludedItems of exclusions\n return false if \"\"+(record[k] ? 'null') in excludedItems\n return true\n\n pivotTable.pivot(materializedInput,subopts)\n pivotUIOptions = $.extend {}, opts,\n cols: subopts.cols\n rows: subopts.rows\n colOrder: subopts.colOrder\n rowOrder: subopts.rowOrder\n vals: vals\n exclusions: exclusions\n inclusions: inclusions\n inclusionsInfo: inclusions #duplicated for backwards-compatibility\n aggregatorName: aggregator.val()\n rendererName: renderer.val()\n\n @data \"pivotUIOptions\", pivotUIOptions\n\n # if requested make sure unused columns are in alphabetical order\n if opts.autoSortUnusedAttrs\n unusedAttrsContainer = @find(\"td.pvtUnused.pvtAxisContainer\")\n $(unusedAttrsContainer).children(\"li\")\n .sort((a, b) => naturalSort($(a).text(), $(b).text()))\n .appendTo unusedAttrsContainer\n\n pivotTable.css(\"opacity\", 1)\n opts.onRefresh(pivotUIOptions) if opts.onRefresh?\n\n refresh = =>\n pivotTable.css(\"opacity\", 0.5)\n setTimeout refreshDelayed, 10\n\n #the very first refresh will actually display the table\n refresh()\n\n @find(\".pvtAxisContainer\").sortable\n update: (e, ui) -> refresh() if not ui.sender?\n connectWith: @find(\".pvtAxisContainer\")\n items: 'li'\n placeholder: 'pvtPlaceholder'\n catch e\n console.error(e.stack) if console?\n @html opts.localeStrings.uiRenderError\n return this\n\n ###\n Heatmap post-processing\n ###\n\n $.fn.heatmap = (scope = \"heatmap\", opts) ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n # given a series of values\n # must return a function to map a given value to a CSS color\n colorScaleGenerator = opts?.heatmap?.colorScaleGenerator\n colorScaleGenerator ?= (values) ->\n min = Math.min(values...)\n max = Math.max(values...)\n return (x) ->\n nonRed = 255 - Math.round 255*(x-min)/(max-min)\n return \"rgb(255,#{nonRed},#{nonRed})\"\n\n heatmapper = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n colorScale = colorScaleGenerator(values)\n forEachCell (x, elem) -> elem.css \"background-color\", colorScale(x)\n\n switch scope\n when \"heatmap\" then heatmapper \".pvtVal\"\n when \"rowheatmap\" then heatmapper \".pvtVal.row#{i}\" for i in [0...numRows]\n when \"colheatmap\" then heatmapper \".pvtVal.col#{j}\" for j in [0...numCols]\n\n heatmapper \".pvtTotal.rowTotal\"\n heatmapper \".pvtTotal.colTotal\"\n\n return this\n\n ###\n Barchart post-processing\n ###\n\n $.fn.barchart = ->\n numRows = @data \"numrows\"\n numCols = @data \"numcols\"\n\n barcharter = (scope) =>\n forEachCell = (f) =>\n @find(scope).each ->\n x = $(this).data(\"value\")\n f(x, $(this)) if x? and isFinite(x)\n\n values = []\n forEachCell (x) -> values.push x\n max = Math.max(values...)\n scaler = (x) -> 100*x/(1.4*max)\n forEachCell (x, elem) ->\n text = elem.text()\n wrapper = $(\"\").css\n \"position\": \"relative\"\n \"height\": \"55px\"\n wrapper.append $(\"\").css\n \"position\": \"absolute\"\n \"bottom\": 0\n \"left\": 0\n \"right\": 0\n \"height\": scaler(x) + \"%\"\n \"background-color\": \"gray\"\n wrapper.append $(\"\").text(text).css\n \"position\":\"relative\"\n \"padding-left\":\"5px\"\n \"padding-right\":\"5px\"\n\n elem.css(\"padding\": 0,\"padding-top\": \"5px\", \"text-align\": \"center\").html wrapper\n\n barcharter \".pvtVal.row#{i}\" for i in [0...numRows]\n barcharter \".pvtTotal.colTotal\"\n\n return this\n","(function(){var t,e=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},n=[].slice,r=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty;(t=function(t){return\"object\"==typeof exports&&\"object\"==typeof module?t(require(\"jquery\")):\"function\"==typeof define&&define.amd?define([\"jquery\"],t):t(jQuery)})(function(t){var o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N;return i=function(t,e,n){var r,a,o,i;for(t+=\"\",a=t.split(\".\"),o=a[0],i=a.length>1?n+a[1]:\"\",r=/(\\d+)(\\d{3})/;r.test(o);)o=o.replace(r,\"$1\"+e+\"$2\");return o+i},m=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:\",\",decimalSep:\".\",prefix:\"\",suffix:\"\"},e=t.extend({},n,e),function(t){var n;return isNaN(t)||!isFinite(t)?\"\":(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),\"\"+e.prefix+n+e.suffix)}},A=m(),x=m({digitsAfterDecimal:0}),S=m({digitsAfterDecimal:1,scaler:100,suffix:\"%\"}),s={count:function(t){return null==t&&(t=x),function(){return function(e,n,r){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},uniques:function(t,n){return null==n&&(n=x),function(r){var a;return a=r[0],function(r,o,i){return{uniq:[],push:function(t){var n;return n=t[a],e.call(this.uniq,n)<0?this.uniq.push(t[a]):void 0},value:function(){return t(this.uniq)},format:n,numInputs:null!=a?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(e,r,a){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},extremes:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{val:null,sorter:d(null!=n?n.sorters:void 0,r),push:function(e){var n,a,o,i;return i=e[r],(\"min\"===t||\"max\"===t)&&(i=parseFloat(i),isNaN(i)||(this.val=Math[t](i,null!=(n=this.val)?n:i))),\"first\"===t&&this.sorter(i,null!=(a=this.val)?a:i)<=0&&(this.val=i),\"last\"===t&&this.sorter(i,null!=(o=this.val)?o:i)>=0?this.val=i:void 0},value:function(){return this.val},format:function(t){return isNaN(t)?t:e(t)},numInputs:null!=r?0:1}}}},quantile:function(t,e){return null==e&&(e=A),function(n){var r;return r=n[0],function(n,a,o){return{vals:[],push:function(t){var e;return e=parseFloat(t[r]),isNaN(e)?void 0:this.vals.push(e)},value:function(){var e;return 0===this.vals.length?null:(this.vals.sort(function(t,e){return t-e}),e=(this.vals.length-1)*t,(this.vals[Math.floor(e)]+this.vals[Math.ceil(e)])/2)},format:e,numInputs:null!=r?0:1}}}},runningStat:function(t,e,n){return null==t&&(t=\"mean\"),null==e&&(e=1),null==n&&(n=A),function(r){var a;return a=r[0],function(r,o,i){return{n:0,m:0,s:0,push:function(t){var e,n;return n=parseFloat(t[a]),isNaN(n)?void 0:(this.n+=1,1===this.n?this.m=n:(e=this.m+(n-this.m)/this.n,this.s=this.s+(n-this.m)*(n-e),this.m=e))},value:function(){if(\"mean\"===t)return 0===this.n?0/0:this.m;if(this.n<=e)return 0;switch(t){case\"var\":return this.s/(this.n-e);case\"stdev\":return Math.sqrt(this.s/(this.n-e))}},format:n,numInputs:null!=a?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(e,a,o){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r])),isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){return null==t&&(t=!0),null==e&&(e=A),function(n){var r,a;return a=n[0],r=n[1],function(n,o,i){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[a]))||(this.sumNum+=parseFloat(t[a])),isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;return e=t?1:-1,(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=a&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e=\"total\"),null==r&&(r=S),function(){var a;return a=1<=arguments.length?n.call(arguments,0):[],function(n,o,i){return{selector:{total:[[],[]],row:[o,[]],col:[[],i]}[e],inner:t.apply(null,a)(n,o,i),push:function(t){return this.inner.push(t)},format:r,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,a)().numInputs}}}}},s.countUnique=function(t){return s.uniques(function(t){return t.length},t)},s.listUnique=function(t){return s.uniques(function(e){return e.join(t)},function(t){return t})},s.max=function(t){return s.extremes(\"max\",t)},s.min=function(t){return s.extremes(\"min\",t)},s.first=function(t){return s.extremes(\"first\",t)},s.last=function(t){return s.extremes(\"last\",t)},s.median=function(t){return s.quantile(.5,t)},s.average=function(t){return s.runningStat(\"mean\",1,t)},s[\"var\"]=function(t,e){return s.runningStat(\"var\",t,e)},s.stdev=function(t,e){return s.runningStat(\"stdev\",t,e)},l=function(t){return{Count:t.count(x),\"Count Unique Values\":t.countUnique(x),\"List Unique Values\":t.listUnique(\", \"),Sum:t.sum(A),\"Integer Sum\":t.sum(x),Average:t.average(A),Median:t.median(A),\"Sample Variance\":t[\"var\"](1,A),\"Sample Standard Deviation\":t.stdev(1,A),Minimum:t.min(A),Maximum:t.max(A),First:t.first(A),Last:t.last(A),\"Sum over Sum\":t.sumOverSum(A),\"80% Upper Bound\":t.sumOverSumBound80(!0,A),\"80% Lower Bound\":t.sumOverSumBound80(!1,A),\"Sum as Fraction of Total\":t.fractionOf(t.sum(),\"total\",S),\"Sum as Fraction of Rows\":t.fractionOf(t.sum(),\"row\",S),\"Sum as Fraction of Columns\":t.fractionOf(t.sum(),\"col\",S),\"Count as Fraction of Total\":t.fractionOf(t.count(),\"total\",S),\"Count as Fraction of Rows\":t.fractionOf(t.count(),\"row\",S),\"Count as Fraction of Columns\":t.fractionOf(t.count(),\"col\",S)}}(s),b={Table:function(t,e){return g(t,e)},\"Table Barchart\":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap(\"heatmap\",n)},\"Row Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"rowheatmap\",n)},\"Col Heatmap\":function(e,n){return t(g(e,n)).heatmap(\"colheatmap\",n)}},h={en:{aggregators:l,renderers:b,localeStrings:{renderError:\"An error occurred rendering the PivotTable results.\",computeError:\"An error occurred computing the PivotTable results.\",uiRenderError:\"An error occurred rendering the PivotTable UI.\",selectAll:\"Select All\",selectNone:\"Select None\",tooMany:\"(too many to list)\",filterResults:\"Filter values\",apply:\"Apply\",cancel:\"Cancel\",totals:\"Totals\",vs:\"vs\",by:\"by\"}}},p=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],N=function(t){return(\"0\"+t).substr(-2,2)},c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r,a){var o;return null==n&&(n=!1),null==r&&(r=p),null==a&&(a=u),o=n?\"UTC\":\"\",function(n){var i;return i=new Date(Date.parse(n[t])),isNaN(i)?\"\":e.replace(/%(.)/g,function(t,e){switch(e){case\"y\":return i[\"get\"+o+\"FullYear\"]();case\"m\":return N(i[\"get\"+o+\"Month\"]()+1);case\"n\":return r[i[\"get\"+o+\"Month\"]()];case\"d\":return N(i[\"get\"+o+\"Date\"]());case\"w\":return a[i[\"get\"+o+\"Day\"]()];case\"x\":return i[\"get\"+o+\"Day\"]();case\"H\":return N(i[\"get\"+o+\"Hours\"]());case\"M\":return N(i[\"get\"+o+\"Minutes\"]());case\"S\":return N(i[\"get\"+o+\"Seconds\"]());default:return\"%\"+e}})}}},C=/(\\d+)|(\\D+)/g,v=/\\d/,y=/^0/,f=function(t){return function(t,e){var n,r,a,o,i,s;if(null!=e&&null==t)return-1;if(null!=t&&null==e)return 1;if(\"number\"==typeof t&&isNaN(t))return-1;if(\"number\"==typeof e&&isNaN(e))return 1;if(i=+t,s=+e,s>i)return-1;if(i>s)return 1;if(\"number\"==typeof t&&\"number\"!=typeof e)return-1;if(\"number\"==typeof e&&\"number\"!=typeof t)return 1;if(\"number\"==typeof t&&\"number\"==typeof e)return 0;if(isNaN(s)&&!isNaN(i))return-1;if(isNaN(i)&&!isNaN(s))return 1;if(n=String(t),a=String(e),n===a)return 0;if(!v.test(n)||!v.test(a))return n>a?1:-1;for(n=n.match(C),a=a.match(C);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return v.test(r)&&v.test(o)?r.replace(y,\".0\")-o.replace(y,\".0\"):r>o?1:-1;return n.length-a.length}}(this),w=function(t){var e,n,r,a;r={},n={};for(e in t)a=t[e],r[a]=e,\"string\"==typeof a&&(n[a.toLowerCase()]=e);return function(t,e){return null!=r[t]&&null!=r[e]?r[t]-r[e]:null!=r[t]?-1:null!=r[e]?1:null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},d=function(e,n){var r;if(null!=e)if(t.isFunction(e)){if(r=e(n),t.isFunction(r))return r}else if(null!=e[n])return e[n];return f},o=function(){function e(t,n){var a,o,i,l,u,c,d,h,p,f;null==n&&(n={}),this.getAggregator=r(this.getAggregator,this),this.getRowKeys=r(this.getRowKeys,this),this.getColKeys=r(this.getColKeys,this),this.sortKeys=r(this.sortKeys,this),this.arrSort=r(this.arrSort,this),this.input=t,this.aggregator=null!=(a=n.aggregator)?a:s.count()(),this.aggregatorName=null!=(o=n.aggregatorName)?o:\"Count\",this.colAttrs=null!=(i=n.cols)?i:[],this.rowAttrs=null!=(l=n.rows)?l:[],this.valAttrs=null!=(u=n.vals)?u:[],this.sorters=null!=(c=n.sorters)?c:{},this.rowOrder=null!=(d=n.rowOrder)?d:\"key_a_to_z\",this.colOrder=null!=(h=n.colOrder)?h:\"key_a_to_z\",this.derivedAttributes=null!=(p=n.derivedAttributes)?p:{},this.filter=null!=(f=n.filter)?f:function(){return!0},this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(this.input,this.derivedAttributes,function(t){return function(e){return t.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,l,u,c,d,h,p,f,m,g;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){f=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){h={},p=e[0];for(l in p)a.call(p,l)&&(u=p[l],h[u]=i[l]);f.push(o(h))}return f}for(m=[],c=0,d=e.length;d>c;c++)h=e[c],m.push(o(h));return m}if(e instanceof jQuery)return g=[],t(\"thead > tr > th\",e).each(function(e){return g.push(t(this).text())}),t(\"tbody > tr\",e).each(function(e){return h={},t(\"td\",this).each(function(e){return h[g[e]]=t(this).text()}),o(h)});throw new Error(\"unknown input format\")},e.prototype.forEachMatchingRecord=function(t,n){return e.forEachRecord(this.input,this.derivedAttributes,function(e){return function(r){var a,o,i;if(e.filter(r)){for(a in t)if(i=t[a],i!==(null!=(o=r[a])?o:\"null\"))return;return n(r)}}}(this))},e.prototype.arrSort=function(t){var e,n;return n=function(){var n,r,a;for(a=[],n=0,r=t.length;r>n;n++)e=t[n],a.push(d(this.sorters,e));return a}.call(this),function(t,e){var r,o,i;for(o in n)if(a.call(n,o)&&(i=n[o],r=i(t[o],e[o]),0!==r))return r;return 0}},e.prototype.sortKeys=function(){var t;if(!this.sorted){switch(this.sorted=!0,t=function(t){return function(e,n){return t.getAggregator(e,n).value()}}(this),this.rowOrder){case\"value_a_to_z\":this.rowKeys.sort(function(e){return function(e,n){return f(t(e,[]),t(n,[]))}}(this));break;case\"value_z_to_a\":this.rowKeys.sort(function(e){return function(e,n){return-f(t(e,[]),t(n,[]))}}(this));break;default:this.rowKeys.sort(this.arrSort(this.rowAttrs))}switch(this.colOrder){case\"value_a_to_z\":return this.colKeys.sort(function(e){return function(e,n){return f(t([],e),t([],n))}}(this));case\"value_z_to_a\":return this.colKeys.sort(function(e){return function(e,n){return-f(t([],e),t([],n))}}(this));default:return this.colKeys.sort(this.arrSort(this.colAttrs))}}},e.prototype.getColKeys=function(){return this.sortKeys(),this.colKeys},e.prototype.getRowKeys=function(){return this.sortKeys(),this.rowKeys},e.prototype.processRecord=function(t){var e,n,r,a,o,i,s,l,u,c,d,h,p;for(e=[],h=[],l=this.colAttrs,a=0,o=l.length;o>a;a++)p=l[a],e.push(null!=(u=t[p])?u:\"null\");for(c=this.rowAttrs,s=0,i=c.length;i>s;s++)p=c[s],h.push(null!=(d=t[p])?d:\"null\");return r=h.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==h.length&&(this.rowTotals[r]||(this.rowKeys.push(h),this.rowTotals[r]=this.aggregator(this,h,[])),this.rowTotals[r].push(t)),0!==e.length&&(this.colTotals[n]||(this.colKeys.push(e),this.colTotals[n]=this.aggregator(this,[],e)),this.colTotals[n].push(t)),0!==e.length&&0!==h.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,h,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,a;return a=t.join(String.fromCharCode(0)),r=e.join(String.fromCharCode(0)),n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[a]:this.tree[a][r],null!=n?n:{value:function(){return null},format:function(){return\"\"}}},e}(),t.pivotUtilities={aggregatorTemplates:s,aggregators:l,renderers:b,derivers:c,locales:h,naturalSort:f,numberFormat:m,sortAs:w,PivotData:o},g=function(e,n){var r,o,i,s,l,u,c,d,h,p,f,m,g,v,b,C,y,w,A,x,S,N,T,k;u={table:{clickCallback:null},localeStrings:{totals:\"Totals\"}},n=t.extend(!0,{},u,n),i=e.colAttrs,m=e.rowAttrs,v=e.getRowKeys(),l=e.getColKeys(),n.table.clickCallback&&(c=function(t,r,o){var s,l,u;l={};for(u in i)a.call(i,u)&&(s=i[u],null!=o[u]&&(l[s]=o[u]));for(u in m)a.call(m,u)&&(s=m[u],null!=r[u]&&(l[s]=r[u]));return function(r){return n.table.clickCallback(r,t,l,e)}}),f=document.createElement(\"table\"),f.className=\"pvtTable\",b=function(t,e,n){var r,a,o,i,s,l,u,c;if(0!==e){for(i=!0,c=r=0,s=n;s>=0?s>=r:r>=s;c=s>=0?++r:--r)t[e-1][c]!==t[e][c]&&(i=!1);if(i)return-1}for(a=0;e+a=0?l>=o:o>=l;c=l>=0?++o:--o)t[e][c]!==t[e+a][c]&&(u=!0);if(u)break;a++}return a},A=document.createElement(\"thead\");for(h in i)if(a.call(i,h)){o=i[h],S=document.createElement(\"tr\"),0===parseInt(h)&&0!==m.length&&(w=document.createElement(\"th\"),w.setAttribute(\"colspan\",m.length),w.setAttribute(\"rowspan\",i.length),S.appendChild(w)),w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=o,S.appendChild(w);for(d in l)a.call(l,d)&&(s=l[d],k=b(l,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtColLabel\",w.textContent=s[h],w.setAttribute(\"colspan\",k),parseInt(h)===i.length-1&&0!==m.length&&w.setAttribute(\"rowspan\",2),S.appendChild(w)));0===parseInt(h)&&(w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"rowspan\",i.length+(0===m.length?0:1)),S.appendChild(w)),A.appendChild(S)}if(0!==m.length){S=document.createElement(\"tr\");for(d in m)a.call(m,d)&&(p=m[d],w=document.createElement(\"th\"),w.className=\"pvtAxisLabel\",w.textContent=p,S.appendChild(w));w=document.createElement(\"th\"),0===i.length&&(w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals),S.appendChild(w),A.appendChild(S)}f.appendChild(A),C=document.createElement(\"tbody\");for(d in v)if(a.call(v,d)){g=v[d],S=document.createElement(\"tr\");for(h in g)a.call(g,h)&&(N=g[h],k=b(v,parseInt(d),parseInt(h)),-1!==k&&(w=document.createElement(\"th\"),w.className=\"pvtRowLabel\",w.textContent=N,w.setAttribute(\"rowspan\",k),parseInt(h)===m.length-1&&0!==i.length&&w.setAttribute(\"colspan\",2),S.appendChild(w)));for(h in l)a.call(l,h)&&(s=l[h],r=e.getAggregator(g,s),T=r.value(),y=document.createElement(\"td\"),y.className=\"pvtVal row\"+d+\" col\"+h,y.textContent=r.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,s)),S.appendChild(y));x=e.getAggregator(g,[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal rowTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,g,[])),y.setAttribute(\"data-for\",\"row\"+d),S.appendChild(y),C.appendChild(S)}S=document.createElement(\"tr\"),w=document.createElement(\"th\"),w.className=\"pvtTotalLabel\",w.innerHTML=n.localeStrings.totals,w.setAttribute(\"colspan\",m.length+(0===i.length?0:1)),S.appendChild(w);for(h in l)a.call(l,h)&&(s=l[h],x=e.getAggregator([],s),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtTotal colTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],s)),y.setAttribute(\"data-for\",\"col\"+h),S.appendChild(y));return x=e.getAggregator([],[]),T=x.value(),y=document.createElement(\"td\"),y.className=\"pvtGrandTotal\",y.textContent=x.format(T),y.setAttribute(\"data-value\",T),null!=c&&(y.onclick=c(T,[],[])),S.appendChild(y),C.appendChild(S),f.appendChild(C),f.setAttribute(\"data-numrows\",v.length),f.setAttribute(\"data-numcols\",l.length),f},t.fn.pivot=function(e,n,r){var a,i,l,u,c,d,p,f;null==r&&(r=\"en\"),null==h[r]&&(r=\"en\"),a={cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,filter:function(){return!0},aggregator:s.count()(),aggregatorName:\"Count\",sorters:{},derivedAttributes:{},renderer:g},u=t.extend(!0,{},h.en.localeStrings,h[r].localeStrings),l={rendererOptions:{localeStrings:u},localeStrings:u},c=t.extend(!0,{},l,t.extend({},a,n)),p=null;try{d=new c.dataClass(e,c);try{p=c.renderer(d,c.rendererOptions)}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.renderError)}}catch(m){i=m,\"undefined\"!=typeof console&&null!==console&&console.error(i.stack),p=t(\"\").html(c.localeStrings.computeError)}for(f=this[0];f.hasChildNodes();)f.removeChild(f.lastChild);return this.append(p)},t.fn.pivotUI=function(n,r,i,s){var l,u,c,p,m,g,v,b,C,y,w,A,x,S,N,T,k,_,O,F,E,D,M,R,I,K,L,q,z,U,V,j,H,B,W,P,J,G,Q,$,Y,X;null==i&&(i=!1),null==s&&(s=\"en\"),null==h[s]&&(s=\"en\"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:500,cols:[],rows:[],vals:[],rowOrder:\"key_a_to_z\",colOrder:\"key_a_to_z\",dataClass:o,exclusions:{},inclusions:{},unusedAttrsVertical:85,autoSortUnusedAttrs:!1,onRefresh:null,filter:function(){return!0},sorters:{}},_=t.extend(!0,{},h.en.localeStrings,h[s].localeStrings),k={rendererOptions:{localeStrings:_},localeStrings:_},C=this.data(\"pivotUIOptions\"),D=null==C||i?t.extend(!0,{},k,t.extend({},v,r)):C;try{m={},O=[],I=0,o.forEachRecord(n,D.derivedAttributes,function(t){var e,n,r,o;if(D.filter(t)){O.push(t);for(e in t)a.call(t,e)&&null==m[e]&&(m[e]={},I>0&&(m[e][\"null\"]=I));for(e in m)o=null!=(r=t[e])?r:\"null\",null==(n=m[e])[o]&&(n[o]=0),m[e][o]++;return I++}}),G=t(\"\",{\"class\":\"pvtUi\"}).attr(\"cellpadding\",5),H=t(\"\"),j=t(\"\").addClass(\"pvtRenderer\").appendTo(H).bind(\"change\",function(){return U()}),K=D.renderers;for(X in K)a.call(K,X)&&t(\"\").val(X).html(X).appendTo(j);if(Q=t(\"\").addClass(\"pvtAxisContainer pvtUnused\"),W=function(){var t;t=[];for(l in m)e.call(D.hiddenAttributes,l)<0&&t.push(l);return t}(),Y=!1,$=\"auto\"===D.unusedAttrsVertical?120:parseInt(D.unusedAttrsVertical),!isNaN($)){for(p=0,x=0,S=W.length;S>x;x++)l=W[x],p+=l.length;Y=p>$}Q.addClass(D.unusedAttrsVertical===!0||Y?\"pvtVertList\":\"pvtHorizList\"),y=function(n){var r,a,o,i,s,l,u,c,h,p,f,g,v,b,C,y,A,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t(\"\").addClass(\"pvtFilterBox\").hide(),x.append(t(\"\").append(t(\"\").text(n),t(\"\").addClass(\"count\").text(\"(\"+S.length+\")\"))),S.length>D.menuLimit)x.append(t(\"\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t(\"
\").appendTo(x),v=d(D.sorters,n),f=D.localeStrings.filterResults,t(\"\",{type:\"text\"}).appendTo(i).attr({placeholder:f,\"class\":\"pvtSearch\"}).bind(\"keyup\",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length?!0:(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=a.startsWith(\">=\")?r(\">=\",[1,0]):a.startsWith(\"<=\")?r(\"<=\",[-1,0]):a.startsWith(\">\")?r(\">\",[1]):a.startsWith(\"<\")?r(\"<\",[-1]):a.startsWith(\"~\")?function(t){return 0===a.substring(1).trim().length?!0:t.toLowerCase().match(a.substring(1))}:function(t){return-1!==t.toLowerCase().indexOf(a)},x.find(\".pvtCheckContainer p label span.value\").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t(\"\")),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectAll).bind(\"click\",function(){return x.find(\"input:visible:not(:checked)\").prop(\"checked\",!0).toggleClass(\"changed\"),!1}),t(\"\",{type:\"button\"}).appendTo(i).html(D.localeStrings.selectNone).bind(\"click\",function(){return x.find(\"input:visible:checked\").prop(\"checked\",!1).toggleClass(\"changed\"),!1})),a=t(\"\").addClass(\"pvtCheckContainer\").appendTo(x),g=S.sort(d(D.sorters,n)),p=0,h=g.length;h>p;p++)y=g[p],A=m[n][y],s=t(\"\"),l=!1,D.inclusions[n]?l=e.call(D.inclusions[n],y)<0:D.exclusions[n]&&(l=e.call(D.exclusions[n],y)>=0),c||(c=l),t(\"\").attr(\"type\",\"checkbox\").addClass(\"pvtFilter\").attr(\"checked\",!l).data(\"filter\",[n,y]).appendTo(s).bind(\"change\",function(){return t(this).toggleClass(\"changed\")}),s.append(t(\"\").addClass(\"value\").text(y)),s.append(t(\"\").addClass(\"count\").text(\"(\"+A+\")\")),a.append(t(\"\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"
\").append(s));return o=function(){return x.find(\"[type='checkbox']\").length>x.find(\"[type='checkbox']:checked\").length?r.addClass(\"pvtFilteredAttribute\"):r.removeClass(\"pvtFilteredAttribute\"),x.find(\".pvtSearch\").val(\"\"),x.find(\".pvtCheckContainer p\").show(),x.hide()},u=t(\"
\").appendTo(x),S.length<=D.menuLimit&&t(\"\",{type:\"button\"}).text(D.localeStrings.apply).appendTo(u).bind(\"click\",function(){return x.find(\".changed\").removeClass(\"changed\").length&&U(),o()}),t(\"\",{type:\"button\"}).text(D.localeStrings.cancel).appendTo(u).bind(\"click\",function(){return x.find(\".changed:checked\").removeClass(\"changed\").prop(\"checked\",!1),x.find(\".changed:not(:checked)\").removeClass(\"changed\").prop(\"checked\",!0),o()}),b=t(\"\").addClass(\"pvtTriangle\").html(\" ▾\").bind(\"click\",function(e){var n,r,a;return r=t(e.currentTarget).position(),n=r.left,a=r.top,x.css({left:n+10,top:a+10}).show()}),r=t(\"\").addClass(\"axis_\"+w).append(t(\"\").addClass(\"pvtAttr\").text(n).data(\"attrName\",n).append(b)),c&&r.addClass(\"pvtFilteredAttribute\"),Q.append(r).append(x)};for(w in W)a.call(W,w)&&(c=W[w],y(c));P=t(\"