pivottable
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -21,3 +21,3 @@ (function() { | ||
return function(pivotData, opts) { | ||
var agg, attrs, base, base1, base2, base3, base4, base5, colKey, colKeys, columns, dataColumns, defaults, fullAggName, groupByTitle, h, hAxisTitle, headers, i, j, k, l, len, len1, len2, len3, len4, m, numCharsInHAxis, numSeries, params, ref, ref1, ref2, ref3, renderArea, result, rotationAngle, row, rowHeader, rowKey, rowKeys, s, scatterData, series, title, titleText, vAxisTitle, val, vals, x, xs; | ||
var agg, attrs, base, base1, base2, base3, base4, base5, c, categories, colKey, colKeys, columns, dataColumns, defaults, fullAggName, groupByTitle, h, hAxisTitle, headers, i, j, k, l, len, len1, len2, len3, len4, m, numCharsInHAxis, numSeries, params, ref, ref1, ref2, ref3, renderArea, result, rotationAngle, row, rowHeader, rowKey, rowKeys, s, scatterData, series, title, titleText, vAxisTitle, val, vals, x, xs; | ||
defaults = { | ||
@@ -43,2 +43,8 @@ localeStrings: { | ||
} | ||
if (chartOpts.horizontal == null) { | ||
chartOpts.horizontal = false; | ||
} | ||
if (chartOpts.stacked == null) { | ||
chartOpts.stacked = false; | ||
} | ||
rowKeys = pivotData.getRowKeys(); | ||
@@ -122,3 +128,3 @@ if (rowKeys.length === 0) { | ||
rowHeader = rowKey.join("-"); | ||
row = [rowHeader === "" ? pivotData.aggregatorName : rowHeader]; | ||
row = [rowHeader === "" ? fullAggName : rowHeader]; | ||
for (m = 0, len4 = colKeys.length; m < len4; m++) { | ||
@@ -139,4 +145,10 @@ colKey = colKeys[m]; | ||
} | ||
vAxisTitle = pivotData.aggregatorName + (pivotData.valAttrs.length ? "(" + (pivotData.valAttrs.join(", ")) + ")" : ""); | ||
hAxisTitle = pivotData.colAttrs.join("-"); | ||
vAxisTitle = fullAggName; | ||
if (chartOpts.horizontal) { | ||
hAxisTitle = pivotData.rowAttrs.join("-"); | ||
groupByTitle = pivotData.colAttrs.join("-"); | ||
} else { | ||
hAxisTitle = pivotData.colAttrs.join("-"); | ||
groupByTitle = pivotData.rowAttrs.join("-"); | ||
} | ||
titleText = fullAggName; | ||
@@ -146,3 +158,2 @@ if (hAxisTitle !== "") { | ||
} | ||
groupByTitle = pivotData.rowAttrs.join("-"); | ||
if (groupByTitle !== "") { | ||
@@ -158,2 +169,3 @@ titleText += " " + opts.localeStrings.by + " " + groupByTitle; | ||
axis: { | ||
rotated: chartOpts.horizontal, | ||
y: { | ||
@@ -171,3 +183,4 @@ label: vAxisTitle | ||
data: { | ||
type: chartOpts.type | ||
type: chartOpts.type, | ||
order: null | ||
}, | ||
@@ -215,18 +228,53 @@ tooltip: { | ||
params.axis.x.type = 'category'; | ||
params.axis.x.categories = headers; | ||
params.data.columns = columns; | ||
} | ||
if (chartOpts.stacked != null) { | ||
params.data.groups = [ | ||
(function() { | ||
if (chartOpts.horizontal) { | ||
categories = (function() { | ||
var len5, n, results; | ||
results = []; | ||
for (n = 0, len5 = rowKeys.length; n < len5; n++) { | ||
x = rowKeys[n]; | ||
results.push(x.join("-")); | ||
for (n = 0, len5 = columns.length; n < len5; n++) { | ||
c = columns[n]; | ||
results.push(c.shift()); | ||
} | ||
return results; | ||
})() | ||
]; | ||
})(); | ||
if (categories.length === 1 && categories[0] === fullAggName) { | ||
categories = [""]; | ||
} | ||
params.axis.x.categories = categories; | ||
if (headers.length === 1 && headers[0] === "") { | ||
headers = [fullAggName]; | ||
} | ||
columns.unshift(headers); | ||
params.data.rows = columns; | ||
} else { | ||
params.axis.x.categories = headers; | ||
params.data.columns = columns; | ||
} | ||
} | ||
if (chartOpts.stacked) { | ||
if (chartOpts.horizontal) { | ||
params.data.groups = [ | ||
(function() { | ||
var len5, n, results; | ||
results = []; | ||
for (n = 0, len5 = colKeys.length; n < len5; n++) { | ||
x = colKeys[n]; | ||
results.push(x.join("-")); | ||
} | ||
return results; | ||
})() | ||
]; | ||
} else { | ||
params.data.groups = [ | ||
(function() { | ||
var len5, n, results; | ||
results = []; | ||
for (n = 0, len5 = rowKeys.length; n < len5; n++) { | ||
x = rowKeys[n]; | ||
results.push(x.join("-")); | ||
} | ||
return results; | ||
})() | ||
]; | ||
} | ||
} | ||
renderArea = $("<div>", { | ||
@@ -244,3 +292,11 @@ style: "display:none;" | ||
return $.pivotUtilities.c3_renderers = { | ||
"Line Chart": makeC3Chart(), | ||
"Horizontal Bar Chart": makeC3Chart({ | ||
type: "bar", | ||
horizontal: true | ||
}), | ||
"Horizontal Stacked Bar Chart": makeC3Chart({ | ||
type: "bar", | ||
stacked: true, | ||
horizontal: true | ||
}), | ||
"Bar Chart": makeC3Chart({ | ||
@@ -253,2 +309,3 @@ type: "bar" | ||
}), | ||
"Line Chart": makeC3Chart(), | ||
"Area Chart": makeC3Chart({ | ||
@@ -255,0 +312,0 @@ type: "area", |
@@ -1,2 +0,2 @@ | ||
(function(){var t;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery"),require("c3")):"function"==typeof define&&define.amd?define(["jquery","c3"],t):t(jQuery,c3)})(function(t,e){var n;return n=function(n){return null==n&&(n={}),function(r,a){var l,o,i,s,c,u,g,p,h,d,f,y,v,x,b,j,m,w,A,S,k,C,q,z,F,N,_,B,K,T,H,L,P,Q,R,U,W,D,E,G,I,J,M,O,V,X,Y,Z,$,tt,et,nt;if(v={localeStrings:{vs:"vs",by:"by"},c3:{}},a=t.extend(!0,{},v,a),null==(i=a.c3).size&&(i.size={}),null==(s=a.c3.size).width&&(s.width=window.innerWidth/1.4),null==(c=a.c3.size).height&&(c.height=window.innerHeight/1.4-50),null==n.type&&(n.type="line"),J=r.getRowKeys(),0===J.length&&J.push([]),d=r.getColKeys(),0===d.length&&d.push([]),w=function(){var t,e,n;for(n=[],t=0,e=d.length;e>t;t++)j=d[t],n.push(j.join("-"));return n}(),D=0,x=r.aggregatorName,r.valAttrs.length&&(x+="("+r.valAttrs.join(", ")+")"),"scatter"===n.type)for(O={x:{},y:{},t:{}},o=r.rowAttrs.concat(r.colAttrs),Z=null!=(L=o[0])?L:"",m=null!=(P=o[1])?P:"",b=o.slice(2).join("-"),Y=Z,""!==m&&(Y+=" "+a.localeStrings.vs+" "+m),""!==b&&(Y+=" "+a.localeStrings.by+" "+b),A=0,q=J.length;q>A;A++)for(I=J[A],S=0,z=d.length;z>S;S++)h=d[S],l=r.getAggregator(I,h),null!=l.value()&&(tt=I.concat(h),V=tt.slice(2).join("-"),""===V&&(V="series"),null==(u=O.x)[V]&&(u[V]=[]),null==(g=O.y)[V]&&(g[V]=[]),null==(p=O.t)[V]&&(p[V]=[]),O.y[V].push(null!=(Q=tt[0])?Q:0),O.x[V].push(null!=(R=tt[1])?R:0),O.t[V].push(l.format(l.value())));else{for(K=0,k=0,F=w.length;F>k;k++)et=w[k],K+=et.length;for(K>50&&(D=45),f=[],C=0,N=J.length;N>C;C++){for(I=J[C],G=I.join("-"),E=[""===G?r.aggregatorName:G],B=0,_=d.length;_>B;B++)h=d[B],$=parseFloat(r.getAggregator(I,h).value()),E.push(isFinite($)?1>$?$.toPrecision(3):$.toFixed(3):null);f.push(E)}Z=r.aggregatorName+(r.valAttrs.length?"("+r.valAttrs.join(", ")+")":""),m=r.colAttrs.join("-"),Y=x,""!==m&&(Y+=" "+a.localeStrings.vs+" "+m),b=r.rowAttrs.join("-"),""!==b&&(Y+=" "+a.localeStrings.by+" "+b)}if(X=t("<p>",{style:"text-align: center; font-weight: bold"}),X.text(Y),H={axis:{y:{label:Z},x:{label:m,tick:{rotate:D,multiline:!1}}},data:{type:n.type},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"]}},H=t.extend(!0,{},H,a.c3),"scatter"===n.type){nt={},T=0,y=[];for(M in O.x)T+=1,nt[M]=M+"_x",y.push([M+"_x"].concat(O.x[M])),y.push([M].concat(O.y[M]));H.data.xs=nt,H.data.columns=y,H.axis.x.tick={fit:!1},1===T&&(H.legend={show:!1}),H.tooltip.format={title:function(){return x},name:function(){return""},value:function(t,e,n,r){return O.t[n][r]}}}else H.axis.x.type="category",H.axis.x.categories=w,H.data.columns=f;return null!=n.stacked&&(H.data.groups=[function(){var t,e,n;for(n=[],e=0,t=J.length;t>e;e++)et=J[e],n.push(et.join("-"));return n}()]),U=t("<div>",{style:"display:none;"}).appendTo(t("body")),W=t("<div>").appendTo(U),H.bindto=W[0],e.generate(H),W.detach(),U.remove(),t("<div>").append(X,W)}},t.pivotUtilities.c3_renderers={"Line Chart":n(),"Bar Chart":n({type:"bar"}),"Stacked Bar Chart":n({type:"bar",stacked:!0}),"Area Chart":n({type:"area",stacked:!0}),"Scatter Chart":n({type:"scatter"})}})}).call(this); | ||
(function(){var t;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery"),require("c3")):"function"==typeof define&&define.amd?define(["jquery","c3"],t):t(jQuery,c3)})(function(t,e){var n;return n=function(n){return null==n&&(n={}),function(r,a){var o,l,i,s,c,u,h,d,g,p,f,y,x,v,b,j,z,w,A,k,m,C,S,q,B,F,H,_,K,T,L,N,P,Q,R,U,W,D,E,G,I,J,M,O,V,X,Y,Z,$,tt,et,nt,rt,at;if(b={localeStrings:{vs:"vs",by:"by"},c3:{}},a=t.extend(!0,{},b,a),null==(i=a.c3).size&&(i.size={}),null==(s=a.c3.size).width&&(s.width=window.innerWidth/1.4),null==(c=a.c3.size).height&&(c.height=window.innerHeight/1.4-50),null==n.type&&(n.type="line"),null==n.horizontal&&(n.horizontal=!1),null==n.stacked&&(n.stacked=!1),O=r.getRowKeys(),0===O.length&&O.push([]),y=r.getColKeys(),0===y.length&&y.push([]),k=function(){var t,e,n;for(n=[],t=0,e=y.length;e>t;t++)w=y[t],n.push(w.join("-"));return n}(),G=0,j=r.aggregatorName,r.valAttrs.length&&(j+="("+r.valAttrs.join(", ")+")"),"scatter"===n.type)for(X={x:{},y:{},t:{}},l=r.rowAttrs.concat(r.colAttrs),tt=null!=(Q=l[0])?Q:"",A=null!=(R=l[1])?R:"",z=l.slice(2).join("-"),$=tt,""!==A&&($+=" "+a.localeStrings.vs+" "+A),""!==z&&($+=" "+a.localeStrings.by+" "+z),m=0,B=O.length;B>m;m++)for(M=O[m],C=0,F=y.length;F>C;C++)f=y[C],o=r.getAggregator(M,f),null!=o.value()&&(nt=M.concat(f),Y=nt.slice(2).join("-"),""===Y&&(Y="series"),null==(u=X.x)[Y]&&(u[Y]=[]),null==(h=X.y)[Y]&&(h[Y]=[]),null==(d=X.t)[Y]&&(d[Y]=[]),X.y[Y].push(null!=(U=nt[0])?U:0),X.x[Y].push(null!=(W=nt[1])?W:0),X.t[Y].push(o.format(o.value())));else{for(L=0,S=0,H=k.length;H>S;S++)rt=k[S],L+=rt.length;for(L>50&&(G=45),x=[],q=0,_=O.length;_>q;q++){for(M=O[q],J=M.join("-"),I=[""===J?j:J],T=0,K=y.length;K>T;T++)f=y[T],et=parseFloat(r.getAggregator(M,f).value()),I.push(isFinite(et)?1>et?et.toPrecision(3):et.toFixed(3):null);x.push(I)}tt=j,n.horizontal?(A=r.rowAttrs.join("-"),z=r.colAttrs.join("-")):(A=r.colAttrs.join("-"),z=r.rowAttrs.join("-")),$=j,""!==A&&($+=" "+a.localeStrings.vs+" "+A),""!==z&&($+=" "+a.localeStrings.by+" "+z)}if(Z=t("<p>",{style:"text-align: center; font-weight: bold"}),Z.text($),P={axis:{rotated:n.horizontal,y:{label:tt},x:{label:A,tick:{rotate:G,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"]}},P=t.extend(!0,{},P,a.c3),"scatter"===n.type){at={},N=0,v=[];for(V in X.x)N+=1,at[V]=V+"_x",v.push([V+"_x"].concat(X.x[V])),v.push([V].concat(X.y[V]));P.data.xs=at,P.data.columns=v,P.axis.x.tick={fit:!1},1===N&&(P.legend={show:!1}),P.tooltip.format={title:function(){return j},name:function(){return""},value:function(t,e,n,r){return X.t[n][r]}}}else P.axis.x.type="category",n.horizontal?(p=function(){var t,e,n;for(n=[],e=0,t=x.length;t>e;e++)g=x[e],n.push(g.shift());return n}(),1===p.length&&p[0]===j&&(p=[""]),P.axis.x.categories=p,1===k.length&&""===k[0]&&(k=[j]),x.unshift(k),P.data.rows=x):(P.axis.x.categories=k,P.data.columns=x);return n.stacked&&(P.data.groups=n.horizontal?[function(){var t,e,n;for(n=[],e=0,t=y.length;t>e;e++)rt=y[e],n.push(rt.join("-"));return n}()]:[function(){var t,e,n;for(n=[],e=0,t=O.length;t>e;e++)rt=O[e],n.push(rt.join("-"));return n}()]),D=t("<div>",{style:"display:none;"}).appendTo(t("body")),E=t("<div>").appendTo(D),P.bindto=E[0],e.generate(P),E.detach(),D.remove(),t("<div>").append(Z,E)}},t.pivotUtilities.c3_renderers={"Horizontal Bar Chart":n({type:"bar",horizontal:!0}),"Horizontal Stacked Bar Chart":n({type:"bar",stacked:!0,horizontal:!0}),"Bar Chart":n({type:"bar"}),"Stacked Bar Chart":n({type:"bar",stacked:!0}),"Line Chart":n(),"Area Chart":n({type:"area",stacked:!0}),"Scatter Chart":n({type:"scatter"})}})}).call(this); | ||
//# sourceMappingURL=c3_renderers.min.js.map |
{ | ||
"name": "pivottable", | ||
"version": "2.9.0", | ||
"version": "2.10.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", |
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
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
774101
4293