pivottable
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "pivottable", | ||
"description": "Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop", | ||
"version": "1.3.0", | ||
"main": "dist/pivot.js", | ||
"version": "1.4.0", | ||
"main": [ | ||
"dist/pivot.js", | ||
"dist/pivot.css" | ||
], | ||
"license": "MIT", | ||
@@ -7,0 +10,0 @@ "ignore": [ |
@@ -22,3 +22,6 @@ (function() { | ||
opts = $.extend(defaults, opts); | ||
result = $("<div style='width: 100%; height: 100%;'>"); | ||
result = $("<div>").css({ | ||
width: "100%", | ||
height: "100%" | ||
}); | ||
tree = { | ||
@@ -25,0 +28,0 @@ name: "All", |
@@ -1,2 +0,2 @@ | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){return e.pivotUtilities.d3_renderers={Treemap:function(t,n){var r,i,l,u,o,d,a,c,s,f,h,p,y,g;for(l={localeStrings:{}},n=e.extend(l,n),d=e("<div style='width: 100%; height: 100%;'>"),c={name:"All",children:[]},r=function(e,t,n){var i,l,u,o,d,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),u=t.shift(),a=e.children,o=0,d=a.length;d>o;o++)if(i=a[o],i.name===u)return void r(i,t,n);return l={name:u},r(l,t,n),e.children.push(l)},g=t.getRowKeys(),p=0,y=g.length;y>p;p++)a=g[p],f=t.getAggregator(a,[]).value(),null!=f&&r(c,a,f);return i=d3.scale.category10(),h=e(window).width()/1.4,u=e(window).height()/1.4,o=10,s=d3.layout.treemap().size([h,u]).sticky(!0).value(function(e){return e.size}),d3.select(d[0]).append("div").style("position","relative").style("width",h+2*o+"px").style("height",u+2*o+"px").style("left",o+"px").style("top",o+"px").datum(c).selectAll(".node").data(s.padding([15,0,0,0]).value(function(e){return e.value}).nodes).enter().append("div").attr("class","node").style("background",function(e){return null!=e.children?"lightgrey":i(e.name)}).text(function(e){return e.name}).call(function(){this.style("left",function(e){return e.x+"px"}).style("top",function(e){return e.y+"px"}).style("width",function(e){return Math.max(0,e.dx-1)+"px"}).style("height",function(e){return Math.max(0,e.dy-1)+"px"})}),d}}})}).call(this); | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){return e.pivotUtilities.d3_renderers={Treemap:function(t,n){var r,i,l,u,o,d,a,c,s,f,h,p,y,g;for(l={localeStrings:{}},n=e.extend(l,n),d=e("<div>").css({width:"100%",height:"100%"}),c={name:"All",children:[]},r=function(e,t,n){var i,l,u,o,d,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),u=t.shift(),a=e.children,o=0,d=a.length;d>o;o++)if(i=a[o],i.name===u)return void r(i,t,n);return l={name:u},r(l,t,n),e.children.push(l)},g=t.getRowKeys(),p=0,y=g.length;y>p;p++)a=g[p],f=t.getAggregator(a,[]).value(),null!=f&&r(c,a,f);return i=d3.scale.category10(),h=e(window).width()/1.4,u=e(window).height()/1.4,o=10,s=d3.layout.treemap().size([h,u]).sticky(!0).value(function(e){return e.size}),d3.select(d[0]).append("div").style("position","relative").style("width",h+2*o+"px").style("height",u+2*o+"px").style("left",o+"px").style("top",o+"px").datum(c).selectAll(".node").data(s.padding([15,0,0,0]).value(function(e){return e.value}).nodes).enter().append("div").attr("class","node").style("background",function(e){return null!=e.children?"lightgrey":i(e.name)}).text(function(e){return e.name}).call(function(){this.style("left",function(e){return e.x+"px"}).style("top",function(e){return e.y+"px"}).style("width",function(e){return Math.max(0,e.dx-1)+"px"}).style("height",function(e){return Math.max(0,e.dy-1)+"px"})}),d}}})}).call(this); | ||
//# sourceMappingURL=d3_renderers.min.js.map |
@@ -18,3 +18,3 @@ (function() { | ||
return function(pivotData, opts) { | ||
var agg, colKey, colKeys, dataArray, dataTable, defaults, groupByTitle, h, hAxisTitle, headers, k, numCharsInHAxis, options, result, row, rowKey, rowKeys, title, v, vAxisTitle, wrapper, _i, _j, _len, _len1; | ||
var agg, colKey, colKeys, dataArray, dataTable, defaults, fullAggName, groupByTitle, h, hAxisTitle, headers, k, numCharsInHAxis, options, result, row, rowKey, rowKeys, title, tree2, v, vAxisTitle, wrapper, x, y, _i, _j, _len, _len1, _ref; | ||
defaults = { | ||
@@ -35,2 +35,6 @@ localeStrings: { | ||
} | ||
fullAggName = pivotData.aggregatorName; | ||
if (pivotData.valAttrs.length) { | ||
fullAggName += "(" + (pivotData.valAttrs.join(", ")) + ")"; | ||
} | ||
headers = (function() { | ||
@@ -47,27 +51,52 @@ var _i, _len, _results; | ||
numCharsInHAxis = 0; | ||
dataArray = [headers]; | ||
for (_i = 0, _len = colKeys.length; _i < _len; _i++) { | ||
colKey = colKeys[_i]; | ||
row = [colKey.join("-")]; | ||
numCharsInHAxis += row[0].length; | ||
for (_j = 0, _len1 = rowKeys.length; _j < _len1; _j++) { | ||
rowKey = rowKeys[_j]; | ||
agg = pivotData.getAggregator(rowKey, colKey); | ||
if (agg.value() != null) { | ||
row.push(agg.value()); | ||
} else { | ||
row.push(null); | ||
if (chartType === "ScatterChart") { | ||
dataArray = []; | ||
_ref = pivotData.tree; | ||
for (y in _ref) { | ||
tree2 = _ref[y]; | ||
for (x in tree2) { | ||
agg = tree2[x]; | ||
dataArray.push([parseFloat(x), parseFloat(y), fullAggName + ": \n" + agg.format(agg.value())]); | ||
} | ||
} | ||
dataArray.push(row); | ||
console.log(dataArray); | ||
dataTable = new google.visualization.DataTable(); | ||
dataTable.addColumn('number', pivotData.colAttrs.join("-")); | ||
dataTable.addColumn('number', pivotData.rowAttrs.join("-")); | ||
dataTable.addColumn({ | ||
type: "string", | ||
role: "tooltip" | ||
}); | ||
dataTable.addRows(dataArray); | ||
hAxisTitle = pivotData.colAttrs.join("-"); | ||
vAxisTitle = pivotData.rowAttrs.join("-"); | ||
title = ""; | ||
} else { | ||
dataArray = [headers]; | ||
for (_i = 0, _len = colKeys.length; _i < _len; _i++) { | ||
colKey = colKeys[_i]; | ||
row = [colKey.join("-")]; | ||
numCharsInHAxis += row[0].length; | ||
for (_j = 0, _len1 = rowKeys.length; _j < _len1; _j++) { | ||
rowKey = rowKeys[_j]; | ||
agg = pivotData.getAggregator(rowKey, colKey); | ||
if (agg.value() != null) { | ||
row.push(agg.value()); | ||
} else { | ||
row.push(null); | ||
} | ||
} | ||
dataArray.push(row); | ||
} | ||
dataTable = google.visualization.arrayToDataTable(dataArray); | ||
title = vAxisTitle = fullAggName; | ||
hAxisTitle = pivotData.colAttrs.join("-"); | ||
if (hAxisTitle !== "") { | ||
title += " " + opts.localeStrings.vs + " " + hAxisTitle; | ||
} | ||
groupByTitle = pivotData.rowAttrs.join("-"); | ||
if (groupByTitle !== "") { | ||
title += " " + opts.localeStrings.by + " " + groupByTitle; | ||
} | ||
} | ||
title = vAxisTitle = pivotData.aggregatorName + (pivotData.valAttrs.length ? "(" + (pivotData.valAttrs.join(", ")) + ")" : ""); | ||
hAxisTitle = pivotData.colAttrs.join("-"); | ||
if (hAxisTitle !== "") { | ||
title += " " + opts.localeStrings.vs + " " + hAxisTitle; | ||
} | ||
groupByTitle = pivotData.rowAttrs.join("-"); | ||
if (groupByTitle !== "") { | ||
title += " " + opts.localeStrings.by + " " + groupByTitle; | ||
} | ||
options = { | ||
@@ -83,8 +112,22 @@ width: $(window).width() / 1.4, | ||
title: vAxisTitle | ||
}, | ||
tooltip: { | ||
textStyle: { | ||
fontName: 'Arial', | ||
fontSize: 12 | ||
} | ||
} | ||
}; | ||
if (dataArray[0].length === 2 && dataArray[0][1] === "") { | ||
if (chartType === "ScatterChart") { | ||
options.legend = { | ||
position: "none" | ||
}; | ||
options.chartArea = { | ||
'width': '80%', | ||
'height': '80%' | ||
}; | ||
} else if (dataArray[0].length === 2 && dataArray[0][1] === "") { | ||
options.legend = { | ||
position: "none" | ||
}; | ||
} | ||
@@ -95,4 +138,6 @@ for (k in extraOptions) { | ||
} | ||
dataTable = google.visualization.arrayToDataTable(dataArray); | ||
result = $("<div style='width: 100%; height: 100%;'>"); | ||
result = $("<div>").css({ | ||
width: "100%", | ||
height: "100%" | ||
}); | ||
wrapper = new google.visualization.ChartWrapper({ | ||
@@ -123,3 +168,4 @@ dataTable: dataTable, | ||
isStacked: true | ||
}) | ||
}), | ||
"Scatter Chart": makeGoogleChart("ScatterChart") | ||
}; | ||
@@ -126,0 +172,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
(function(){var t;(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 e;return e=function(e,n){return function(r,i){var a,o,l,h,u,s,g,d,c,f,v,p,y,C,w,j,b,A,S,k,m,x,T,z,q;for(s={localeStrings:{vs:"vs",by:"by"}},i=t.extend(s,i),b=r.getRowKeys(),0===b.length&&b.push([]),l=r.getColKeys(),0===l.length&&l.push([]),f=function(){var t,e,n;for(n=[],t=0,e=b.length;e>t;t++)d=b[t],n.push(d.join("-"));return n}(),f.unshift(""),p=0,h=[f],x=0,z=l.length;z>x;x++){for(o=l[x],w=[o.join("-")],p+=w[0].length,T=0,q=b.length;q>T;T++)j=b[T],a=r.getAggregator(j,o),w.push(null!=a.value()?a.value():null);h.push(w)}A=k=r.aggregatorName+(r.valAttrs.length?"("+r.valAttrs.join(", ")+")":""),c=r.colAttrs.join("-"),""!==c&&(A+=" "+i.localeStrings.vs+" "+c),g=r.rowAttrs.join("-"),""!==g&&(A+=" "+i.localeStrings.by+" "+g),y={width:t(window).width()/1.4,height:t(window).height()/1.4,title:A,hAxis:{title:c,slantedText:p>50},vAxis:{title:k}},2===h[0].length&&""===h[0][1]&&(y.legend={position:"none"});for(v in n)S=n[v],y[v]=S;return u=google.visualization.arrayToDataTable(h),C=t("<div style='width: 100%; height: 100%;'>"),m=new google.visualization.ChartWrapper({dataTable:u,chartType:e,options:y}),m.draw(C[0]),C.bind("dblclick",function(){var t;return t=new google.visualization.ChartEditor,google.visualization.events.addListener(t,"ok",function(){return t.getChartWrapper().draw(C[0])}),t.openDialog(m)}),C}},t.pivotUtilities.gchart_renderers={"Line Chart":e("LineChart"),"Bar Chart":e("ColumnChart"),"Stacked Bar Chart":e("ColumnChart",{isStacked:!0}),"Area Chart":e("AreaChart",{isStacked:!0})}})}).call(this); | ||
(function(){var t;(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 e;return e=function(e,r){return function(n,o){var a,i,l,s,h,u,g,d,c,f,p,v,C,w,y,A,j,b,m,S,x,z,T,k,q,D,L,B,F,K;if(u={localeStrings:{vs:"vs",by:"by"}},o=t.extend(u,o),b=n.getRowKeys(),0===b.length&&b.push([]),l=n.getColKeys(),0===l.length&&l.push([]),g=n.aggregatorName,n.valAttrs.length&&(g+="("+n.valAttrs.join(", ")+")"),p=function(){var t,e,r;for(r=[],t=0,e=b.length;e>t;t++)c=b[t],r.push(c.join("-"));return r}(),p.unshift(""),C=0,"ScatterChart"===e){s=[],K=n.tree;for(q in K){S=K[q];for(k in S)a=S[k],s.push([parseFloat(k),parseFloat(q),g+": \n"+a.format(a.value())])}console.log(s),h=new google.visualization.DataTable,h.addColumn("number",n.colAttrs.join("-")),h.addColumn("number",n.rowAttrs.join("-")),h.addColumn({type:"string",role:"tooltip"}),h.addRows(s),f=n.colAttrs.join("-"),z=n.rowAttrs.join("-"),m=""}else{for(s=[p],D=0,B=l.length;B>D;D++){for(i=l[D],A=[i.join("-")],C+=A[0].length,L=0,F=b.length;F>L;L++)j=b[L],a=n.getAggregator(j,i),A.push(null!=a.value()?a.value():null);s.push(A)}h=google.visualization.arrayToDataTable(s),m=z=g,f=n.colAttrs.join("-"),""!==f&&(m+=" "+o.localeStrings.vs+" "+f),d=n.rowAttrs.join("-"),""!==d&&(m+=" "+o.localeStrings.by+" "+d)}w={width:t(window).width()/1.4,height:t(window).height()/1.4,title:m,hAxis:{title:f,slantedText:C>50},vAxis:{title:z},tooltip:{textStyle:{fontName:"Arial",fontSize:12}}},"ScatterChart"===e?(w.legend={position:"none"},w.chartArea={width:"80%",height:"80%"}):2===s[0].length&&""===s[0][1]&&(w.legend={position:"none"});for(v in r)x=r[v],w[v]=x;return y=t("<div>").css({width:"100%",height:"100%"}),T=new google.visualization.ChartWrapper({dataTable:h,chartType:e,options:w}),T.draw(y[0]),y.bind("dblclick",function(){var t;return t=new google.visualization.ChartEditor,google.visualization.events.addListener(t,"ok",function(){return t.getChartWrapper().draw(y[0])}),t.openDialog(T)}),y}},t.pivotUtilities.gchart_renderers={"Line Chart":e("LineChart"),"Bar Chart":e("ColumnChart"),"Stacked Bar Chart":e("ColumnChart",{isStacked:!0}),"Area Chart":e("AreaChart",{isStacked:!0}),"Scatter Chart":e("ScatterChart")}})}).call(this); | ||
//# sourceMappingURL=gchart_renderers.min.js.map |
@@ -54,2 +54,4 @@ (function() { | ||
"Promedio": tpl.average(frFmt), | ||
"Mínimo": tpl.min(frFmt), | ||
"Máximo": tpl.max(frFmt), | ||
"Suma de sumas": tpl.sumOverSum(frFmt), | ||
@@ -56,0 +58,0 @@ "Cota 80% superior": tpl.sumOverSumBound80(true, frFmt), |
@@ -1,2 +0,2 @@ | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var a,t,r,o,i;return o=e.pivotUtilities.numberFormat,i=e.pivotUtilities.aggregatorTemplates,a=o({thousandsSep:" ",decimalSep:","}),t=o({digitsAfterDecimal:0,thousandsSep:" ",decimalSep:","}),r=o({digitsAfterDecimal:1,scaler:100,suffix:"%",thousandsSep:" ",decimalSep:","}),e.pivotUtilities.locales.es={localeStrings:{renderError:"Ocurrió un error durante la interpretación de la tabla din´mica.",computeError:"Ocurrió un error durante el c´lculo de la tabla din´mica.",uiRenderError:"Ocurrió un error durante el dibujado de la tabla din´mica.",selectAll:"Seleccionar todo",selectNone:"Deseleccionar todo",tooMany:"(demasiados valores)",filterResults:"Filtrar resultados",totals:"Totales",vs:"vs",by:"por"},aggregators:{Cuenta:i.count(t),"Cuenta de valores únicos":i.countUnique(t),"Lista de valores únicos":i.listUnique(", "),Suma:i.sum(a),"Suma de enteros":i.sum(t),Promedio:i.average(a),"Suma de sumas":i.sumOverSum(a),"Cota 80% superior":i.sumOverSumBound80(!0,a),"Cota 80% inferior":i.sumOverSumBound80(!1,a),"Proporción del total (suma)":i.fractionOf(i.sum(),"total",r),"Proporción de la fila (suma)":i.fractionOf(i.sum(),"row",r),"Proporción de la columna (suma)":i.fractionOf(i.sum(),"col",r),"Proporción del total (cuenta)":i.fractionOf(i.count(),"total",r),"Proporción de la fila (cuenta)":i.fractionOf(i.count(),"row",r),"Proporción de la columna (cuenta)":i.fractionOf(i.count(),"col",r)},renderers:{Tabla:e.pivotUtilities.renderers.Table,"Tabla con barras":e.pivotUtilities.renderers["Table Barchart"],Heatmap:e.pivotUtilities.renderers.Heatmap,"Heatmap por filas":e.pivotUtilities.renderers["Row Heatmap"],"Heatmap por columnas":e.pivotUtilities.renderers["Col Heatmap"]}}})}).call(this); | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var a,t,r,o,i;return o=e.pivotUtilities.numberFormat,i=e.pivotUtilities.aggregatorTemplates,a=o({thousandsSep:" ",decimalSep:","}),t=o({digitsAfterDecimal:0,thousandsSep:" ",decimalSep:","}),r=o({digitsAfterDecimal:1,scaler:100,suffix:"%",thousandsSep:" ",decimalSep:","}),e.pivotUtilities.locales.es={localeStrings:{renderError:"Ocurrió un error durante la interpretación de la tabla din´mica.",computeError:"Ocurrió un error durante el c´lculo de la tabla din´mica.",uiRenderError:"Ocurrió un error durante el dibujado de la tabla din´mica.",selectAll:"Seleccionar todo",selectNone:"Deseleccionar todo",tooMany:"(demasiados valores)",filterResults:"Filtrar resultados",totals:"Totales",vs:"vs",by:"por"},aggregators:{Cuenta:i.count(t),"Cuenta de valores únicos":i.countUnique(t),"Lista de valores únicos":i.listUnique(", "),Suma:i.sum(a),"Suma de enteros":i.sum(t),Promedio:i.average(a),"Mínimo":i.min(a),"Máximo":i.max(a),"Suma de sumas":i.sumOverSum(a),"Cota 80% superior":i.sumOverSumBound80(!0,a),"Cota 80% inferior":i.sumOverSumBound80(!1,a),"Proporción del total (suma)":i.fractionOf(i.sum(),"total",r),"Proporción de la fila (suma)":i.fractionOf(i.sum(),"row",r),"Proporción de la columna (suma)":i.fractionOf(i.sum(),"col",r),"Proporción del total (cuenta)":i.fractionOf(i.count(),"total",r),"Proporción de la fila (cuenta)":i.fractionOf(i.count(),"row",r),"Proporción de la columna (cuenta)":i.fractionOf(i.count(),"col",r)},renderers:{Tabla:e.pivotUtilities.renderers.Table,"Tabla con barras":e.pivotUtilities.renderers["Table Barchart"],Heatmap:e.pivotUtilities.renderers.Heatmap,"Heatmap por filas":e.pivotUtilities.renderers["Row Heatmap"],"Heatmap por columnas":e.pivotUtilities.renderers["Col Heatmap"]}}})}).call(this); | ||
//# sourceMappingURL=pivot.es.min.js.map |
@@ -54,2 +54,4 @@ (function() { | ||
"Moyenne": tpl.average(frFmt), | ||
"Minimum": tpl.min(frFmt), | ||
"Maximum": tpl.max(frFmt), | ||
"Ratio de sommes": tpl.sumOverSum(frFmt), | ||
@@ -56,0 +58,0 @@ "Borne supérieure 80%": tpl.sumOverSumBound80(true, frFmt), |
@@ -1,2 +0,2 @@ | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var r,t,o,n,i;return n=e.pivotUtilities.numberFormat,i=e.pivotUtilities.aggregatorTemplates,r=n({thousandsSep:" ",decimalSep:","}),t=n({digitsAfterDecimal:0,thousandsSep:" ",decimalSep:","}),o=n({digitsAfterDecimal:1,scaler:100,suffix:"%",thousandsSep:" ",decimalSep:","}),e.pivotUtilities.locales.fr={localeStrings:{renderError:"Une erreur est survenue en dessinant le tableau croisé.",computeError:"Une erreur est survenue en calculant le tableau croisé.",uiRenderError:"Une erreur est survenue en dessinant l'interface du tableau croisé dynamique.",selectAll:"Sélectionner tout",selectNone:"Sélectionner rien",tooMany:"(trop de valeurs à afficher)",filterResults:"Filtrer les valeurs",totals:"Totaux",vs:"sur",by:"par"},aggregators:{Nombre:i.count(t),"Nombre de valeurs uniques":i.countUnique(t),"Liste de valeurs uniques":i.listUnique(", "),Somme:i.sum(r),"Somme en entiers":i.sum(t),Moyenne:i.average(r),"Ratio de sommes":i.sumOverSum(r),"Borne supérieure 80%":i.sumOverSumBound80(!0,r),"Borne inférieure 80%":i.sumOverSumBound80(!1,r),"Somme en proportion du totale":i.fractionOf(i.sum(),"total",o),"Somme en proportion de la ligne":i.fractionOf(i.sum(),"row",o),"Somme en proportion de la colonne":i.fractionOf(i.sum(),"col",o),"Nombre en proportion du totale":i.fractionOf(i.count(),"total",o),"Nombre en proportion de la ligne":i.fractionOf(i.count(),"row",o),"Nombre en proportion de la colonne":i.fractionOf(i.count(),"col",o)},renderers:{Table:e.pivotUtilities.renderers.Table,"Table avec barres":e.pivotUtilities.renderers["Table Barchart"],"Carte de chaleur":e.pivotUtilities.renderers.Heatmap,"Carte de chaleur par ligne":e.pivotUtilities.renderers["Row Heatmap"],"Carte de chaleur par colonne":e.pivotUtilities.renderers["Col Heatmap"]}}})}).call(this); | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var r,t,o,i,n;return i=e.pivotUtilities.numberFormat,n=e.pivotUtilities.aggregatorTemplates,r=i({thousandsSep:" ",decimalSep:","}),t=i({digitsAfterDecimal:0,thousandsSep:" ",decimalSep:","}),o=i({digitsAfterDecimal:1,scaler:100,suffix:"%",thousandsSep:" ",decimalSep:","}),e.pivotUtilities.locales.fr={localeStrings:{renderError:"Une erreur est survenue en dessinant le tableau croisé.",computeError:"Une erreur est survenue en calculant le tableau croisé.",uiRenderError:"Une erreur est survenue en dessinant l'interface du tableau croisé dynamique.",selectAll:"Sélectionner tout",selectNone:"Sélectionner rien",tooMany:"(trop de valeurs à afficher)",filterResults:"Filtrer les valeurs",totals:"Totaux",vs:"sur",by:"par"},aggregators:{Nombre:n.count(t),"Nombre de valeurs uniques":n.countUnique(t),"Liste de valeurs uniques":n.listUnique(", "),Somme:n.sum(r),"Somme en entiers":n.sum(t),Moyenne:n.average(r),Minimum:n.min(r),Maximum:n.max(r),"Ratio de sommes":n.sumOverSum(r),"Borne supérieure 80%":n.sumOverSumBound80(!0,r),"Borne inférieure 80%":n.sumOverSumBound80(!1,r),"Somme en proportion du totale":n.fractionOf(n.sum(),"total",o),"Somme en proportion de la ligne":n.fractionOf(n.sum(),"row",o),"Somme en proportion de la colonne":n.fractionOf(n.sum(),"col",o),"Nombre en proportion du totale":n.fractionOf(n.count(),"total",o),"Nombre en proportion de la ligne":n.fractionOf(n.count(),"row",o),"Nombre en proportion de la colonne":n.fractionOf(n.count(),"col",o)},renderers:{Table:e.pivotUtilities.renderers.Table,"Table avec barres":e.pivotUtilities.renderers["Table Barchart"],"Carte de chaleur":e.pivotUtilities.renderers.Heatmap,"Carte de chaleur par ligne":e.pivotUtilities.renderers["Row Heatmap"],"Carte de chaleur par colonne":e.pivotUtilities.renderers["Col Heatmap"]}}})}).call(this); | ||
//# sourceMappingURL=pivot.fr.min.js.map |
@@ -23,3 +23,3 @@ (function() { | ||
*/ | ||
var PivotData, addSeparators, aggregatorTemplates, aggregators, dayNamesEn, derivers, locales, mthNamesEn, naturalSort, numberFormat, pivotTableRenderer, renderers, usFmt, usFmtInt, usFmtPct, zeroPad; | ||
var PivotData, addSeparators, aggregatorTemplates, aggregators, dayNamesEn, derivers, getSort, locales, mthNamesEn, naturalSort, numberFormat, pivotTableRenderer, renderers, sortAs, usFmt, usFmtInt, usFmtPct, zeroPad; | ||
addSeparators = function(nStr, thousandsSep, decimalSep) { | ||
@@ -163,2 +163,54 @@ var rgx, x, x1, x2; | ||
}, | ||
min: function(formatter) { | ||
if (formatter == null) { | ||
formatter = usFmt; | ||
} | ||
return function(_arg) { | ||
var attr; | ||
attr = _arg[0]; | ||
return function(data, rowKey, colKey) { | ||
return { | ||
val: null, | ||
push: function(record) { | ||
var x, _ref; | ||
x = parseFloat(record[attr]); | ||
if (!isNaN(x)) { | ||
return this.val = Math.min(x, (_ref = this.val) != null ? _ref : x); | ||
} | ||
}, | ||
value: function() { | ||
return this.val; | ||
}, | ||
format: formatter, | ||
numInputs: attr != null ? 0 : 1 | ||
}; | ||
}; | ||
}; | ||
}, | ||
max: function(formatter) { | ||
if (formatter == null) { | ||
formatter = usFmt; | ||
} | ||
return function(_arg) { | ||
var attr; | ||
attr = _arg[0]; | ||
return function(data, rowKey, colKey) { | ||
return { | ||
val: null, | ||
push: function(record) { | ||
var x, _ref; | ||
x = parseFloat(record[attr]); | ||
if (!isNaN(x)) { | ||
return this.val = Math.max(x, (_ref = this.val) != null ? _ref : x); | ||
} | ||
}, | ||
value: function() { | ||
return this.val; | ||
}, | ||
format: formatter, | ||
numInputs: attr != null ? 0 : 1 | ||
}; | ||
}; | ||
}; | ||
}, | ||
average: function(formatter) { | ||
@@ -290,2 +342,4 @@ if (formatter == null) { | ||
"Average": tpl.average(usFmt), | ||
"Minimum": tpl.min(usFmt), | ||
"Maximum": tpl.max(usFmt), | ||
"Sum over Sum": tpl.sumOverSum(usFmt), | ||
@@ -348,3 +402,7 @@ "80% Upper Bound": tpl.sumOverSumBound80(true, usFmt), | ||
}, | ||
dateFormat: function(col, formatString, mthNames, dayNames) { | ||
dateFormat: function(col, formatString, utcOutput, mthNames, dayNames) { | ||
var utc; | ||
if (utcOutput == null) { | ||
utcOutput = false; | ||
} | ||
if (mthNames == null) { | ||
@@ -356,2 +414,3 @@ mthNames = mthNamesEn; | ||
} | ||
utc = utcOutput ? "UTC" : ""; | ||
return function(record) { | ||
@@ -366,19 +425,19 @@ var date; | ||
case "y": | ||
return date.getFullYear(); | ||
return date["get" + utc + "FullYear"](); | ||
case "m": | ||
return zeroPad(date.getMonth() + 1); | ||
return zeroPad(date["get" + utc + "Month"]() + 1); | ||
case "n": | ||
return mthNames[date.getMonth()]; | ||
return mthNames[date["get" + utc + "Month"]()]; | ||
case "d": | ||
return zeroPad(date.getDate()); | ||
return zeroPad(date["get" + utc + "Date"]()); | ||
case "w": | ||
return dayNames[date.getDay()]; | ||
return dayNames[date["get" + utc + "Day"]()]; | ||
case "x": | ||
return date.getDay(); | ||
return date["get" + utc + "Day"](); | ||
case "H": | ||
return zeroPad(date.getHours()); | ||
return zeroPad(date["get" + utc + "Hours"]()); | ||
case "M": | ||
return zeroPad(date.getMinutes()); | ||
return zeroPad(date["get" + utc + "Minutes"]()); | ||
case "S": | ||
return zeroPad(date.getSeconds()); | ||
return zeroPad(date["get" + utc + "Seconds"]()); | ||
default: | ||
@@ -430,2 +489,30 @@ return "%" + p; | ||
})(this); | ||
sortAs = function(order) { | ||
var i, mapping, x; | ||
mapping = {}; | ||
for (i in order) { | ||
x = order[i]; | ||
mapping[x] = i; | ||
} | ||
return function(a, b) { | ||
if ((mapping[a] != null) && (mapping[b] != null)) { | ||
return mapping[a] - mapping[b]; | ||
} else if (mapping[a] != null) { | ||
return -1; | ||
} else if (mapping[b] != null) { | ||
return 1; | ||
} else { | ||
return naturalSort(a, b); | ||
} | ||
}; | ||
}; | ||
getSort = function(sorters, attr) { | ||
var sort; | ||
sort = sorters(attr); | ||
if ($.isFunction(sort)) { | ||
return sort; | ||
} else { | ||
return naturalSort; | ||
} | ||
}; | ||
$.pivotUtilities = { | ||
@@ -438,3 +525,4 @@ aggregatorTemplates: aggregatorTemplates, | ||
naturalSort: naturalSort, | ||
numberFormat: numberFormat | ||
numberFormat: numberFormat, | ||
sortAs: sortAs | ||
}; | ||
@@ -452,3 +540,2 @@ | ||
this.arrSort = __bind(this.arrSort, this); | ||
this.natSort = __bind(this.natSort, this); | ||
this.aggregator = opts.aggregator; | ||
@@ -459,2 +546,3 @@ this.aggregatorName = opts.aggregatorName; | ||
this.valAttrs = opts.vals; | ||
this.sorters = opts.sorters; | ||
this.tree = {}; | ||
@@ -527,3 +615,3 @@ this.rowKeys = []; | ||
$("td", this).each(function(j) { | ||
return record[tblCols[j]] = $(this).text(); | ||
return record[tblCols[j]] = $(this).html(); | ||
}); | ||
@@ -546,16 +634,32 @@ return addRecord(record); | ||
PivotData.prototype.natSort = function(as, bs) { | ||
return naturalSort(as, bs); | ||
PivotData.prototype.arrSort = function(attrs) { | ||
var a, sortersArr; | ||
sortersArr = (function() { | ||
var _i, _len, _results; | ||
_results = []; | ||
for (_i = 0, _len = attrs.length; _i < _len; _i++) { | ||
a = attrs[_i]; | ||
_results.push(getSort(this.sorters, a)); | ||
} | ||
return _results; | ||
}).call(this); | ||
return function(a, b) { | ||
var comparison, i, sorter; | ||
for (i in sortersArr) { | ||
sorter = sortersArr[i]; | ||
comparison = sorter(a[i], b[i]); | ||
if (comparison !== 0) { | ||
return comparison; | ||
} | ||
} | ||
return 0; | ||
}; | ||
}; | ||
PivotData.prototype.arrSort = function(a, b) { | ||
return this.natSort(a.join(), b.join()); | ||
}; | ||
PivotData.prototype.sortKeys = function() { | ||
if (!this.sorted) { | ||
this.rowKeys.sort(this.arrSort); | ||
this.colKeys.sort(this.arrSort); | ||
this.sorted = true; | ||
this.rowKeys.sort(this.arrSort(this.rowAttrs)); | ||
return this.colKeys.sort(this.arrSort(this.colAttrs)); | ||
} | ||
return this.sorted = true; | ||
}; | ||
@@ -699,3 +803,3 @@ | ||
th.className = "pvtAxisLabel"; | ||
th.textContent = c; | ||
th.innerHTML = c; | ||
tr.appendChild(th); | ||
@@ -709,3 +813,3 @@ for (i in colKeys) { | ||
th.className = "pvtColLabel"; | ||
th.textContent = colKey[j]; | ||
th.innerHTML = colKey[j]; | ||
th.setAttribute("colspan", x); | ||
@@ -734,3 +838,3 @@ if (parseInt(j) === colAttrs.length - 1 && rowAttrs.length !== 0) { | ||
th.className = "pvtAxisLabel"; | ||
th.textContent = r; | ||
th.innerHTML = r; | ||
tr.appendChild(th); | ||
@@ -757,3 +861,3 @@ } | ||
th.className = "pvtRowLabel"; | ||
th.textContent = txt; | ||
th.innerHTML = txt; | ||
th.setAttribute("rowspan", x); | ||
@@ -826,2 +930,3 @@ if (parseInt(j) === rowAttrs.length - 1 && colAttrs.length !== 0) { | ||
rows: [], | ||
vals: [], | ||
filter: function() { | ||
@@ -832,2 +937,3 @@ return true; | ||
aggregatorName: "Count", | ||
sorters: function() {}, | ||
derivedAttributes: {}, | ||
@@ -895,2 +1001,3 @@ renderer: pivotTableRenderer, | ||
}, | ||
sorters: function() {}, | ||
localeStrings: locales[locale].localeStrings | ||
@@ -947,5 +1054,5 @@ }; | ||
}); | ||
uiTable = $("<table cellpadding='5'>"); | ||
uiTable = $("<table>").attr("cellpadding", 5); | ||
rendererControl = $("<td>"); | ||
renderer = $("<select class='pvtRenderer'>").appendTo(rendererControl).bind("change", function() { | ||
renderer = $("<select>").addClass('pvtRenderer').appendTo(rendererControl).bind("change", function() { | ||
return refresh(); | ||
@@ -958,3 +1065,3 @@ }); | ||
} | ||
colList = $("<td class='pvtAxisContainer pvtUnused'>"); | ||
colList = $("<td>").addClass('pvtAxisContainer pvtUnused'); | ||
shownAttributes = (function() { | ||
@@ -978,3 +1085,3 @@ var _j, _len1, _results; | ||
} | ||
unusedAttrsVerticalAutoOverride = attrLength > 120; | ||
unusedAttrsVerticalAutoOverride = attrLength > 85; | ||
} | ||
@@ -1003,18 +1110,27 @@ if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) { | ||
btns = $("<p>").appendTo(valueList); | ||
btns.append($("<button>").html(opts.localeStrings.selectAll).bind("click", function() { | ||
btns.append($("<button>", { | ||
type: "button" | ||
}).html(opts.localeStrings.selectAll).bind("click", function() { | ||
return valueList.find("input:visible").prop("checked", true); | ||
})); | ||
btns.append($("<button>").html(opts.localeStrings.selectNone).bind("click", function() { | ||
btns.append($("<button>", { | ||
type: "button" | ||
}).html(opts.localeStrings.selectNone).bind("click", function() { | ||
return valueList.find("input:visible").prop("checked", false); | ||
})); | ||
btns.append($("<input>").addClass("pvtSearch").attr("placeholder", opts.localeStrings.filterResults).bind("keyup", function() { | ||
btns.append($("<br>")); | ||
btns.append($("<input>", { | ||
type: "text", | ||
placeholder: opts.localeStrings.filterResults, | ||
"class": "pvtSearch" | ||
}).bind("keyup", function() { | ||
var filter; | ||
filter = $(this).val().toLowerCase(); | ||
return $(this).parents(".pvtFilterBox").find('label span').each(function() { | ||
return valueList.find('.pvtCheckContainer p').each(function() { | ||
var testString; | ||
testString = $(this).text().toLowerCase().indexOf(filter); | ||
if (testString !== -1) { | ||
return $(this).parent().show(); | ||
return $(this).show(); | ||
} else { | ||
return $(this).parent().hide(); | ||
return $(this).hide(); | ||
} | ||
@@ -1024,3 +1140,3 @@ }); | ||
checkContainer = $("<div>").addClass("pvtCheckContainer").appendTo(valueList); | ||
_ref2 = keys.sort(naturalSort); | ||
_ref2 = keys.sort(getSort(opts.sorters, c)); | ||
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | ||
@@ -1032,4 +1148,5 @@ k = _ref2[_k]; | ||
hasExcludedItem || (hasExcludedItem = filterItemExcluded); | ||
$("<input type='checkbox' class='pvtFilter'>").attr("checked", !filterItemExcluded).data("filter", [c, k]).appendTo(filterItem); | ||
filterItem.append($("<span>").text("" + k + " (" + v + ")")); | ||
$("<input>").attr("type", "checkbox").addClass('pvtFilter').attr("checked", !filterItemExcluded).data("filter", [c, k]).appendTo(filterItem); | ||
filterItem.append($("<span>").html(k)); | ||
filterItem.append($("<span>").text(" (" + v + ")")); | ||
checkContainer.append($("<p>").append(filterItem)); | ||
@@ -1040,3 +1157,3 @@ } | ||
var unselectedCount; | ||
unselectedCount = $(valueList).find("[type='checkbox']").length - $(valueList).find("[type='checkbox']:checked").length; | ||
unselectedCount = valueList.find("[type='checkbox']").length - valueList.find("[type='checkbox']:checked").length; | ||
if (unselectedCount > 0) { | ||
@@ -1053,3 +1170,5 @@ attrElem.addClass("pvtFilteredAttribute"); | ||
}; | ||
$("<p>").appendTo(valueList).append($("<button>").text("OK").bind("click", updateFilter)); | ||
$("<p>").appendTo(valueList).append($("<button>", { | ||
type: "button" | ||
}).text("OK").bind("click", updateFilter)); | ||
showFilterList = function(e) { | ||
@@ -1060,7 +1179,7 @@ valueList.css({ | ||
}).toggle(); | ||
$('.pvtSearch').val(''); | ||
return $('label').show(); | ||
valueList.find('.pvtSearch').val(''); | ||
return valueList.find('.pvtCheckContainer p').show(); | ||
}; | ||
triangleLink = $("<span class='pvtTriangle'>").html(" ▾").bind("click", showFilterList); | ||
attrElem = $("<li class='axis_" + i + "'>").append($("<span class='pvtAttr'>").text(c).data("attrName", c).append(triangleLink)); | ||
triangleLink = $("<span>").addClass('pvtTriangle').html(" ▾").bind("click", showFilterList); | ||
attrElem = $("<li>").addClass("axis_" + i).append($("<span>").addClass('pvtAttr').text(c).data("attrName", c).append(triangleLink)); | ||
if (hasExcludedItem) { | ||
@@ -1073,2 +1192,3 @@ attrElem.addClass('pvtFilteredAttribute'); | ||
for (i in shownAttributes) { | ||
if (!__hasProp.call(shownAttributes, i)) continue; | ||
c = shownAttributes[i]; | ||
@@ -1078,3 +1198,3 @@ _fn(c); | ||
tr1 = $("<tr>").appendTo(uiTable); | ||
aggregator = $("<select class='pvtAggregator'>").bind("change", function() { | ||
aggregator = $("<select>").addClass('pvtAggregator').bind("change", function() { | ||
return refresh(); | ||
@@ -1087,7 +1207,7 @@ }); | ||
} | ||
$("<td class='pvtVals'>").appendTo(tr1).append(aggregator).append($("<br>")); | ||
$("<td class='pvtAxisContainer pvtHorizList pvtCols'>").appendTo(tr1); | ||
$("<td>").addClass('pvtVals').appendTo(tr1).append(aggregator).append($("<br>")); | ||
$("<td>").addClass('pvtAxisContainer pvtHorizList pvtCols').appendTo(tr1); | ||
tr2 = $("<tr>").appendTo(uiTable); | ||
tr2.append($("<td valign='top' class='pvtAxisContainer pvtRows'>")); | ||
pivotTable = $("<td valign='top' class='pvtRendererArea'>").appendTo(tr2); | ||
tr2.append($("<td>").addClass('pvtAxisContainer pvtRows').attr("valign", "top")); | ||
pivotTable = $("<td>").attr("valign", "top").addClass('pvtRendererArea').appendTo(tr2); | ||
if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) { | ||
@@ -1103,3 +1223,3 @@ uiTable.find('tr:nth-child(1)').prepend(rendererControl); | ||
x = _ref3[_k]; | ||
this.find(".pvtCols").append(this.find(".axis_" + (shownAttributes.indexOf(x)))); | ||
this.find(".pvtCols").append(this.find(".axis_" + ($.inArray(x, shownAttributes)))); | ||
} | ||
@@ -1109,3 +1229,3 @@ _ref4 = opts.rows; | ||
x = _ref4[_l]; | ||
this.find(".pvtRows").append(this.find(".axis_" + (shownAttributes.indexOf(x)))); | ||
this.find(".pvtRows").append(this.find(".axis_" + ($.inArray(x, shownAttributes)))); | ||
} | ||
@@ -1121,3 +1241,3 @@ if (opts.aggregatorName != null) { | ||
return function() { | ||
var attr, exclusions, natSort, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, subopts, unusedAttrsContainer, vals, _len4, _m, _n, _ref5; | ||
var attr, exclusions, inclusions, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, subopts, unusedAttrsContainer, vals, _len4, _m, _n, _ref5; | ||
subopts = { | ||
@@ -1127,2 +1247,3 @@ derivedAttributes: opts.derivedAttributes, | ||
rendererOptions: opts.rendererOptions, | ||
sorters: opts.sorters, | ||
cols: [], | ||
@@ -1152,3 +1273,3 @@ rows: [] | ||
for (x = _m = 0; 0 <= numInputsToProcess ? _m < numInputsToProcess : _m > numInputsToProcess; x = 0 <= numInputsToProcess ? ++_m : --_m) { | ||
newDropdown = $("<select class='pvtAttrDropdown'>").append($("<option>")).bind("change", function() { | ||
newDropdown = $("<select>").addClass('pvtAttrDropdown').append($("<option>")).bind("change", function() { | ||
return refresh(); | ||
@@ -1186,2 +1307,14 @@ }); | ||
}); | ||
inclusions = {}; | ||
_this.find('input.pvtFilter:checked').each(function() { | ||
var filter; | ||
filter = $(this).data("filter"); | ||
if (exclusions[filter[0]] != null) { | ||
if (inclusions[filter[0]] != null) { | ||
return inclusions[filter[0]].push(filter[1]); | ||
} else { | ||
return inclusions[filter[0]] = [filter[1]]; | ||
} | ||
} | ||
}); | ||
subopts.filter = function(record) { | ||
@@ -1206,2 +1339,3 @@ var excludedItems, _ref6; | ||
exclusions: exclusions, | ||
inclusionsInfo: inclusions, | ||
aggregatorName: aggregator.val(), | ||
@@ -1212,6 +1346,5 @@ rendererName: renderer.val() | ||
if (opts.autoSortUnusedAttrs) { | ||
natSort = $.pivotUtilities.naturalSort; | ||
unusedAttrsContainer = _this.find("td.pvtUnused.pvtAxisContainer"); | ||
$(unusedAttrsContainer).children("li").sort(function(a, b) { | ||
return natSort($(a).text(), $(b).text()); | ||
return naturalSort($(a).text(), $(b).text()); | ||
}).appendTo(unusedAttrsContainer); | ||
@@ -1218,0 +1351,0 @@ } |
@@ -1,2 +0,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)}},o={}.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 a,i,s,u,l,c,p,h,d,f,g,m,v,b,A,y;return i=function(t,e,n){var r,o,a,i;for(t+="",o=t.split("."),a=o[0],i=o.length>1?n+o[1]:"",r=/(\d+)(\d{3})/;r.test(a);)a=a.replace(r,"$1"+e+"$2");return a+i},f=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:"",showZero:!1},e=t.extend(n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":0!==t||e.showZero?(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix):""}},v=f(),b=f({digitsAfterDecimal:0}),A=f({digitsAfterDecimal:1,scaler:100,suffix:"%"}),s={count:function(t){return null==t&&(t=b),function(){return function(){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},countUnique:function(t){return null==t&&(t=b),function(n){var r;return r=n[0],function(){return{uniq:[],push:function(t){var n;return n=t[r],e.call(this.uniq,n)<0?this.uniq.push(t[r]):void 0},value:function(){return this.uniq.length},format:t,numInputs:null!=r?0:1}}}},listUnique:function(t){return function(n){var r;return r=n[0],function(){return{uniq:[],push:function(t){var n;return n=t[r],e.call(this.uniq,n)<0?this.uniq.push(t[r]):void 0},value:function(){return this.uniq.join(t)},format:function(t){return t},numInputs:null!=r?0:1}}}},sum:function(t){return null==t&&(t=v),function(e){var n;return n=e[0],function(){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}}}},average:function(t){return null==t&&(t=v),function(e){var n;return n=e[0],function(){return{sum:0,len:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:(this.sum+=parseFloat(t[n]),this.len++)},value:function(){return this.sum/this.len},format:t,numInputs:null!=n?0:1}}}},sumOverSum:function(t){return null==t&&(t=v),function(e){var n,r;return r=e[0],n=e[1],function(){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=v),function(n){var r,o;return o=n[0],r=n[1],function(){return{sumNum:0,sumDenom:0,push:function(t){return isNaN(parseFloat(t[o]))||(this.sumNum+=parseFloat(t[o])),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!=o&&null!=r?0:2}}}},fractionOf:function(t,e,r){return null==e&&(e="total"),null==r&&(r=A),function(){var o;return o=1<=arguments.length?n.call(arguments,0):[],function(n,a,i){return{selector:{total:[[],[]],row:[a,[]],col:[[],i]}[e],inner:t.apply(null,o)(n,a,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,o)().numInputs}}}}},u=function(t){return{Count:t.count(b),"Count Unique Values":t.countUnique(b),"List Unique Values":t.listUnique(", "),Sum:t.sum(v),"Integer Sum":t.sum(b),Average:t.average(v),"Sum over Sum":t.sumOverSum(v),"80% Upper Bound":t.sumOverSumBound80(!0,v),"80% Lower Bound":t.sumOverSumBound80(!1,v),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",A),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",A),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",A),"Count as Fraction of Total":t.fractionOf(t.count(),"total",A),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",A),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",A)}}(s),m={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()},"Row Heatmap":function(e,n){return t(g(e,n)).heatmap("rowheatmap")},"Col Heatmap":function(e,n){return t(g(e,n)).heatmap("colheatmap")}},p={en:{aggregators:u,renderers:m,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 results",totals:"Totals",vs:"vs",by:"by"}}},h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y=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){return null==n&&(n=h),null==r&&(r=l),function(o){var a;return a=new Date(Date.parse(o[t])),isNaN(a)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return a.getFullYear();case"m":return y(a.getMonth()+1);case"n":return n[a.getMonth()];case"d":return y(a.getDate());case"w":return r[a.getDay()];case"x":return a.getDay();case"H":return y(a.getHours());case"M":return y(a.getMinutes());case"S":return y(a.getSeconds());default:return"%"+e}})}}},d=function(){return function(t,e){var n,r,o,a,i,s,u;if(s=/(\d+)|(\D+)/g,i=/\d/,u=/^0/,"number"==typeof t||"number"==typeof e)return isNaN(t)?1:isNaN(e)?-1:t-e;if(n=String(t).toLowerCase(),o=String(e).toLowerCase(),n===o)return 0;if(!i.test(n)||!i.test(o))return n>o?1:-1;for(n=n.match(s),o=o.match(s);n.length&&o.length;)if(r=n.shift(),a=o.shift(),r!==a)return i.test(r)&&i.test(a)?r.replace(u,".0")-a.replace(u,".0"):r>a?1:-1;return n.length-o.length}}(this),t.pivotUtilities={aggregatorTemplates:s,aggregators:u,renderers:m,derivers:c,locales:p,naturalSort:d,numberFormat:f},a=function(){function e(t,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.natSort=r(this.natSort,this),this.aggregator=n.aggregator,this.aggregatorName=n.aggregatorName,this.colAttrs=n.cols,this.rowAttrs=n.rows,this.valAttrs=n.vals,this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(t,n.derivedAttributes,function(t){return function(e){return n.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var a,i,s,u,l,c,p,h,d,f,g,m;if(a=t.isEmptyObject(n)?r:function(t){var e,o,a;for(e in n)o=n[e],t[e]=null!=(a=o(t))?a:t[e];return r(t)},t.isFunction(e))return e(a);if(t.isArray(e)){if(t.isArray(e[0])){g=[];for(s in e)if(o.call(e,s)&&(i=e[s],s>0)){c={},f=e[0];for(u in f)o.call(f,u)&&(l=f[u],c[l]=i[u]);g.push(a(c))}return g}for(m=[],h=0,d=e.length;d>h;h++)c=e[h],m.push(a(c));return m}if(e instanceof jQuery)return p=[],t("thead > tr > th",e).each(function(){return p.push(t(this).text())}),t("tbody > tr",e).each(function(){return c={},t("td",this).each(function(e){return c[p[e]]=t(this).text()}),a(c)});throw new Error("unknown input format")},e.convertToArray=function(t){var n;return n=[],e.forEachRecord(t,{},function(t){return n.push(t)}),n},e.prototype.natSort=function(t,e){return d(t,e)},e.prototype.arrSort=function(t,e){return this.natSort(t.join(),e.join())},e.prototype.sortKeys=function(){return this.sorted||(this.rowKeys.sort(this.arrSort),this.colKeys.sort(this.arrSort)),this.sorted=!0},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,o,a,i,s,u,l,c,p,h,d;for(e=[],o=[],c=this.colAttrs,i=0,u=c.length;u>i;i++)a=c[i],e.push(null!=(p=t[a])?p:"null");for(h=this.rowAttrs,s=0,l=h.length;l>s;s++)a=h[s],o.push(null!=(d=t[a])?d:"null");return r=o.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==o.length&&(this.rowTotals[r]||(this.rowKeys.push(o),this.rowTotals[r]=this.aggregator(this,o,[])),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!==o.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,o,e)),this.tree[r][n].push(t)):void 0},e.prototype.getAggregator=function(t,e){var n,r,o;return o=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[o]:this.tree[o][r],null!=n?n:{value:function(){return null},format:function(){return""}}},e}(),g=function(e,n){var r,a,i,s,u,l,c,p,h,d,f,g,m,v,b,A,y,w,C,S,T;l={localeStrings:{totals:"Totals"}},n=t.extend(l,n),i=e.colAttrs,f=e.rowAttrs,m=e.getRowKeys(),u=e.getColKeys(),d=document.createElement("table"),d.className="pvtTable",v=function(t,e,n){var r,o,a,i,s,u;if(0!==e){for(o=!0,i=s=0;n>=0?n>=s:s>=n;i=n>=0?++s:--s)t[e-1][i]!==t[e][i]&&(o=!1);if(o)return-1}for(r=0;e+r<t.length;){for(a=!1,i=u=0;n>=0?n>=u:u>=n;i=n>=0?++u:--u)t[e][i]!==t[e+r][i]&&(a=!0);if(a)break;r++}return r};for(p in i)if(o.call(i,p)){a=i[p],w=document.createElement("tr"),0===parseInt(p)&&0!==f.length&&(A=document.createElement("th"),A.setAttribute("colspan",f.length),A.setAttribute("rowspan",i.length),w.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.textContent=a,w.appendChild(A);for(c in u)o.call(u,c)&&(s=u[c],T=v(u,parseInt(c),parseInt(p)),-1!==T&&(A=document.createElement("th"),A.className="pvtColLabel",A.textContent=s[p],A.setAttribute("colspan",T),parseInt(p)===i.length-1&&0!==f.length&&A.setAttribute("rowspan",2),w.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",i.length+(0===f.length?0:1)),w.appendChild(A)),d.appendChild(w)}if(0!==f.length){w=document.createElement("tr");for(c in f)o.call(f,c)&&(h=f[c],A=document.createElement("th"),A.className="pvtAxisLabel",A.textContent=h,w.appendChild(A));A=document.createElement("th"),0===i.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),w.appendChild(A),d.appendChild(w)}for(c in m)if(o.call(m,c)){g=m[c],w=document.createElement("tr");for(p in g)o.call(g,p)&&(C=g[p],T=v(m,parseInt(c),parseInt(p)),-1!==T&&(A=document.createElement("th"),A.className="pvtRowLabel",A.textContent=C,A.setAttribute("rowspan",T),parseInt(p)===f.length-1&&0!==i.length&&A.setAttribute("colspan",2),w.appendChild(A)));for(p in u)o.call(u,p)&&(s=u[p],r=e.getAggregator(g,s),S=r.value(),b=document.createElement("td"),b.className="pvtVal row"+c+" col"+p,b.innerHTML=r.format(S),b.setAttribute("data-value",S),w.appendChild(b));y=e.getAggregator(g,[]),S=y.value(),b=document.createElement("td"),b.className="pvtTotal rowTotal",b.innerHTML=y.format(S),b.setAttribute("data-value",S),b.setAttribute("data-for","row"+c),w.appendChild(b),d.appendChild(w)}w=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",f.length+(0===i.length?0:1)),w.appendChild(A);for(p in u)o.call(u,p)&&(s=u[p],y=e.getAggregator([],s),S=y.value(),b=document.createElement("td"),b.className="pvtTotal colTotal",b.innerHTML=y.format(S),b.setAttribute("data-value",S),b.setAttribute("data-for","col"+p),w.appendChild(b));return y=e.getAggregator([],[]),S=y.value(),b=document.createElement("td"),b.className="pvtGrandTotal",b.innerHTML=y.format(S),b.setAttribute("data-value",S),w.appendChild(b),d.appendChild(w),d.setAttribute("data-numrows",m.length),d.setAttribute("data-numcols",u.length),d},t.fn.pivot=function(e,n){var r,o,i,u,l;r={cols:[],rows:[],filter:function(){return!0},aggregator:s.count()(),aggregatorName:"Count",derivedAttributes:{},renderer:g,rendererOptions:null,localeStrings:p.en.localeStrings},n=t.extend(r,n),u=null;try{i=new a(e,n);try{u=n.renderer(i,n.rendererOptions)}catch(c){o=c,"undefined"!=typeof console&&null!==console&&console.error(o.stack),u=t("<span>").html(n.localeStrings.renderError)}}catch(c){o=c,"undefined"!=typeof console&&null!==console&&console.error(o.stack),u=t("<span>").html(n.localeStrings.computeError)}for(l=this[0];l.hasChildNodes();)l.removeChild(l.lastChild);return this.append(u)},t.fn.pivotUI=function(n,r,i,s){var u,l,c,h,f,g,m,v,b,A,y,w,C,S,T,x,N,F,E,D,O,R,L,k,M,I,K,q,U,V,j,H,B,P,J,_,z,Q,W;null==i&&(i=!1),null==s&&(s="en"),m={derivedAttributes:{},aggregators:p[s].aggregators,renderers:p[s].renderers,hiddenAttributes:[],menuLimit:200,cols:[],rows:[],vals:[],exclusions:{},unusedAttrsVertical:"auto",autoSortUnusedAttrs:!1,rendererOptions:{localeStrings:p[s].localeStrings},onRefresh:null,filter:function(){return!0},localeStrings:p[s].localeStrings},b=this.data("pivotUIOptions"),C=null==b||i?t.extend(m,r):b;try{n=a.convertToArray(n),D=function(){var t,e;t=n[0],e=[];for(w in t)o.call(t,w)&&e.push(w);return e}(),J=C.derivedAttributes;for(f in J)o.call(J,f)&&e.call(D,f)<0&&D.push(f);for(h={},K=0,j=D.length;j>K;K++)M=D[K],h[M]={};a.forEachRecord(n,C.derivedAttributes,function(t){var e,n,r;r=[];for(w in t)o.call(t,w)&&(e=t[w],C.filter(t)&&(null==e&&(e="null"),null==(n=h[w])[e]&&(n[e]=0),r.push(h[w][e]++)));return r}),L=t("<table cellpadding='5'>"),F=t("<td>"),N=t("<select class='pvtRenderer'>").appendTo(F).bind("change",function(){return T()}),_=C.renderers;for(M in _)o.call(_,M)&&t("<option>").val(M).html(M).appendTo(N);if(g=t("<td class='pvtAxisContainer pvtUnused'>"),E=function(){var t,n,r;for(r=[],t=0,n=D.length;n>t;t++)f=D[t],e.call(C.hiddenAttributes,f)<0&&r.push(f);return r}(),k=!1,"auto"===C.unusedAttrsVertical){for(c=0,q=0,H=E.length;H>q;q++)u=E[q],c+=u.length;k=c>120}g.addClass(C.unusedAttrsVertical===!0||k?"pvtVertList":"pvtHorizList"),I=function(n){var r,o,a,i,s,u,l,c,p,f,m,v,b,y,S;if(l=function(){var t;t=[];for(w in h[n])t.push(w);return t}(),u=!1,v=t("<div>").addClass("pvtFilterBox").hide(),v.append(t("<h4>").text(""+n+" ("+l.length+")")),l.length>C.menuLimit)v.append(t("<p>").html(C.localeStrings.tooMany));else for(o=t("<p>").appendTo(v),o.append(t("<button>").html(C.localeStrings.selectAll).bind("click",function(){return v.find("input:visible").prop("checked",!0)})),o.append(t("<button>").html(C.localeStrings.selectNone).bind("click",function(){return v.find("input:visible").prop("checked",!1)})),o.append(t("<input>").addClass("pvtSearch").attr("placeholder",C.localeStrings.filterResults).bind("keyup",function(){var e;return e=t(this).val().toLowerCase(),t(this).parents(".pvtFilterBox").find("label span").each(function(){var n;return n=t(this).text().toLowerCase().indexOf(e),-1!==n?t(this).parent().show():t(this).parent().hide()})})),a=t("<div>").addClass("pvtCheckContainer").appendTo(v),S=l.sort(d),b=0,y=S.length;y>b;b++)w=S[b],m=h[n][w],i=t("<label>"),s=C.exclusions[n]?e.call(C.exclusions[n],w)>=0:!1,u||(u=s),t("<input type='checkbox' class='pvtFilter'>").attr("checked",!s).data("filter",[n,w]).appendTo(i),i.append(t("<span>").text(""+w+" ("+m+")")),a.append(t("<p>").append(i));return f=function(){var e;return e=t(v).find("[type='checkbox']").length-t(v).find("[type='checkbox']:checked").length,e>0?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),l.length>C.menuLimit?v.toggle():v.toggle(0,T)},t("<p>").appendTo(v).append(t("<button>").text("OK").bind("click",f)),c=function(e){return v.css({left:e.pageX,top:e.pageY}).toggle(),t(".pvtSearch").val(""),t("label").show()},p=t("<span class='pvtTriangle'>").html(" ▾").bind("click",c),r=t("<li class='axis_"+A+"'>").append(t("<span class='pvtAttr'>").text(n).data("attrName",n).append(p)),u&&r.addClass("pvtFilteredAttribute"),g.append(r).append(v),r.bind("dblclick",c)};for(A in E)f=E[A],I(f);O=t("<tr>").appendTo(L),l=t("<select class='pvtAggregator'>").bind("change",function(){return T()}),z=C.aggregators;for(M in z)o.call(z,M)&&l.append(t("<option>").val(M).html(M));for(t("<td class='pvtVals'>").appendTo(O).append(l).append(t("<br>")),t("<td class='pvtAxisContainer pvtHorizList pvtCols'>").appendTo(O),R=t("<tr>").appendTo(L),R.append(t("<td valign='top' class='pvtAxisContainer pvtRows'>")),S=t("<td valign='top' class='pvtRendererArea'>").appendTo(R),C.unusedAttrsVertical===!0||k?(L.find("tr:nth-child(1)").prepend(F),L.find("tr:nth-child(2)").prepend(g)):L.prepend(t("<tr>").append(F).append(g)),this.html(L),Q=C.cols,U=0,B=Q.length;B>U;U++)M=Q[U],this.find(".pvtCols").append(this.find(".axis_"+E.indexOf(M)));for(W=C.rows,V=0,P=W.length;P>V;V++)M=W[V],this.find(".pvtRows").append(this.find(".axis_"+E.indexOf(M)));null!=C.aggregatorName&&this.find(".pvtAggregator").val(C.aggregatorName),null!=C.rendererName&&this.find(".pvtRenderer").val(C.rendererName),y=!0,x=function(r){return function(){var o,a,i,s,u,c,p,h,d,f,g,m,v,b;if(h={derivedAttributes:C.derivedAttributes,localeStrings:C.localeStrings,rendererOptions:C.rendererOptions,cols:[],rows:[]},u=null!=(b=C.aggregators[l.val()]([])().numInputs)?b:0,f=[],r.find(".pvtRows li span.pvtAttr").each(function(){return h.rows.push(t(this).data("attrName"))}),r.find(".pvtCols li span.pvtAttr").each(function(){return h.cols.push(t(this).data("attrName"))}),r.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===u?t(this).remove():(u--,""!==t(this).val()?f.push(t(this).val()):void 0)}),0!==u)for(p=r.find(".pvtVals"),M=m=0;u>=0?u>m:m>u;M=u>=0?++m:--m){for(s=t("<select class='pvtAttrDropdown'>").append(t("<option>")).bind("change",function(){return T()}),v=0,g=E.length;g>v;v++)o=E[v],s.append(t("<option>").val(o).text(o));p.append(s)}return y&&(f=C.vals,A=0,r.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(f[A]),A++}),y=!1),h.aggregatorName=l.val(),h.vals=f,h.aggregator=C.aggregators[l.val()](f),h.renderer=C.renderers[N.val()],a={},r.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=a[e[0]]?a[e[0]].push(e[1]):a[e[0]]=[e[1]]}),h.filter=function(t){var n,r;if(!C.filter(t))return!1;for(w in a)if(n=a[w],r=""+t[w],e.call(n,r)>=0)return!1;return!0},S.pivot(n,h),c=t.extend(C,{cols:h.cols,rows:h.rows,vals:f,exclusions:a,aggregatorName:l.val(),rendererName:N.val()}),r.data("pivotUIOptions",c),C.autoSortUnusedAttrs&&(i=t.pivotUtilities.naturalSort,d=r.find("td.pvtUnused.pvtAxisContainer"),t(d).children("li").sort(function(e,n){return i(t(e).text(),t(n).text())}).appendTo(d)),S.css("opacity",1),null!=C.onRefresh?C.onRefresh(c):void 0}}(this),T=function(){return function(){return S.css("opacity",.5),setTimeout(x,10)}}(this),T(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?T():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Y){v=Y,"undefined"!=typeof console&&null!==console&&console.error(v.stack),this.html(C.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e){var n,r,o,a,i,s,u,l;switch(null==e&&(e="heatmap"),s=this.data("numrows"),i=this.data("numcols"),n=function(t,e,n){var r;return r=function(){switch(t){case"red":return function(t){return"ff"+t+t};case"green":return function(t){return""+t+"ff"+t};case"blue":return function(t){return""+t+t+"ff"}}}(),function(t){var o,a;return a=255-Math.round(255*(t-e)/(n-e)),o=a.toString(16).split(".")[0],1===o.length&&(o=0+o),r(o)}},r=function(e){return function(r,o){var a,i,s;return i=function(n){return e.find(r).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?n(e,t(this)):void 0})},s=[],i(function(t){return s.push(t)}),a=n(o,Math.min.apply(Math,s),Math.max.apply(Math,s)),i(function(t,e){return e.css("background-color","#"+a(t))})}}(this),e){case"heatmap":r(".pvtVal","red");break;case"rowheatmap":for(o=u=0;s>=0?s>u:u>s;o=s>=0?++u:--u)r(".pvtVal.row"+o,"red");break;case"colheatmap":for(a=l=0;i>=0?i>l:l>i;a=i>=0?++l:--l)r(".pvtVal.col"+a,"red")}return r(".pvtTotal.rowTotal","red"),r(".pvtTotal.colTotal","red"),this},t.fn.barchart=function(){var e,n,r,o,a;for(o=this.data("numrows"),r=this.data("numcols"),e=function(e){return function(n){var r,o,a,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)}),o=Math.max.apply(Math,i),a=function(t){return 100*t/(1.4*o)},r(function(e,n){var r,o;return r=n.text(),o=t("<div>").css({position:"relative",height:"55px"}),o.append(t("<div>").css({position:"absolute",bottom:0,left:0,right:0,height:a(e)+"%","background-color":"gray"})),o.append(t("<div>").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"})),n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(o)})}}(this),n=a=0;o>=0?o>a:a>o;n=o>=0?++a:--a)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); | ||
(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,u,l,c,p,h,d,f,g,m,v,b,A,C,y,w;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},g=function(e){var n;return n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:"",showZero:!1},e=t.extend(n,e),function(t){var n;return isNaN(t)||!isFinite(t)?"":0!==t||e.showZero?(n=i((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep),""+e.prefix+n+e.suffix):""}},A=g(),C=g({digitsAfterDecimal:0}),y=g({digitsAfterDecimal:1,scaler:100,suffix:"%"}),s={count:function(t){return null==t&&(t=C),function(){return function(){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},countUnique:function(t){return null==t&&(t=C),function(n){var r;return r=n[0],function(){return{uniq:[],push:function(t){var n;return n=t[r],e.call(this.uniq,n)<0?this.uniq.push(t[r]):void 0},value:function(){return this.uniq.length},format:t,numInputs:null!=r?0:1}}}},listUnique:function(t){return function(n){var r;return r=n[0],function(){return{uniq:[],push:function(t){var n;return n=t[r],e.call(this.uniq,n)<0?this.uniq.push(t[r]):void 0},value:function(){return this.uniq.join(t)},format:function(t){return t},numInputs:null!=r?0:1}}}},sum:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(){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}}}},min:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(){return{val:null,push:function(t){var e,r;return e=parseFloat(t[n]),isNaN(e)?void 0:this.val=Math.min(e,null!=(r=this.val)?r:e)},value:function(){return this.val},format:t,numInputs:null!=n?0:1}}}},max:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(){return{val:null,push:function(t){var e,r;return e=parseFloat(t[n]),isNaN(e)?void 0:this.val=Math.max(e,null!=(r=this.val)?r:e)},value:function(){return this.val},format:t,numInputs:null!=n?0:1}}}},average:function(t){return null==t&&(t=A),function(e){var n;return n=e[0],function(){return{sum:0,len:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:(this.sum+=parseFloat(t[n]),this.len++)},value:function(){return this.sum/this.len},format:t,numInputs:null!=n?0:1}}}},sumOverSum:function(t){return null==t&&(t=A),function(e){var n,r;return r=e[0],n=e[1],function(){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(){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=y),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}}}}},u=function(t){return{Count:t.count(C),"Count Unique Values":t.countUnique(C),"List Unique Values":t.listUnique(", "),Sum:t.sum(A),"Integer Sum":t.sum(C),Average:t.average(A),Minimum:t.min(A),Maximum:t.max(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",y),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",y),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",y),"Count as Fraction of Total":t.fractionOf(t.count(),"total",y),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",y),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",y)}}(s),v={Table:function(t,e){return m(t,e)},"Table Barchart":function(e,n){return t(m(e,n)).barchart()},Heatmap:function(e,n){return t(m(e,n)).heatmap()},"Row Heatmap":function(e,n){return t(m(e,n)).heatmap("rowheatmap")},"Col Heatmap":function(e,n){return t(m(e,n)).heatmap("colheatmap")}},h={en:{aggregators:u,renderers:v,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 results",totals:"Totals",vs:"vs",by:"by"}}},d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],w=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=d),null==a&&(a=l),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 w(i["get"+o+"Month"]()+1);case"n":return r[i["get"+o+"Month"]()];case"d":return w(i["get"+o+"Date"]());case"w":return a[i["get"+o+"Day"]()];case"x":return i["get"+o+"Day"]();case"H":return w(i["get"+o+"Hours"]());case"M":return w(i["get"+o+"Minutes"]());case"S":return w(i["get"+o+"Seconds"]());default:return"%"+e}})}}},f=function(){return function(t,e){var n,r,a,o,i,s,u;if(s=/(\d+)|(\D+)/g,i=/\d/,u=/^0/,"number"==typeof t||"number"==typeof e)return isNaN(t)?1:isNaN(e)?-1:t-e;if(n=String(t).toLowerCase(),a=String(e).toLowerCase(),n===a)return 0;if(!i.test(n)||!i.test(a))return n>a?1:-1;for(n=n.match(s),a=a.match(s);n.length&&a.length;)if(r=n.shift(),o=a.shift(),r!==o)return i.test(r)&&i.test(o)?r.replace(u,".0")-o.replace(u,".0"):r>o?1:-1;return n.length-a.length}}(this),b=function(t){var e,n,r;n={};for(e in t)r=t[e],n[r]=e;return function(t,e){return null!=n[t]&&null!=n[e]?n[t]-n[e]:null!=n[t]?-1:null!=n[e]?1:f(t,e)}},p=function(e,n){var r;return r=e(n),t.isFunction(r)?r:f},t.pivotUtilities={aggregatorTemplates:s,aggregators:u,renderers:v,derivers:c,locales:h,naturalSort:f,numberFormat:g,sortAs:b},o=function(){function e(t,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.aggregator=n.aggregator,this.aggregatorName=n.aggregatorName,this.colAttrs=n.cols,this.rowAttrs=n.rows,this.valAttrs=n.vals,this.sorters=n.sorters,this.tree={},this.rowKeys=[],this.colKeys=[],this.rowTotals={},this.colTotals={},this.allTotal=this.aggregator(this,[],[]),this.sorted=!1,e.forEachRecord(t,n.derivedAttributes,function(t){return function(e){return n.filter(e)?t.processRecord(e):void 0}}(this))}return e.forEachRecord=function(e,n,r){var o,i,s,u,l,c,p,h,d,f,g,m;if(o=t.isEmptyObject(n)?r:function(t){var e,a,o;for(e in n)a=n[e],t[e]=null!=(o=a(t))?o:t[e];return r(t)},t.isFunction(e))return e(o);if(t.isArray(e)){if(t.isArray(e[0])){g=[];for(s in e)if(a.call(e,s)&&(i=e[s],s>0)){c={},f=e[0];for(u in f)a.call(f,u)&&(l=f[u],c[l]=i[u]);g.push(o(c))}return g}for(m=[],h=0,d=e.length;d>h;h++)c=e[h],m.push(o(c));return m}if(e instanceof jQuery)return p=[],t("thead > tr > th",e).each(function(){return p.push(t(this).text())}),t("tbody > tr",e).each(function(){return c={},t("td",this).each(function(e){return c[p[e]]=t(this).html()}),o(c)});throw new Error("unknown input format")},e.convertToArray=function(t){var n;return n=[],e.forEachRecord(t,{},function(t){return n.push(t)}),n},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(p(this.sorters,e));return a}.call(this),function(t,e){var r,a,o;for(a in n)if(o=n[a],r=o(t[a],e[a]),0!==r)return r;return 0}},e.prototype.sortKeys=function(){return this.sorted?void 0:(this.sorted=!0,this.rowKeys.sort(this.arrSort(this.rowAttrs)),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,u,l,c,p,h,d;for(e=[],a=[],c=this.colAttrs,i=0,u=c.length;u>i;i++)o=c[i],e.push(null!=(p=t[o])?p:"null");for(h=this.rowAttrs,s=0,l=h.length;l>s;s++)o=h[s],a.push(null!=(d=t[o])?d:"null");return r=a.join(String.fromCharCode(0)),n=e.join(String.fromCharCode(0)),this.allTotal.push(t),0!==a.length&&(this.rowTotals[r]||(this.rowKeys.push(a),this.rowTotals[r]=this.aggregator(this,a,[])),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!==a.length?(this.tree[r]||(this.tree[r]={}),this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,a,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}(),m=function(e,n){var r,o,i,s,u,l,c,p,h,d,f,g,m,v,b,A,C,y,w,T,N;l={localeStrings:{totals:"Totals"}},n=t.extend(l,n),i=e.colAttrs,f=e.rowAttrs,m=e.getRowKeys(),u=e.getColKeys(),d=document.createElement("table"),d.className="pvtTable",v=function(t,e,n){var r,a,o,i,s,u;if(0!==e){for(a=!0,i=s=0;n>=0?n>=s:s>=n;i=n>=0?++s:--s)t[e-1][i]!==t[e][i]&&(a=!1);if(a)return-1}for(r=0;e+r<t.length;){for(o=!1,i=u=0;n>=0?n>=u:u>=n;i=n>=0?++u:--u)t[e][i]!==t[e+r][i]&&(o=!0);if(o)break;r++}return r};for(p in i)if(a.call(i,p)){o=i[p],y=document.createElement("tr"),0===parseInt(p)&&0!==f.length&&(A=document.createElement("th"),A.setAttribute("colspan",f.length),A.setAttribute("rowspan",i.length),y.appendChild(A)),A=document.createElement("th"),A.className="pvtAxisLabel",A.innerHTML=o,y.appendChild(A);for(c in u)a.call(u,c)&&(s=u[c],N=v(u,parseInt(c),parseInt(p)),-1!==N&&(A=document.createElement("th"),A.className="pvtColLabel",A.innerHTML=s[p],A.setAttribute("colspan",N),parseInt(p)===i.length-1&&0!==f.length&&A.setAttribute("rowspan",2),y.appendChild(A)));0===parseInt(p)&&(A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("rowspan",i.length+(0===f.length?0:1)),y.appendChild(A)),d.appendChild(y)}if(0!==f.length){y=document.createElement("tr");for(c in f)a.call(f,c)&&(h=f[c],A=document.createElement("th"),A.className="pvtAxisLabel",A.innerHTML=h,y.appendChild(A));A=document.createElement("th"),0===i.length&&(A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals),y.appendChild(A),d.appendChild(y)}for(c in m)if(a.call(m,c)){g=m[c],y=document.createElement("tr");for(p in g)a.call(g,p)&&(w=g[p],N=v(m,parseInt(c),parseInt(p)),-1!==N&&(A=document.createElement("th"),A.className="pvtRowLabel",A.innerHTML=w,A.setAttribute("rowspan",N),parseInt(p)===f.length-1&&0!==i.length&&A.setAttribute("colspan",2),y.appendChild(A)));for(p in u)a.call(u,p)&&(s=u[p],r=e.getAggregator(g,s),T=r.value(),b=document.createElement("td"),b.className="pvtVal row"+c+" col"+p,b.innerHTML=r.format(T),b.setAttribute("data-value",T),y.appendChild(b));C=e.getAggregator(g,[]),T=C.value(),b=document.createElement("td"),b.className="pvtTotal rowTotal",b.innerHTML=C.format(T),b.setAttribute("data-value",T),b.setAttribute("data-for","row"+c),y.appendChild(b),d.appendChild(y)}y=document.createElement("tr"),A=document.createElement("th"),A.className="pvtTotalLabel",A.innerHTML=n.localeStrings.totals,A.setAttribute("colspan",f.length+(0===i.length?0:1)),y.appendChild(A);for(p in u)a.call(u,p)&&(s=u[p],C=e.getAggregator([],s),T=C.value(),b=document.createElement("td"),b.className="pvtTotal colTotal",b.innerHTML=C.format(T),b.setAttribute("data-value",T),b.setAttribute("data-for","col"+p),y.appendChild(b));return C=e.getAggregator([],[]),T=C.value(),b=document.createElement("td"),b.className="pvtGrandTotal",b.innerHTML=C.format(T),b.setAttribute("data-value",T),y.appendChild(b),d.appendChild(y),d.setAttribute("data-numrows",m.length),d.setAttribute("data-numcols",u.length),d},t.fn.pivot=function(e,n){var r,a,i,u,l;r={cols:[],rows:[],vals:[],filter:function(){return!0},aggregator:s.count()(),aggregatorName:"Count",sorters:function(){},derivedAttributes:{},renderer:m,rendererOptions:null,localeStrings:h.en.localeStrings},n=t.extend(r,n),u=null;try{i=new o(e,n);try{u=n.renderer(i,n.rendererOptions)}catch(c){a=c,"undefined"!=typeof console&&null!==console&&console.error(a.stack),u=t("<span>").html(n.localeStrings.renderError)}}catch(c){a=c,"undefined"!=typeof console&&null!==console&&console.error(a.stack),u=t("<span>").html(n.localeStrings.computeError)}for(l=this[0];l.hasChildNodes();)l.removeChild(l.lastChild);return this.append(u)},t.fn.pivotUI=function(n,r,i,s){var u,l,c,d,g,m,v,b,A,C,y,w,T,N,S,x,F,M,E,L,k,D,R,I,O,K,q,H,U,V,j,B,P,J,_,z,Q,W,Y;null==i&&(i=!1),null==s&&(s="en"),v={derivedAttributes:{},aggregators:h[s].aggregators,renderers:h[s].renderers,hiddenAttributes:[],menuLimit:200,cols:[],rows:[],vals:[],exclusions:{},unusedAttrsVertical:"auto",autoSortUnusedAttrs:!1,rendererOptions:{localeStrings:h[s].localeStrings},onRefresh:null,filter:function(){return!0},sorters:function(){},localeStrings:h[s].localeStrings},A=this.data("pivotUIOptions"),T=null==A||i?t.extend(v,r):A;try{n=o.convertToArray(n),L=function(){var t,e;t=n[0],e=[];for(w in t)a.call(t,w)&&e.push(w);return e}(),_=T.derivedAttributes;for(g in _)a.call(_,g)&&e.call(L,g)<0&&L.push(g);for(d={},q=0,j=L.length;j>q;q++)O=L[q],d[O]={};o.forEachRecord(n,T.derivedAttributes,function(t){var e,n,r;r=[];for(w in t)a.call(t,w)&&(e=t[w],T.filter(t)&&(null==e&&(e="null"),null==(n=d[w])[e]&&(n[e]=0),r.push(d[w][e]++)));return r}),R=t("<table>").attr("cellpadding",5),M=t("<td>"),F=t("<select>").addClass("pvtRenderer").appendTo(M).bind("change",function(){return S()}),z=T.renderers;for(O in z)a.call(z,O)&&t("<option>").val(O).html(O).appendTo(F);if(m=t("<td>").addClass("pvtAxisContainer pvtUnused"),E=function(){var t,n,r;for(r=[],t=0,n=L.length;n>t;t++)g=L[t],e.call(T.hiddenAttributes,g)<0&&r.push(g);return r}(),I=!1,"auto"===T.unusedAttrsVertical){for(c=0,H=0,B=E.length;B>H;H++)u=E[H],c+=u.length;I=c>85}m.addClass(T.unusedAttrsVertical===!0||I?"pvtVertList":"pvtHorizList"),K=function(n){var r,a,o,i,s,u,l,c,h,f,g,v,b,A,y;if(l=function(){var t;t=[];for(w in d[n])t.push(w);return t}(),u=!1,v=t("<div>").addClass("pvtFilterBox").hide(),v.append(t("<h4>").text(""+n+" ("+l.length+")")),l.length>T.menuLimit)v.append(t("<p>").html(T.localeStrings.tooMany));else for(a=t("<p>").appendTo(v),a.append(t("<button>",{type:"button"}).html(T.localeStrings.selectAll).bind("click",function(){return v.find("input:visible").prop("checked",!0)})),a.append(t("<button>",{type:"button"}).html(T.localeStrings.selectNone).bind("click",function(){return v.find("input:visible").prop("checked",!1)})),a.append(t("<br>")),a.append(t("<input>",{type:"text",placeholder:T.localeStrings.filterResults,"class":"pvtSearch"}).bind("keyup",function(){var e;return e=t(this).val().toLowerCase(),v.find(".pvtCheckContainer p").each(function(){var n;return n=t(this).text().toLowerCase().indexOf(e),-1!==n?t(this).show():t(this).hide()})})),o=t("<div>").addClass("pvtCheckContainer").appendTo(v),y=l.sort(p(T.sorters,n)),b=0,A=y.length;A>b;b++)w=y[b],g=d[n][w],i=t("<label>"),s=T.exclusions[n]?e.call(T.exclusions[n],w)>=0:!1,u||(u=s),t("<input>").attr("type","checkbox").addClass("pvtFilter").attr("checked",!s).data("filter",[n,w]).appendTo(i),i.append(t("<span>").html(w)),i.append(t("<span>").text(" ("+g+")")),o.append(t("<p>").append(i));return f=function(){var t;return t=v.find("[type='checkbox']").length-v.find("[type='checkbox']:checked").length,t>0?r.addClass("pvtFilteredAttribute"):r.removeClass("pvtFilteredAttribute"),l.length>T.menuLimit?v.toggle():v.toggle(0,S)},t("<p>").appendTo(v).append(t("<button>",{type:"button"}).text("OK").bind("click",f)),c=function(t){return v.css({left:t.pageX,top:t.pageY}).toggle(),v.find(".pvtSearch").val(""),v.find(".pvtCheckContainer p").show()},h=t("<span>").addClass("pvtTriangle").html(" ▾").bind("click",c),r=t("<li>").addClass("axis_"+C).append(t("<span>").addClass("pvtAttr").text(n).data("attrName",n).append(h)),u&&r.addClass("pvtFilteredAttribute"),m.append(r).append(v),r.bind("dblclick",c)};for(C in E)a.call(E,C)&&(g=E[C],K(g));k=t("<tr>").appendTo(R),l=t("<select>").addClass("pvtAggregator").bind("change",function(){return S()}),Q=T.aggregators;for(O in Q)a.call(Q,O)&&l.append(t("<option>").val(O).html(O));for(t("<td>").addClass("pvtVals").appendTo(k).append(l).append(t("<br>")),t("<td>").addClass("pvtAxisContainer pvtHorizList pvtCols").appendTo(k),D=t("<tr>").appendTo(R),D.append(t("<td>").addClass("pvtAxisContainer pvtRows").attr("valign","top")),N=t("<td>").attr("valign","top").addClass("pvtRendererArea").appendTo(D),T.unusedAttrsVertical===!0||I?(R.find("tr:nth-child(1)").prepend(M),R.find("tr:nth-child(2)").prepend(m)):R.prepend(t("<tr>").append(M).append(m)),this.html(R),W=T.cols,U=0,P=W.length;P>U;U++)O=W[U],this.find(".pvtCols").append(this.find(".axis_"+t.inArray(O,E)));for(Y=T.rows,V=0,J=Y.length;J>V;V++)O=Y[V],this.find(".pvtRows").append(this.find(".axis_"+t.inArray(O,E)));null!=T.aggregatorName&&this.find(".pvtAggregator").val(T.aggregatorName),null!=T.rendererName&&this.find(".pvtRenderer").val(T.rendererName),y=!0,x=function(r){return function(){var a,o,i,s,u,c,p,h,d,g,m,v,b,A;if(h={derivedAttributes:T.derivedAttributes,localeStrings:T.localeStrings,rendererOptions:T.rendererOptions,sorters:T.sorters,cols:[],rows:[]},u=null!=(A=T.aggregators[l.val()]([])().numInputs)?A:0,g=[],r.find(".pvtRows li span.pvtAttr").each(function(){return h.rows.push(t(this).data("attrName"))}),r.find(".pvtCols li span.pvtAttr").each(function(){return h.cols.push(t(this).data("attrName"))}),r.find(".pvtVals select.pvtAttrDropdown").each(function(){return 0===u?t(this).remove():(u--,""!==t(this).val()?g.push(t(this).val()):void 0)}),0!==u)for(p=r.find(".pvtVals"),O=v=0;u>=0?u>v:v>u;O=u>=0?++v:--v){for(s=t("<select>").addClass("pvtAttrDropdown").append(t("<option>")).bind("change",function(){return S()}),b=0,m=E.length;m>b;b++)a=E[b],s.append(t("<option>").val(a).text(a));p.append(s)}return y&&(g=T.vals,C=0,r.find(".pvtVals select.pvtAttrDropdown").each(function(){return t(this).val(g[C]),C++}),y=!1),h.aggregatorName=l.val(),h.vals=g,h.aggregator=T.aggregators[l.val()](g),h.renderer=T.renderers[F.val()],o={},r.find("input.pvtFilter").not(":checked").each(function(){var e;return e=t(this).data("filter"),null!=o[e[0]]?o[e[0]].push(e[1]):o[e[0]]=[e[1]]}),i={},r.find("input.pvtFilter:checked").each(function(){var e;return e=t(this).data("filter"),null!=o[e[0]]?null!=i[e[0]]?i[e[0]].push(e[1]):i[e[0]]=[e[1]]:void 0}),h.filter=function(t){var n,r;if(!T.filter(t))return!1;for(w in o)if(n=o[w],r=""+t[w],e.call(n,r)>=0)return!1;return!0},N.pivot(n,h),c=t.extend(T,{cols:h.cols,rows:h.rows,vals:g,exclusions:o,inclusionsInfo:i,aggregatorName:l.val(),rendererName:F.val()}),r.data("pivotUIOptions",c),T.autoSortUnusedAttrs&&(d=r.find("td.pvtUnused.pvtAxisContainer"),t(d).children("li").sort(function(e,n){return f(t(e).text(),t(n).text())}).appendTo(d)),N.css("opacity",1),null!=T.onRefresh?T.onRefresh(c):void 0}}(this),S=function(){return function(){return N.css("opacity",.5),setTimeout(x,10)}}(this),S(),this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?S():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(T.localeStrings.uiRenderError)}return this},t.fn.heatmap=function(e){var n,r,a,o,i,s,u,l;switch(null==e&&(e="heatmap"),s=this.data("numrows"),i=this.data("numcols"),n=function(t,e,n){var r;return r=function(){switch(t){case"red":return function(t){return"ff"+t+t};case"green":return function(t){return""+t+"ff"+t};case"blue":return function(t){return""+t+t+"ff"}}}(),function(t){var a,o;return o=255-Math.round(255*(t-e)/(n-e)),a=o.toString(16).split(".")[0],1===a.length&&(a=0+a),r(a)}},r=function(e){return function(r,a){var o,i,s;return i=function(n){return e.find(r).each(function(){var e;return e=t(this).data("value"),null!=e&&isFinite(e)?n(e,t(this)):void 0})},s=[],i(function(t){return s.push(t)}),o=n(a,Math.min.apply(Math,s),Math.max.apply(Math,s)),i(function(t,e){return e.css("background-color","#"+o(t))})}}(this),e){case"heatmap":r(".pvtVal","red");break;case"rowheatmap":for(a=u=0;s>=0?s>u:u>s;a=s>=0?++u:--u)r(".pvtVal.row"+a,"red");break;case"colheatmap":for(o=l=0;i>=0?i>l:l>i;o=i>=0?++l:--l)r(".pvtVal.col"+o,"red")}return r(".pvtTotal.rowTotal","red"),r(".pvtTotal.colTotal","red"),this},t.fn.barchart=function(){var e,n,r,a,o;for(a=this.data("numrows"),r=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("<div>").css({position:"relative",height:"55px"}),a.append(t("<div>").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"})),a.append(t("<div>").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=o=0;a>=0?a>o:o>a;n=a>=0?++o:--o)e(".pvtVal.row"+n);return e(".pvtTotal.colTotal"),this}})}).call(this); | ||
//# sourceMappingURL=pivot.min.js.map |
@@ -15,3 +15,3 @@ (function() { | ||
callWithJQuery(function($) { | ||
var frFmt, frFmtInt, frFmtPct, gcr, nf, r, tpl; | ||
var c3r, d3r, frFmt, frFmtInt, frFmtPct, gcr, nf, r, tpl; | ||
nf = $.pivotUtilities.numberFormat; | ||
@@ -21,2 +21,4 @@ tpl = $.pivotUtilities.aggregatorTemplates; | ||
gcr = $.pivotUtilities.gchart_renderers; | ||
d3r = $.pivotUtilities.d3_renderers; | ||
c3r = $.pivotUtilities.c3_renderers; | ||
frFmt = nf({ | ||
@@ -38,3 +40,3 @@ thousandsSep: ".", | ||
}); | ||
return $.pivotUtilities.locales.pt = { | ||
$.pivotUtilities.locales.pt = { | ||
localeStrings: { | ||
@@ -59,2 +61,4 @@ renderError: "Ocorreu um error ao renderizar os resultados da Tabela Dinãmica.", | ||
"Média": tpl.average(frFmt), | ||
"Mínimo": tpl.min(frFmt), | ||
"Máximo": tpl.max(frFmt), | ||
"Soma sobre Soma": tpl.sumOverSum(frFmt), | ||
@@ -76,4 +80,6 @@ "Limite Superior a 80%": tpl.sumOverSumBound80(true, frFmt), | ||
"Mapa de Calor por Colunas": r["Col Heatmap"] | ||
}, | ||
gchart_renderers: { | ||
} | ||
}; | ||
if (gcr) { | ||
$.pivotUtilities.locales.pt.gchart_renderers = { | ||
"Gráfico de Linhas": gcr["Line Chart"], | ||
@@ -83,4 +89,16 @@ "Gráfico de Barras": gcr["Bar Chart"], | ||
"Gráfico de Área": gcr["Area Chart"] | ||
} | ||
}; | ||
}; | ||
} | ||
if (d3r) { | ||
$.pivotUtilities.locales.pt.d3_renderers = { | ||
"Mapa de Árvore": d3r["Treemap"] | ||
}; | ||
} | ||
if (c3r) { | ||
$.pivotUtilities.locales.pt.c3_renderers = { | ||
"Gráfico de Linhas": c3r["Line Chart C3"], | ||
"Gráfico de Barras": c3r["Bar Chart C3"] | ||
}; | ||
} | ||
return $.pivotUtilities.locales.pt; | ||
}); | ||
@@ -87,0 +105,0 @@ |
@@ -1,2 +0,2 @@ | ||
(function(){var a;(a=function(a){return"object"==typeof exports&&"object"==typeof module?a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){var e,r,o,t,i,c,l;return i=a.pivotUtilities.numberFormat,l=a.pivotUtilities.aggregatorTemplates,c=a.pivotUtilities.renderers,t=a.pivotUtilities.gchart_renderers,e=i({thousandsSep:".",decimalSep:","}),r=i({digitsAfterDecimal:0,thousandsSep:".",decimalSep:","}),o=i({digitsAfterDecimal:2,scaler:100,suffix:"%",thousandsSep:".",decimalSep:","}),a.pivotUtilities.locales.pt={localeStrings:{renderError:"Ocorreu um error ao renderizar os resultados da Tabela Dinãmica.",computeError:"Ocorreu um error ao computar os resultados da Tabela Dinãmica.",uiRenderError:"Ocorreu um error ao renderizar a interface da Tabela Dinãmica.",selectAll:"Selecionar Tudo",selectNone:"Selecionar Nenhum",tooMany:"(demais para listar)",filterResults:"Filtrar resultados",totals:"Totais",vs:"vs",by:"por"},aggregators:{Contagem:l.count(r),"Contagem de Valores únicos":l.countUnique(r),"Lista de Valores únicos":l.listUnique(", "),Soma:l.sum(e),"Soma de Inteiros":l.sum(r),"Média":l.average(e),"Soma sobre Soma":l.sumOverSum(e),"Limite Superior a 80%":l.sumOverSumBound80(!0,e),"Limite Inferior a 80%":l.sumOverSumBound80(!1,e),"Soma como Fração do Total":l.fractionOf(l.sum(),"total",o),"Soma como Fração da Linha":l.fractionOf(l.sum(),"row",o),"Soma como Fração da Coluna":l.fractionOf(l.sum(),"col",o),"Contagem como Fração do Total":l.fractionOf(l.count(),"total",o),"Contagem como Fração da Linha":l.fractionOf(l.count(),"row",o),"Contagem como Fração da Coluna":l.fractionOf(l.count(),"col",o)},renderers:{Tabela:c.Table,"Tabela com Barras":c["Table Barchart"],"Mapa de Calor":c.Heatmap,"Mapa de Calor por Linhas":c["Row Heatmap"],"Mapa de Calor por Colunas":c["Col Heatmap"]},gchart_renderers:{"Gráfico de Linhas":t["Line Chart"],"Gráfico de Barras":t["Bar Chart"],"Gráfico de Barras Empilhadas":t["Stacked Bar Chart"],"Gráfico de Área":t["Area Chart"]}}})}).call(this); | ||
(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var a,r,o,t,i,c,l,s,n;return l=e.pivotUtilities.numberFormat,n=e.pivotUtilities.aggregatorTemplates,s=e.pivotUtilities.renderers,c=e.pivotUtilities.gchart_renderers,r=e.pivotUtilities.d3_renderers,a=e.pivotUtilities.c3_renderers,o=l({thousandsSep:".",decimalSep:","}),t=l({digitsAfterDecimal:0,thousandsSep:".",decimalSep:","}),i=l({digitsAfterDecimal:2,scaler:100,suffix:"%",thousandsSep:".",decimalSep:","}),e.pivotUtilities.locales.pt={localeStrings:{renderError:"Ocorreu um error ao renderizar os resultados da Tabela Dinãmica.",computeError:"Ocorreu um error ao computar os resultados da Tabela Dinãmica.",uiRenderError:"Ocorreu um error ao renderizar a interface da Tabela Dinãmica.",selectAll:"Selecionar Tudo",selectNone:"Selecionar Nenhum",tooMany:"(demais para listar)",filterResults:"Filtrar resultados",totals:"Totais",vs:"vs",by:"por"},aggregators:{Contagem:n.count(t),"Contagem de Valores únicos":n.countUnique(t),"Lista de Valores únicos":n.listUnique(", "),Soma:n.sum(o),"Soma de Inteiros":n.sum(t),"Média":n.average(o),"Mínimo":n.min(o),"Máximo":n.max(o),"Soma sobre Soma":n.sumOverSum(o),"Limite Superior a 80%":n.sumOverSumBound80(!0,o),"Limite Inferior a 80%":n.sumOverSumBound80(!1,o),"Soma como Fração do Total":n.fractionOf(n.sum(),"total",i),"Soma como Fração da Linha":n.fractionOf(n.sum(),"row",i),"Soma como Fração da Coluna":n.fractionOf(n.sum(),"col",i),"Contagem como Fração do Total":n.fractionOf(n.count(),"total",i),"Contagem como Fração da Linha":n.fractionOf(n.count(),"row",i),"Contagem como Fração da Coluna":n.fractionOf(n.count(),"col",i)},renderers:{Tabela:s.Table,"Tabela com Barras":s["Table Barchart"],"Mapa de Calor":s.Heatmap,"Mapa de Calor por Linhas":s["Row Heatmap"],"Mapa de Calor por Colunas":s["Col Heatmap"]}},c&&(e.pivotUtilities.locales.pt.gchart_renderers={"Gráfico de Linhas":c["Line Chart"],"Gráfico de Barras":c["Bar Chart"],"Gráfico de Barras Empilhadas":c["Stacked Bar Chart"],"Gráfico de Área":c["Area Chart"]}),r&&(e.pivotUtilities.locales.pt.d3_renderers={"Mapa de Árvore":r.Treemap}),a&&(e.pivotUtilities.locales.pt.c3_renderers={"Gráfico de Linhas":a["Line Chart C3"],"Gráfico de Barras":a["Bar Chart C3"]}),e.pivotUtilities.locales.pt})}).call(this); | ||
//# sourceMappingURL=pivot.pt.min.js.map |
@@ -26,3 +26,3 @@ var gulp = require('gulp'), | ||
gulp.task('push', function (done) { | ||
git.push('origin', 'master', function (err) { | ||
git.push('origin', 'master', {args: '--tags'}, function (err) { | ||
if (err) throw err; | ||
@@ -29,0 +29,0 @@ }); |
{ | ||
"name": "pivottable", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop", | ||
@@ -5,0 +5,0 @@ "main": "dist/pivot.js", |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"author": { | ||
@@ -17,0 +17,0 @@ "name": "Nicolas Kruchten", |
@@ -45,2 +45,4 @@ #PivotTable.js | ||
You need to load jQuery and the PivotTable.js scripts (`pivot.min.js` and any plugins or source maps), which can be done the normal way (download the files from [dist](https://github.com/nicolaskruchten/pivottable/tree/master/dist) and reference them), or loaded from [CDNJS](https://cdnjs.com/libraries/pivottable), or via [NPM](https://www.npmjs.com/package/pivottable) with `npm install pivottable` or via Bower with `bower install pivottable`. | ||
There are two main functions defined in `pivot.coffee`: `pivot()` and `pivotUI()`, both implemented as jQuery plugins, as well as a bunch of helpers and templates. | ||
@@ -107,3 +109,3 @@ | ||
Please first check the [Frequently Asked Questions](https://github.com/nicolaskruchten/pivottable/wiki/Frequently-Asked-Questions) and if you can't find what you're looking for there, or in the [wiki](https://github.com/nicolaskruchten/pivottable/wiki), then please [create a GitHub Issue](https://github.com/nicolaskruchten/pivottable/issues/new). | ||
Please first check the [Frequently Asked Questions](https://github.com/nicolaskruchten/pivottable/wiki/Frequently-Asked-Questions) and if you can't find what you're looking for there, or in the [wiki](https://github.com/nicolaskruchten/pivottable/wiki), then please [create a GitHub Issue](https://github.com/nicolaskruchten/pivottable/issues/new). When creating an issue, please try to provide a replicable test case so that others can more easily help you. | ||
@@ -110,0 +112,0 @@ ##Copyright & Licence (MIT License) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68803740
2358
119
3
70
2806
9