diff --git a/dist/c3_renderers.js b/dist/c3_renderers.js index 92fb54a3..b5f9975e 100644 --- a/dist/c3_renderers.js +++ b/dist/c3_renderers.js @@ -318,4 +318,4 @@ }).call(this); -//# sourceMappingURL=c3_renderers.js.map \ No newline at end of file +//# sourceMappingURL=c3_renderers.js.map diff --git a/dist/c3_renderers.js.map b/dist/c3_renderers.js.map index 5624f1c7..891e1621 100644 --- a/dist/c3_renderers.js.map +++ b/dist/c3_renderers.js.map @@ -1 +1 @@ -{"version":3,"sources":["c3_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;;AAAA,EAAA,cAAA,GAAiB,SAAC,WAAD,GAAA;AACb,IAAA,IAAG,MAAA,CAAA,OAAA,KAAkB,QAAlB,IAA+B,MAAA,CAAA,MAAA,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EAA+B,OAAA,CAAQ,IAAR,CAA/B,EADJ;KAAA,MAEK,IAAG,MAAA,CAAA,MAAA,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,EAAW,IAAX,CAAP,EAAyB,WAAzB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAAoB,EAApB,EAJC;KAHQ;EAAA,CAAjB,CAAA;;AAAA,EASA,cAAA,CAAe,SAAC,CAAD,EAAI,EAAJ,GAAA;AAEX,QAAA,WAAA;AAAA,IAAA,WAAA,GAAc,SAAC,SAAD,GAAA;;QAAC,YAAY;OAAO;aAAA,SAAC,SAAD,EAAY,IAAZ,GAAA;AAC9B,YAAA,2aAAA;AAAA,QAAA,QAAA,GACI;AAAA,UAAA,aAAA,EAAe;AAAA,YAAC,EAAA,EAAI,IAAL;AAAA,YAAW,EAAA,EAAI,IAAf;WAAf;AAAA,UACA,EAAA,EAAI,EADJ;SADJ,CAAA;AAAA,QAIA,IAAA,GAAO,CAAC,CAAC,MAAF,CAAS,IAAT,EAAe,EAAf,EAAmB,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M,CAAC,MAAP,CAAA,CA1JA,CAAA;AAAA,QA2JA,UAAU,CAAC,MAAX,CAAA,CA3JA,CAAA;AA4JA,eAAO,CAAA,CAAE,OAAF,CAAU,CAAC,MAAX,CAAkB,KAAlB,EAAyB,MAAzB,CAAP,CA7J8B;MAAA,EAApB;IAAA,CAAd,CAAA;WA+JA,CAAC,CAAC,cAAc,CAAC,YAAjB,GACI;AAAA,MAAA,sBAAA,EAAwB,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;AAAA,QAAa,UAAA,EAAY,IAAzB;OAAZ,CAAxB;AAAA,MACA,8BAAA,EAAgC,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;AAAA,QAAa,OAAA,EAAS,IAAtB;AAAA,QAA4B,UAAA,EAAY,IAAxC;OAAZ,CADhC;AAAA,MAEA,WAAA,EAAa,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;OAAZ,CAFb;AAAA,MAGA,mBAAA,EAAqB,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,KAAN;AAAA,QAAa,OAAA,EAAS,IAAtB;OAAZ,CAHrB;AAAA,MAIA,YAAA,EAAc,WAAA,CAAA,CAJd;AAAA,MAKA,YAAA,EAAc,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,MAAN;AAAA,QAAc,OAAA,EAAS,IAAvB;OAAZ,CALd;AAAA,MAMA,eAAA,EAAiB,WAAA,CAAY;AAAA,QAAA,IAAA,EAAM,SAAN;OAAZ,CANjB;MAlKO;EAAA,CAAf,CATA,CAAA;AAAA","file":"c3_renderers.js","sourceRoot":"/source/","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"c3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"c3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, c3\n\ncallWithJQuery ($, c3) ->\n\n makeC3Chart = (chartOpts = {}) -> (pivotData, opts) ->\n defaults =\n localeStrings: {vs: \"vs\", by: \"by\"}\n c3: {}\n\n opts = $.extend(true, {}, defaults, opts)\n opts.c3.size ?= {}\n opts.c3.size.width ?= window.innerWidth / 1.4\n opts.c3.size.height ?= window.innerHeight / 1.4 - 50\n chartOpts.type ?= \"line\"\n chartOpts.horizontal ?= false\n chartOpts.stacked ?= false\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n\n headers = (h.join(\"-\") for h in colKeys)\n rotationAngle = 0\n\n fullAggName = pivotData.aggregatorName\n if pivotData.valAttrs.length\n fullAggName += \"(#{pivotData.valAttrs.join(\", \")})\"\n\n if chartOpts.type == \"scatter\"\n scatterData = x:{}, y:{}, t:{}\n attrs = pivotData.rowAttrs.concat(pivotData.colAttrs)\n vAxisTitle = attrs[0] ? \"\"\n hAxisTitle = attrs[1] ? \"\"\n groupByTitle = attrs.slice(2).join(\"-\")\n titleText = vAxisTitle\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n for rowKey in rowKeys\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n vals = rowKey.concat(colKey)\n series = vals.slice(2).join(\"-\")\n if series == \"\" then series = \"series\"\n scatterData.x[series] ?= []\n scatterData.y[series] ?= []\n scatterData.t[series] ?= []\n scatterData.y[series].push vals[0] ? 0\n scatterData.x[series].push vals[1] ? 0\n scatterData.t[series].push agg.value()\n else\n numCharsInHAxis = 0\n for x in headers\n numCharsInHAxis += x.length\n if numCharsInHAxis > 50\n rotationAngle = 45\n\n columns = []\n for rowKey in rowKeys\n rowHeader = rowKey.join(\"-\")\n row = [if rowHeader == \"\" then fullAggName else rowHeader]\n for colKey in colKeys\n val = parseFloat pivotData.getAggregator(rowKey, colKey).value()\n if isFinite(val)\n row.push(val)\n else\n row.push(null)\n columns.push row\n\n vAxisTitle = fullAggName\n\n if chartOpts.horizontal\n hAxisTitle = pivotData.rowAttrs.join(\"-\")\n groupByTitle = pivotData.colAttrs.join(\"-\")\n else\n hAxisTitle = pivotData.colAttrs.join(\"-\")\n groupByTitle = pivotData.rowAttrs.join(\"-\")\n titleText = fullAggName\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n\n title = $(\"

\", {style: \"text-align: center; font-weight: bold\"})\n title.text(titleText)\n\n formatter = pivotData.getAggregator([], []).format\n\n params =\n axis:\n rotated: chartOpts.horizontal\n y:\n label: vAxisTitle\n tick: {}\n x:\n label: hAxisTitle\n tick:\n rotate: rotationAngle\n multiline: false\n data:\n type: chartOpts.type\n order: null\n tooltip:\n grouped: false\n color:\n pattern: [ \"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\",\n \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\",\n \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\",\n \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\",\n \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\" ]\n\n\n params = $.extend(true, {}, params, opts.c3)\n if chartOpts.type == \"scatter\"\n xs = {}\n numSeries = 0\n dataColumns = []\n for s of scatterData.x\n numSeries += 1\n xs[s] = s+\"_x\"\n dataColumns.push [s+\"_x\"].concat(scatterData.x[s])\n dataColumns.push [s].concat(scatterData.y[s])\n params.data.xs = xs\n params.data.columns = dataColumns\n params.axis.x.tick = fit: false\n if numSeries == 1\n params.legend = show: false\n params.tooltip.format =\n title: -> fullAggName\n name: -> \"\"\n value: (a,b,c,d) -> formatter(scatterData.t[c][d])\n else\n params.axis.x.type= 'category'\n params.axis.y.tick.format ?= (v) -> formatter(v)\n params.tooltip.format = value: (v) -> formatter(v)\n\n if chartOpts.horizontal\n categories = (c.shift() for c in columns)\n if categories.length == 1 and categories[0] == fullAggName\n categories = [\"\"]\n params.axis.x.categories = categories\n if headers.length == 1 and headers[0] == \"\"\n headers = [fullAggName]\n columns.unshift(headers)\n params.data.rows = columns\n else\n params.axis.x.categories = headers\n params.data.columns = columns\n\n\n if chartOpts.stacked\n if chartOpts.horizontal\n params.data.groups = [x.join(\"-\") for x in colKeys]\n else\n params.data.groups = [x.join(\"-\") for x in rowKeys]\n\n renderArea = $(\"

\", style: \"display:none;\").appendTo $(\"body\")\n result = $(\"
\").appendTo renderArea\n params.bindto = result[0]\n c3.generate params\n result.detach()\n renderArea.remove()\n return $(\"
\").append title, result\n\n $.pivotUtilities.c3_renderers =\n \"Horizontal Bar Chart\": makeC3Chart(type: \"bar\", horizontal: true)\n \"Horizontal Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true, horizontal: true)\n \"Bar Chart\": makeC3Chart(type: \"bar\")\n \"Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true)\n \"Line Chart\": makeC3Chart()\n \"Area Chart\": makeC3Chart(type: \"area\", stacked: true)\n \"Scatter Chart\": makeC3Chart(type: \"scatter\")\n"]} \ No newline at end of file +{"version":3,"file":"c3_renderers.js","sources":["c3_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,OAAP,KAAkB,QAAlB,IAA+B,OAAO,MAAP,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EAA+B,OAAA,CAAQ,IAAR,CAA/B,EADJ;KAAA,MAEK,IAAG,OAAO,MAAP,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,EAAW,IAAX,CAAP,EAAyB,WAAzB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAAoB,EAApB,EAJC;;EAHQ;;EASjB,cAAA,CAAe,SA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C;MAEA,WAAA,EAAa,WAAA,CAAY;QAAA,IAAA,EAAM,KAAN;OAAZ,CAFb;MAGA,mBAAA,EAAqB,WAAA,CAAY;QAAA,IAAA,EAAM,KAAN;QAAa,OAAA,EAAS,IAAtB;OAAZ,CAHrB;MAIA,YAAA,EAAc,WAAA,CAAA,CAJd;MAKA,YAAA,EAAc,WAAA,CAAY;QAAA,IAAA,EAAM,MAAN;QAAc,OAAA,EAAS,IAAvB;OAAZ,CALd;MAMA,eAAA,EAAiB,WAAA,CAAY;QAAA,IAAA,EAAM,SAAN;OAAZ,CANjB;;EAlKO,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"c3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"c3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, c3\n\ncallWithJQuery ($, c3) ->\n\n makeC3Chart = (chartOpts = {}) -> (pivotData, opts) ->\n defaults =\n localeStrings: {vs: \"vs\", by: \"by\"}\n c3: {}\n\n opts = $.extend(true, {}, defaults, opts)\n opts.c3.size ?= {}\n opts.c3.size.width ?= window.innerWidth / 1.4\n opts.c3.size.height ?= window.innerHeight / 1.4 - 50\n chartOpts.type ?= \"line\"\n chartOpts.horizontal ?= false\n chartOpts.stacked ?= false\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n\n headers = (h.join(\"-\") for h in colKeys)\n rotationAngle = 0\n\n fullAggName = pivotData.aggregatorName\n if pivotData.valAttrs.length\n fullAggName += \"(#{pivotData.valAttrs.join(\", \")})\"\n\n if chartOpts.type == \"scatter\"\n scatterData = x:{}, y:{}, t:{}\n attrs = pivotData.rowAttrs.concat(pivotData.colAttrs)\n vAxisTitle = attrs[0] ? \"\"\n hAxisTitle = attrs[1] ? \"\"\n groupByTitle = attrs.slice(2).join(\"-\")\n titleText = vAxisTitle\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n for rowKey in rowKeys\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n vals = rowKey.concat(colKey)\n series = vals.slice(2).join(\"-\")\n if series == \"\" then series = \"series\"\n scatterData.x[series] ?= []\n scatterData.y[series] ?= []\n scatterData.t[series] ?= []\n scatterData.y[series].push vals[0] ? 0\n scatterData.x[series].push vals[1] ? 0\n scatterData.t[series].push agg.value()\n else\n numCharsInHAxis = 0\n for x in headers\n numCharsInHAxis += x.length\n if numCharsInHAxis > 50\n rotationAngle = 45\n\n columns = []\n for rowKey in rowKeys\n rowHeader = rowKey.join(\"-\")\n row = [if rowHeader == \"\" then fullAggName else rowHeader]\n for colKey in colKeys\n val = parseFloat pivotData.getAggregator(rowKey, colKey).value()\n if isFinite(val)\n row.push(val)\n else\n row.push(null)\n columns.push row\n\n vAxisTitle = fullAggName\n\n if chartOpts.horizontal\n hAxisTitle = pivotData.rowAttrs.join(\"-\")\n groupByTitle = pivotData.colAttrs.join(\"-\")\n else\n hAxisTitle = pivotData.colAttrs.join(\"-\")\n groupByTitle = pivotData.rowAttrs.join(\"-\")\n titleText = fullAggName\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n\n title = $(\"

\", {style: \"text-align: center; font-weight: bold\"})\n title.text(titleText)\n\n formatter = pivotData.getAggregator([], []).format\n\n params =\n axis:\n rotated: chartOpts.horizontal\n y:\n label: vAxisTitle\n tick: {}\n x:\n label: hAxisTitle\n tick:\n rotate: rotationAngle\n multiline: false\n data:\n type: chartOpts.type\n order: null\n tooltip:\n grouped: false\n color:\n pattern: [ \"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\",\n \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\",\n \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\",\n \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\",\n \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\" ]\n\n\n params = $.extend(true, {}, params, opts.c3)\n if chartOpts.type == \"scatter\"\n xs = {}\n numSeries = 0\n dataColumns = []\n for s of scatterData.x\n numSeries += 1\n xs[s] = s+\"_x\"\n dataColumns.push [s+\"_x\"].concat(scatterData.x[s])\n dataColumns.push [s].concat(scatterData.y[s])\n params.data.xs = xs\n params.data.columns = dataColumns\n params.axis.x.tick = fit: false\n if numSeries == 1\n params.legend = show: false\n params.tooltip.format =\n title: -> fullAggName\n name: -> \"\"\n value: (a,b,c,d) -> formatter(scatterData.t[c][d])\n else\n params.axis.x.type= 'category'\n params.axis.y.tick.format ?= (v) -> formatter(v)\n params.tooltip.format = value: (v) -> formatter(v)\n\n if chartOpts.horizontal\n categories = (c.shift() for c in columns)\n if categories.length == 1 and categories[0] == fullAggName\n categories = [\"\"]\n params.axis.x.categories = categories\n if headers.length == 1 and headers[0] == \"\"\n headers = [fullAggName]\n columns.unshift(headers)\n params.data.rows = columns\n else\n params.axis.x.categories = headers\n params.data.columns = columns\n\n\n if chartOpts.stacked\n if chartOpts.horizontal\n params.data.groups = [x.join(\"-\") for x in colKeys]\n else\n params.data.groups = [x.join(\"-\") for x in rowKeys]\n\n renderArea = $(\"

\", style: \"display:none;\").appendTo $(\"body\")\n result = $(\"
\").appendTo renderArea\n params.bindto = result[0]\n c3.generate params\n result.detach()\n renderArea.remove()\n return $(\"
\").append title, result\n\n $.pivotUtilities.c3_renderers =\n \"Horizontal Bar Chart\": makeC3Chart(type: \"bar\", horizontal: true)\n \"Horizontal Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true, horizontal: true)\n \"Bar Chart\": makeC3Chart(type: \"bar\")\n \"Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true)\n \"Line Chart\": makeC3Chart()\n \"Area Chart\": makeC3Chart(type: \"area\", stacked: true)\n \"Scatter Chart\": makeC3Chart(type: \"scatter\")\n"]} \ No newline at end of file diff --git a/dist/c3_renderers.min.js b/dist/c3_renderers.min.js index ba4472ec..3227eb25 100644 --- a/dist/c3_renderers.min.js +++ b/dist/c3_renderers.min.js @@ -1,2 +1,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 o,l,i,c,s,u,h,g,p,d,f,y,x,v,b,j,z,m,w,k,A,C,S,q,B,H,_,F,K,T,L,N,Q,R,U,W,D,E,G,I,J,M,O,P,V,X,Y,Z,$,tt,et,nt,rt,at,ot,lt;if(j={localeStrings:{vs:"vs",by:"by"},c3:{}},a=t.extend(!0,{},j,a),null==(i=a.c3).size&&(i.size={}),null==(c=a.c3.size).width&&(c.width=window.innerWidth/1.4),null==(s=a.c3.size).height&&(s.height=window.innerHeight/1.4-50),null==n.type&&(n.type="line"),null==n.horizontal&&(n.horizontal=!1),null==n.stacked&&(n.stacked=!1),X=r.getRowKeys(),0===X.length&&X.push([]),x=r.getColKeys(),0===x.length&&x.push([]),C=function(){var t,e,n;for(n=[],t=0,e=x.length;e>t;t++)k=x[t],n.push(k.join("-"));return n}(),M=0,m=r.aggregatorName,r.valAttrs.length&&(m+="("+r.valAttrs.join(", ")+")"),"scatter"===n.type)for(Z={x:{},y:{},t:{}},l=r.rowAttrs.concat(r.colAttrs),nt=null!=(W=l[0])?W:"",A=null!=(D=l[1])?D:"",w=l.slice(2).join("-"),et=nt,""!==A&&(et+=" "+a.localeStrings.vs+" "+A),""!==w&&(et+=" "+a.localeStrings.by+" "+w),S=0,_=X.length;_>S;S++)for(V=X[S],q=0,F=x.length;F>q;q++)y=x[q],o=r.getAggregator(V,y),null!=o.value()&&(at=V.concat(y),$=at.slice(2).join("-"),""===$&&($="series"),null==(u=Z.x)[$]&&(u[$]=[]),null==(h=Z.y)[$]&&(h[$]=[]),null==(g=Z.t)[$]&&(g[$]=[]),Z.y[$].push(null!=(E=at[0])?E:0),Z.x[$].push(null!=(G=at[1])?G:0),Z.t[$].push(o.value()));else{for(Q=0,B=0,K=C.length;K>B;B++)ot=C[B],Q+=ot.length;for(Q>50&&(M=45),v=[],H=0,T=X.length;T>H;H++){for(V=X[H],P=V.join("-"),O=[""===P?m:P],N=0,L=x.length;L>N;N++)y=x[N],rt=parseFloat(r.getAggregator(V,y).value()),O.push(isFinite(rt)?rt:null);v.push(O)}nt=m,n.horizontal?(A=r.rowAttrs.join("-"),w=r.colAttrs.join("-")):(A=r.colAttrs.join("-"),w=r.rowAttrs.join("-")),et=m,""!==A&&(et+=" "+a.localeStrings.vs+" "+A),""!==w&&(et+=" "+a.localeStrings.by+" "+w)}if(tt=t("

",{style:"text-align: center; font-weight: bold"}),tt.text(et),z=r.getAggregator([],[]).format,U={axis:{rotated:n.horizontal,y:{label:nt,tick:{}},x:{label:A,tick:{rotate:M,multiline:!1}}},data:{type:n.type,order:null},tooltip:{grouped:!1},color:{pattern:["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395","#994499","#22aa99","#aaaa11","#6633cc","#e67300","#8b0707","#651067","#329262","#5574a6","#3b3eac"]}},U=t.extend(!0,{},U,a.c3),"scatter"===n.type){lt={},R=0,b=[];for(Y in Z.x)R+=1,lt[Y]=Y+"_x",b.push([Y+"_x"].concat(Z.x[Y])),b.push([Y].concat(Z.y[Y]));U.data.xs=lt,U.data.columns=b,U.axis.x.tick={fit:!1},1===R&&(U.legend={show:!1}),U.tooltip.format={title:function(){return m},name:function(){return""},value:function(t,e,n,r){return z(Z.t[n][r])}}}else U.axis.x.type="category",null==(p=U.axis.y.tick).format&&(p.format=function(t){return z(t)}),U.tooltip.format={value:function(t){return z(t)}},n.horizontal?(f=function(){var t,e,n;for(n=[],e=0,t=v.length;t>e;e++)d=v[e],n.push(d.shift());return n}(),1===f.length&&f[0]===m&&(f=[""]),U.axis.x.categories=f,1===C.length&&""===C[0]&&(C=[m]),v.unshift(C),U.data.rows=v):(U.axis.x.categories=C,U.data.columns=v);return n.stacked&&(U.data.groups=n.horizontal?[function(){var t,e,n;for(n=[],e=0,t=x.length;t>e;e++)ot=x[e],n.push(ot.join("-"));return n}()]:[function(){var t,e,n;for(n=[],e=0,t=X.length;t>e;e++)ot=X[e],n.push(ot.join("-"));return n}()]),I=t("

",{style:"display:none;"}).appendTo(t("body")),J=t("
").appendTo(I),U.bindto=J[0],e.generate(U),J.detach(),I.remove(),t("
").append(tt,J)}},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 \ No newline at end of file +(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,u,c,h,g,p,d,f,y,x,v,b,j,z,m,w,k,A,C,S,q,B,H,_,F,K,T,L,N,Q,R,U,W,D,E,G,I,J,M,O,P,V,X,Y,Z,$,tt,et,nt,rt,at,ot,lt;if(j={localeStrings:{vs:"vs",by:"by"},c3:{}},a=t.extend(!0,{},j,a),null==(i=a.c3).size&&(i.size={}),null==(s=a.c3.size).width&&(s.width=window.innerWidth/1.4),null==(u=a.c3.size).height&&(u.height=window.innerHeight/1.4-50),null==n.type&&(n.type="line"),null==n.horizontal&&(n.horizontal=!1),null==n.stacked&&(n.stacked=!1),X=r.getRowKeys(),0===X.length&&X.push([]),x=r.getColKeys(),0===x.length&&x.push([]),C=function(){var t,e,n;for(n=[],t=0,e=x.length;t50&&(M=45),v=[],H=0,T=X.length;H",{style:"text-align: center; font-weight: bold"}),tt.text(et),z=r.getAggregator([],[]).format,U={axis:{rotated:n.horizontal,y:{label:nt,tick:{}},x:{label:A,tick:{rotate:M,multiline:!1}}},data:{type:n.type,order:null},tooltip:{grouped:!1},color:{pattern:["#3366cc","#dc3912","#ff9900","#109618","#990099","#0099c6","#dd4477","#66aa00","#b82e2e","#316395","#994499","#22aa99","#aaaa11","#6633cc","#e67300","#8b0707","#651067","#329262","#5574a6","#3b3eac"]}},U=t.extend(!0,{},U,a.c3),"scatter"===n.type){lt={},R=0,b=[];for(Y in Z.x)R+=1,lt[Y]=Y+"_x",b.push([Y+"_x"].concat(Z.x[Y])),b.push([Y].concat(Z.y[Y]));U.data.xs=lt,U.data.columns=b,U.axis.x.tick={fit:!1},1===R&&(U.legend={show:!1}),U.tooltip.format={title:function(){return m},name:function(){return""},value:function(t,e,n,r){return z(Z.t[n][r])}}}else U.axis.x.type="category",null==(p=U.axis.y.tick).format&&(p.format=function(t){return z(t)}),U.tooltip.format={value:function(t){return z(t)}},n.horizontal?(f=function(){var t,e,n;for(n=[],e=0,t=v.length;e",{style:"display:none;"}).appendTo(t("body")),J=t("
").appendTo(I),U.bindto=J[0],e.generate(U),J.detach(),I.remove(),t("
").append(tt,J)}},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 diff --git a/dist/c3_renderers.min.js.map b/dist/c3_renderers.min.js.map index dd487af2..336c6471 100644 --- a/dist/c3_renderers.min.js.map +++ b/dist/c3_renderers.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["/source/c3_renderers.coffee","c3_renderers.min.js"],"names":["callWithJQuery","pivotModule","exports","module","require","define","amd","jQuery","c3","$","makeC3Chart","chartOpts","pivotData","opts","agg","attrs","base","base1","base2","base3","base4","base5","base6","c","categories","colKey","colKeys","columns","dataColumns","defaults","formatter","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","localeStrings","vs","by","extend","size","width","window","innerWidth","height","innerHeight","type","horizontal","stacked","getRowKeys","length","push","getColKeys","results","join","aggregatorName","valAttrs","y","t","rowAttrs","concat","colAttrs","slice","getAggregator","value","parseFloat","isFinite","style","text","format","axis","rotated","label","tick","rotate","multiline","data","order","tooltip","grouped","color","pattern","fit","legend","show","name","a","b","d","v","len5","n","shift","unshift","rows","groups","appendTo","bindto","generate","detach","remove","append","pivotUtilities","c3_renderers","Horizontal Bar Chart","Horizontal Stacked Bar Chart","Bar Chart","Stacked Bar Chart","Line Chart","Area Chart","Scatter Chart","call","this"],"mappings":"CAAA,WAAA,GAAAA,IAAAA,EAAiB,SAACC,GACd,MAAqB,gBAAlBC,UAAgD,gBAAjBC,QAC9BF,EAAYG,QAAQ,UAAWA,QAAQ,OAClB,kBAAjBC,SAAgCA,OAAOC,IAC3CD,QAAQ,SAAU,MAAOJ,GAGzBA,EAAYM,OAAQC,MAEb,SAACC,EAAGD,GAEf,GAAAE,ECuRA,ODvRAA,GAAc,SAACC,GCQb,MAHiB,OAAbA,IDLSA,MAAmB,SAACC,EAAWC,GAC1C,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,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is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"c3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"c3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, c3\n\ncallWithJQuery ($, c3) ->\n\n makeC3Chart = (chartOpts = {}) -> (pivotData, opts) ->\n defaults =\n localeStrings: {vs: \"vs\", by: \"by\"}\n c3: {}\n\n opts = $.extend(true, {}, defaults, opts)\n opts.c3.size ?= {}\n opts.c3.size.width ?= window.innerWidth / 1.4\n opts.c3.size.height ?= window.innerHeight / 1.4 - 50\n chartOpts.type ?= \"line\"\n chartOpts.horizontal ?= false\n chartOpts.stacked ?= false\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n\n headers = (h.join(\"-\") for h in colKeys)\n rotationAngle = 0\n\n fullAggName = pivotData.aggregatorName\n if pivotData.valAttrs.length\n fullAggName += \"(#{pivotData.valAttrs.join(\", \")})\"\n\n if chartOpts.type == \"scatter\"\n scatterData = x:{}, y:{}, t:{}\n attrs = pivotData.rowAttrs.concat(pivotData.colAttrs)\n vAxisTitle = attrs[0] ? \"\"\n hAxisTitle = attrs[1] ? \"\"\n groupByTitle = attrs.slice(2).join(\"-\")\n titleText = vAxisTitle\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n for rowKey in rowKeys\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n vals = rowKey.concat(colKey)\n series = vals.slice(2).join(\"-\")\n if series == \"\" then series = \"series\"\n scatterData.x[series] ?= []\n scatterData.y[series] ?= []\n scatterData.t[series] ?= []\n scatterData.y[series].push vals[0] ? 0\n scatterData.x[series].push vals[1] ? 0\n scatterData.t[series].push agg.value()\n else\n numCharsInHAxis = 0\n for x in headers\n numCharsInHAxis += x.length\n if numCharsInHAxis > 50\n rotationAngle = 45\n\n columns = []\n for rowKey in rowKeys\n rowHeader = rowKey.join(\"-\")\n row = [if rowHeader == \"\" then fullAggName else rowHeader]\n for colKey in colKeys\n val = parseFloat pivotData.getAggregator(rowKey, colKey).value()\n if isFinite(val)\n row.push(val)\n else\n row.push(null)\n columns.push row\n\n vAxisTitle = fullAggName\n\n if chartOpts.horizontal\n hAxisTitle = pivotData.rowAttrs.join(\"-\")\n groupByTitle = pivotData.colAttrs.join(\"-\")\n else\n hAxisTitle = pivotData.colAttrs.join(\"-\")\n groupByTitle = pivotData.rowAttrs.join(\"-\")\n titleText = fullAggName\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n\n title = $(\"

\", {style: \"text-align: center; font-weight: bold\"})\n title.text(titleText)\n\n formatter = pivotData.getAggregator([], []).format\n\n params =\n axis:\n rotated: chartOpts.horizontal\n y:\n label: vAxisTitle\n tick: {}\n x:\n label: hAxisTitle\n tick:\n rotate: rotationAngle\n multiline: false\n data:\n type: chartOpts.type\n order: null\n tooltip:\n grouped: false\n color:\n pattern: [ \"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\",\n \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\",\n \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\",\n \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\",\n \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\" ]\n\n\n params = $.extend(true, {}, params, opts.c3)\n if chartOpts.type == \"scatter\"\n xs = {}\n numSeries = 0\n dataColumns = []\n for s of scatterData.x\n numSeries += 1\n xs[s] = s+\"_x\"\n dataColumns.push [s+\"_x\"].concat(scatterData.x[s])\n dataColumns.push [s].concat(scatterData.y[s])\n params.data.xs = xs\n params.data.columns = dataColumns\n params.axis.x.tick = fit: false\n if numSeries == 1\n params.legend = show: false\n params.tooltip.format =\n title: -> fullAggName\n name: -> \"\"\n value: (a,b,c,d) -> formatter(scatterData.t[c][d])\n else\n params.axis.x.type= 'category'\n params.axis.y.tick.format ?= (v) -> formatter(v)\n params.tooltip.format = value: (v) -> formatter(v)\n\n if chartOpts.horizontal\n categories = (c.shift() for c in columns)\n if categories.length == 1 and categories[0] == fullAggName\n categories = [\"\"]\n params.axis.x.categories = categories\n if headers.length == 1 and headers[0] == \"\"\n headers = [fullAggName]\n columns.unshift(headers)\n params.data.rows = columns\n else\n params.axis.x.categories = headers\n params.data.columns = columns\n\n\n if chartOpts.stacked\n if chartOpts.horizontal\n params.data.groups = [x.join(\"-\") for x in colKeys]\n else\n params.data.groups = [x.join(\"-\") for x in rowKeys]\n\n renderArea = $(\"

\", style: \"display:none;\").appendTo $(\"body\")\n result = $(\"
\").appendTo renderArea\n params.bindto = result[0]\n c3.generate params\n result.detach()\n renderArea.remove()\n return $(\"
\").append title, result\n\n $.pivotUtilities.c3_renderers =\n \"Horizontal Bar Chart\": makeC3Chart(type: \"bar\", horizontal: true)\n \"Horizontal Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true, horizontal: true)\n \"Bar Chart\": makeC3Chart(type: \"bar\")\n \"Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true)\n \"Line Chart\": makeC3Chart()\n \"Area Chart\": makeC3Chart(type: \"area\", stacked: true)\n \"Scatter Chart\": makeC3Chart(type: \"scatter\")\n","(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,c,s,u,h,g,p,d,f,y,x,v,b,j,z,m,w,k,A,C,S,q,B,H,_,F,K,T,L,N,Q,R,U,W,D,E,G,I,J,M,O,P,V,X,Y,Z,$,tt,et,nt,rt,at,ot,lt;if(j={localeStrings:{vs:\"vs\",by:\"by\"},c3:{}},a=t.extend(!0,{},j,a),null==(i=a.c3).size&&(i.size={}),null==(c=a.c3.size).width&&(c.width=window.innerWidth/1.4),null==(s=a.c3.size).height&&(s.height=window.innerHeight/1.4-50),null==n.type&&(n.type=\"line\"),null==n.horizontal&&(n.horizontal=!1),null==n.stacked&&(n.stacked=!1),X=r.getRowKeys(),0===X.length&&X.push([]),x=r.getColKeys(),0===x.length&&x.push([]),C=function(){var t,e,n;for(n=[],t=0,e=x.length;e>t;t++)k=x[t],n.push(k.join(\"-\"));return n}(),M=0,m=r.aggregatorName,r.valAttrs.length&&(m+=\"(\"+r.valAttrs.join(\", \")+\")\"),\"scatter\"===n.type)for(Z={x:{},y:{},t:{}},l=r.rowAttrs.concat(r.colAttrs),nt=null!=(W=l[0])?W:\"\",A=null!=(D=l[1])?D:\"\",w=l.slice(2).join(\"-\"),et=nt,\"\"!==A&&(et+=\" \"+a.localeStrings.vs+\" \"+A),\"\"!==w&&(et+=\" \"+a.localeStrings.by+\" \"+w),S=0,_=X.length;_>S;S++)for(V=X[S],q=0,F=x.length;F>q;q++)y=x[q],o=r.getAggregator(V,y),null!=o.value()&&(at=V.concat(y),$=at.slice(2).join(\"-\"),\"\"===$&&($=\"series\"),null==(u=Z.x)[$]&&(u[$]=[]),null==(h=Z.y)[$]&&(h[$]=[]),null==(g=Z.t)[$]&&(g[$]=[]),Z.y[$].push(null!=(E=at[0])?E:0),Z.x[$].push(null!=(G=at[1])?G:0),Z.t[$].push(o.value()));else{for(Q=0,B=0,K=C.length;K>B;B++)ot=C[B],Q+=ot.length;for(Q>50&&(M=45),v=[],H=0,T=X.length;T>H;H++){for(V=X[H],P=V.join(\"-\"),O=[\"\"===P?m:P],N=0,L=x.length;L>N;N++)y=x[N],rt=parseFloat(r.getAggregator(V,y).value()),O.push(isFinite(rt)?rt:null);v.push(O)}nt=m,n.horizontal?(A=r.rowAttrs.join(\"-\"),w=r.colAttrs.join(\"-\")):(A=r.colAttrs.join(\"-\"),w=r.rowAttrs.join(\"-\")),et=m,\"\"!==A&&(et+=\" \"+a.localeStrings.vs+\" \"+A),\"\"!==w&&(et+=\" \"+a.localeStrings.by+\" \"+w)}if(tt=t(\"

\",{style:\"text-align: center; font-weight: bold\"}),tt.text(et),z=r.getAggregator([],[]).format,U={axis:{rotated:n.horizontal,y:{label:nt,tick:{}},x:{label:A,tick:{rotate:M,multiline:!1}}},data:{type:n.type,order:null},tooltip:{grouped:!1},color:{pattern:[\"#3366cc\",\"#dc3912\",\"#ff9900\",\"#109618\",\"#990099\",\"#0099c6\",\"#dd4477\",\"#66aa00\",\"#b82e2e\",\"#316395\",\"#994499\",\"#22aa99\",\"#aaaa11\",\"#6633cc\",\"#e67300\",\"#8b0707\",\"#651067\",\"#329262\",\"#5574a6\",\"#3b3eac\"]}},U=t.extend(!0,{},U,a.c3),\"scatter\"===n.type){lt={},R=0,b=[];for(Y in Z.x)R+=1,lt[Y]=Y+\"_x\",b.push([Y+\"_x\"].concat(Z.x[Y])),b.push([Y].concat(Z.y[Y]));U.data.xs=lt,U.data.columns=b,U.axis.x.tick={fit:!1},1===R&&(U.legend={show:!1}),U.tooltip.format={title:function(){return m},name:function(){return\"\"},value:function(t,e,n,r){return z(Z.t[n][r])}}}else U.axis.x.type=\"category\",null==(p=U.axis.y.tick).format&&(p.format=function(t){return z(t,!0)}),U.tooltip.format={value:function(t){return z(t)}},n.horizontal?(f=function(){var t,e,n;for(n=[],e=0,t=v.length;t>e;e++)d=v[e],n.push(d.shift());return n}(),1===f.length&&f[0]===m&&(f=[\"\"]),U.axis.x.categories=f,1===C.length&&\"\"===C[0]&&(C=[m]),v.unshift(C),U.data.rows=v):(U.axis.x.categories=C,U.data.columns=v);return n.stacked&&(U.data.groups=n.horizontal?[function(){var t,e,n;for(n=[],e=0,t=x.length;t>e;e++)ot=x[e],n.push(ot.join(\"-\"));return n}()]:[function(){var t,e,n;for(n=[],e=0,t=X.length;t>e;e++)ot=X[e],n.push(ot.join(\"-\"));return n}()]),I=t(\"

\",{style:\"display:none;\"}).appendTo(t(\"body\")),J=t(\"
\").appendTo(I),U.bindto=J[0],e.generate(U),J.detach(),I.remove(),t(\"
\").append(tt,J)}},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);\n//# sourceMappingURL=c3_renderers.min.js.map"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["c3_renderers.coffee","c3_renderers.min.js"],"names":["callWithJQuery","pivotModule","exports","module","require","define","amd","jQuery","c3","$","makeC3Chart","chartOpts","pivotData","opts","agg","attrs","base","base1","base2","base3","base4","base5","base6","c","categories","colKey","colKeys","columns","dataColumns","defaults","formatter","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","localeStrings","vs","by","extend","size","width","window","innerWidth","height","innerHeight","type","horizontal","stacked","getRowKeys","length","push","getColKeys","results","join","aggregatorName","valAttrs","y","t","rowAttrs","concat","colAttrs","slice","getAggregator","value","parseFloat","isFinite","style","text","format","axis","rotated","label","tick","rotate","multiline","data","order","tooltip","grouped","color","pattern","fit","legend","show","name","a","b","d","v","len5","n","shift","unshift","rows","groups","appendTo","bindto","generate","detach","remove","append","pivotUtilities","c3_renderers","Horizontal Bar Chart","Horizontal Stacked Bar Chart","Bar Chart","Stacked Bar Chart","Line Chart","Area Chart","Scatter Chart","call","this"],"mappings":"CAAA,WAAA,GAAAA,IAAAA,EA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S8H,OAAOxE,GAAOT,KAEpC7C,EAAE+H,eAAeC,cACbC,uBAAwBhI,GAAYsE,KAAM,MAAOC,YAAY,IAC7D0D,+BAAgCjI,GAAYsE,KAAM,MAAOE,SAAS,EAAMD,YAAY,IACpF2D,YAAalI,GAAYsE,KAAM,QAC/B6D,oBAAqBnI,GAAYsE,KAAM,MAAOE,SAAS,IACvD4D,aAAcpI,IACdqI,aAAcrI,GAAYsE,KAAM,OAAQE,SAAS,IACjD8D,gBAAiBtI,GAAYsE,KAAM,iBC6IxCiE,KAAKC","file":"c3_renderers.min.js","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"c3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"c3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, c3\n\ncallWithJQuery ($, c3) ->\n\n makeC3Chart = (chartOpts = {}) -> (pivotData, opts) ->\n defaults =\n localeStrings: {vs: \"vs\", by: \"by\"}\n c3: {}\n\n opts = $.extend(true, {}, defaults, opts)\n opts.c3.size ?= {}\n opts.c3.size.width ?= window.innerWidth / 1.4\n opts.c3.size.height ?= window.innerHeight / 1.4 - 50\n chartOpts.type ?= \"line\"\n chartOpts.horizontal ?= false\n chartOpts.stacked ?= false\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n\n headers = (h.join(\"-\") for h in colKeys)\n rotationAngle = 0\n\n fullAggName = pivotData.aggregatorName\n if pivotData.valAttrs.length\n fullAggName += \"(#{pivotData.valAttrs.join(\", \")})\"\n\n if chartOpts.type == \"scatter\"\n scatterData = x:{}, y:{}, t:{}\n attrs = pivotData.rowAttrs.concat(pivotData.colAttrs)\n vAxisTitle = attrs[0] ? \"\"\n hAxisTitle = attrs[1] ? \"\"\n groupByTitle = attrs.slice(2).join(\"-\")\n titleText = vAxisTitle\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n for rowKey in rowKeys\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n vals = rowKey.concat(colKey)\n series = vals.slice(2).join(\"-\")\n if series == \"\" then series = \"series\"\n scatterData.x[series] ?= []\n scatterData.y[series] ?= []\n scatterData.t[series] ?= []\n scatterData.y[series].push vals[0] ? 0\n scatterData.x[series].push vals[1] ? 0\n scatterData.t[series].push agg.value()\n else\n numCharsInHAxis = 0\n for x in headers\n numCharsInHAxis += x.length\n if numCharsInHAxis > 50\n rotationAngle = 45\n\n columns = []\n for rowKey in rowKeys\n rowHeader = rowKey.join(\"-\")\n row = [if rowHeader == \"\" then fullAggName else rowHeader]\n for colKey in colKeys\n val = parseFloat pivotData.getAggregator(rowKey, colKey).value()\n if isFinite(val)\n row.push(val)\n else\n row.push(null)\n columns.push row\n\n vAxisTitle = fullAggName\n\n if chartOpts.horizontal\n hAxisTitle = pivotData.rowAttrs.join(\"-\")\n groupByTitle = pivotData.colAttrs.join(\"-\")\n else\n hAxisTitle = pivotData.colAttrs.join(\"-\")\n groupByTitle = pivotData.rowAttrs.join(\"-\")\n titleText = fullAggName\n titleText += \" #{opts.localeStrings.vs} #{hAxisTitle}\" if hAxisTitle != \"\"\n titleText += \" #{opts.localeStrings.by} #{groupByTitle}\" if groupByTitle != \"\"\n\n title = $(\"

\", {style: \"text-align: center; font-weight: bold\"})\n title.text(titleText)\n\n formatter = pivotData.getAggregator([], []).format\n\n params =\n axis:\n rotated: chartOpts.horizontal\n y:\n label: vAxisTitle\n tick: {}\n x:\n label: hAxisTitle\n tick:\n rotate: rotationAngle\n multiline: false\n data:\n type: chartOpts.type\n order: null\n tooltip:\n grouped: false\n color:\n pattern: [ \"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\",\n \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\",\n \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\",\n \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\",\n \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\" ]\n\n\n params = $.extend(true, {}, params, opts.c3)\n if chartOpts.type == \"scatter\"\n xs = {}\n numSeries = 0\n dataColumns = []\n for s of scatterData.x\n numSeries += 1\n xs[s] = s+\"_x\"\n dataColumns.push [s+\"_x\"].concat(scatterData.x[s])\n dataColumns.push [s].concat(scatterData.y[s])\n params.data.xs = xs\n params.data.columns = dataColumns\n params.axis.x.tick = fit: false\n if numSeries == 1\n params.legend = show: false\n params.tooltip.format =\n title: -> fullAggName\n name: -> \"\"\n value: (a,b,c,d) -> formatter(scatterData.t[c][d])\n else\n params.axis.x.type= 'category'\n params.axis.y.tick.format ?= (v) -> formatter(v)\n params.tooltip.format = value: (v) -> formatter(v)\n\n if chartOpts.horizontal\n categories = (c.shift() for c in columns)\n if categories.length == 1 and categories[0] == fullAggName\n categories = [\"\"]\n params.axis.x.categories = categories\n if headers.length == 1 and headers[0] == \"\"\n headers = [fullAggName]\n columns.unshift(headers)\n params.data.rows = columns\n else\n params.axis.x.categories = headers\n params.data.columns = columns\n\n\n if chartOpts.stacked\n if chartOpts.horizontal\n params.data.groups = [x.join(\"-\") for x in colKeys]\n else\n params.data.groups = [x.join(\"-\") for x in rowKeys]\n\n renderArea = $(\"

\", style: \"display:none;\").appendTo $(\"body\")\n result = $(\"
\").appendTo renderArea\n params.bindto = result[0]\n c3.generate params\n result.detach()\n renderArea.remove()\n return $(\"
\").append title, result\n\n $.pivotUtilities.c3_renderers =\n \"Horizontal Bar Chart\": makeC3Chart(type: \"bar\", horizontal: true)\n \"Horizontal Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true, horizontal: true)\n \"Bar Chart\": makeC3Chart(type: \"bar\")\n \"Stacked Bar Chart\": makeC3Chart(type: \"bar\", stacked: true)\n \"Line Chart\": makeC3Chart()\n \"Area Chart\": makeC3Chart(type: \"area\", stacked: true)\n \"Scatter Chart\": makeC3Chart(type: \"scatter\")\n","(function() {\n var callWithJQuery;\n\n callWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") {\n return pivotModule(require(\"jquery\"), require(\"c3\"));\n } else if (typeof define === \"function\" && define.amd) {\n return define([\"jquery\", \"c3\"], pivotModule);\n } else {\n return pivotModule(jQuery, c3);\n }\n };\n\n callWithJQuery(function($, c3) {\n var makeC3Chart;\n makeC3Chart = function(chartOpts) {\n if (chartOpts == null) {\n chartOpts = {};\n }\n return function(pivotData, opts) {\n var agg, attrs, base, base1, base2, base3, base4, base5, base6, c, categories, colKey, colKeys, columns, dataColumns, defaults, formatter, 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;\n defaults = {\n localeStrings: {\n vs: \"vs\",\n by: \"by\"\n },\n c3: {}\n };\n opts = $.extend(true, {}, defaults, opts);\n if ((base = opts.c3).size == null) {\n base.size = {};\n }\n if ((base1 = opts.c3.size).width == null) {\n base1.width = window.innerWidth / 1.4;\n }\n if ((base2 = opts.c3.size).height == null) {\n base2.height = window.innerHeight / 1.4 - 50;\n }\n if (chartOpts.type == null) {\n chartOpts.type = \"line\";\n }\n if (chartOpts.horizontal == null) {\n chartOpts.horizontal = false;\n }\n if (chartOpts.stacked == null) {\n chartOpts.stacked = false;\n }\n rowKeys = pivotData.getRowKeys();\n if (rowKeys.length === 0) {\n rowKeys.push([]);\n }\n colKeys = pivotData.getColKeys();\n if (colKeys.length === 0) {\n colKeys.push([]);\n }\n headers = (function() {\n var i, len, results;\n results = [];\n for (i = 0, len = colKeys.length; i < len; i++) {\n h = colKeys[i];\n results.push(h.join(\"-\"));\n }\n return results;\n })();\n rotationAngle = 0;\n fullAggName = pivotData.aggregatorName;\n if (pivotData.valAttrs.length) {\n fullAggName += \"(\" + (pivotData.valAttrs.join(\", \")) + \")\";\n }\n if (chartOpts.type === \"scatter\") {\n scatterData = {\n x: {},\n y: {},\n t: {}\n };\n attrs = pivotData.rowAttrs.concat(pivotData.colAttrs);\n vAxisTitle = (ref = attrs[0]) != null ? ref : \"\";\n hAxisTitle = (ref1 = attrs[1]) != null ? ref1 : \"\";\n groupByTitle = attrs.slice(2).join(\"-\");\n titleText = vAxisTitle;\n if (hAxisTitle !== \"\") {\n titleText += \" \" + opts.localeStrings.vs + \" \" + hAxisTitle;\n }\n if (groupByTitle !== \"\") {\n titleText += \" \" + opts.localeStrings.by + \" \" + groupByTitle;\n }\n for (i = 0, len = rowKeys.length; i < len; i++) {\n rowKey = rowKeys[i];\n for (j = 0, len1 = colKeys.length; j < len1; j++) {\n colKey = colKeys[j];\n agg = pivotData.getAggregator(rowKey, colKey);\n if (agg.value() != null) {\n vals = rowKey.concat(colKey);\n series = vals.slice(2).join(\"-\");\n if (series === \"\") {\n series = \"series\";\n }\n if ((base3 = scatterData.x)[series] == null) {\n base3[series] = [];\n }\n if ((base4 = scatterData.y)[series] == null) {\n base4[series] = [];\n }\n if ((base5 = scatterData.t)[series] == null) {\n base5[series] = [];\n }\n scatterData.y[series].push((ref2 = vals[0]) != null ? ref2 : 0);\n scatterData.x[series].push((ref3 = vals[1]) != null ? ref3 : 0);\n scatterData.t[series].push(agg.value());\n }\n }\n }\n } else {\n numCharsInHAxis = 0;\n for (k = 0, len2 = headers.length; k < len2; k++) {\n x = headers[k];\n numCharsInHAxis += x.length;\n }\n if (numCharsInHAxis > 50) {\n rotationAngle = 45;\n }\n columns = [];\n for (l = 0, len3 = rowKeys.length; l < len3; l++) {\n rowKey = rowKeys[l];\n rowHeader = rowKey.join(\"-\");\n row = [rowHeader === \"\" ? fullAggName : rowHeader];\n for (m = 0, len4 = colKeys.length; m < len4; m++) {\n colKey = colKeys[m];\n val = parseFloat(pivotData.getAggregator(rowKey, colKey).value());\n if (isFinite(val)) {\n row.push(val);\n } else {\n row.push(null);\n }\n }\n columns.push(row);\n }\n vAxisTitle = fullAggName;\n if (chartOpts.horizontal) {\n hAxisTitle = pivotData.rowAttrs.join(\"-\");\n groupByTitle = pivotData.colAttrs.join(\"-\");\n } else {\n hAxisTitle = pivotData.colAttrs.join(\"-\");\n groupByTitle = pivotData.rowAttrs.join(\"-\");\n }\n titleText = fullAggName;\n if (hAxisTitle !== \"\") {\n titleText += \" \" + opts.localeStrings.vs + \" \" + hAxisTitle;\n }\n if (groupByTitle !== \"\") {\n titleText += \" \" + opts.localeStrings.by + \" \" + groupByTitle;\n }\n }\n title = $(\"

\", {\n style: \"text-align: center; font-weight: bold\"\n });\n title.text(titleText);\n formatter = pivotData.getAggregator([], []).format;\n params = {\n axis: {\n rotated: chartOpts.horizontal,\n y: {\n label: vAxisTitle,\n tick: {}\n },\n x: {\n label: hAxisTitle,\n tick: {\n rotate: rotationAngle,\n multiline: false\n }\n }\n },\n data: {\n type: chartOpts.type,\n order: null\n },\n tooltip: {\n grouped: false\n },\n color: {\n pattern: [\"#3366cc\", \"#dc3912\", \"#ff9900\", \"#109618\", \"#990099\", \"#0099c6\", \"#dd4477\", \"#66aa00\", \"#b82e2e\", \"#316395\", \"#994499\", \"#22aa99\", \"#aaaa11\", \"#6633cc\", \"#e67300\", \"#8b0707\", \"#651067\", \"#329262\", \"#5574a6\", \"#3b3eac\"]\n }\n };\n params = $.extend(true, {}, params, opts.c3);\n if (chartOpts.type === \"scatter\") {\n xs = {};\n numSeries = 0;\n dataColumns = [];\n for (s in scatterData.x) {\n numSeries += 1;\n xs[s] = s + \"_x\";\n dataColumns.push([s + \"_x\"].concat(scatterData.x[s]));\n dataColumns.push([s].concat(scatterData.y[s]));\n }\n params.data.xs = xs;\n params.data.columns = dataColumns;\n params.axis.x.tick = {\n fit: false\n };\n if (numSeries === 1) {\n params.legend = {\n show: false\n };\n }\n params.tooltip.format = {\n title: function() {\n return fullAggName;\n },\n name: function() {\n return \"\";\n },\n value: function(a, b, c, d) {\n return formatter(scatterData.t[c][d]);\n }\n };\n } else {\n params.axis.x.type = 'category';\n if ((base6 = params.axis.y.tick).format == null) {\n base6.format = function(v) {\n return formatter(v);\n };\n }\n params.tooltip.format = {\n value: function(v) {\n return formatter(v);\n }\n };\n if (chartOpts.horizontal) {\n categories = (function() {\n var len5, n, results;\n results = [];\n for (n = 0, len5 = columns.length; n < len5; n++) {\n c = columns[n];\n results.push(c.shift());\n }\n return results;\n })();\n if (categories.length === 1 && categories[0] === fullAggName) {\n categories = [\"\"];\n }\n params.axis.x.categories = categories;\n if (headers.length === 1 && headers[0] === \"\") {\n headers = [fullAggName];\n }\n columns.unshift(headers);\n params.data.rows = columns;\n } else {\n params.axis.x.categories = headers;\n params.data.columns = columns;\n }\n }\n if (chartOpts.stacked) {\n if (chartOpts.horizontal) {\n params.data.groups = [\n (function() {\n var len5, n, results;\n results = [];\n for (n = 0, len5 = colKeys.length; n < len5; n++) {\n x = colKeys[n];\n results.push(x.join(\"-\"));\n }\n return results;\n })()\n ];\n } else {\n params.data.groups = [\n (function() {\n var len5, n, results;\n results = [];\n for (n = 0, len5 = rowKeys.length; n < len5; n++) {\n x = rowKeys[n];\n results.push(x.join(\"-\"));\n }\n return results;\n })()\n ];\n }\n }\n renderArea = $(\"

\", {\n style: \"display:none;\"\n }).appendTo($(\"body\"));\n result = $(\"
\").appendTo(renderArea);\n params.bindto = result[0];\n c3.generate(params);\n result.detach();\n renderArea.remove();\n return $(\"
\").append(title, result);\n };\n };\n return $.pivotUtilities.c3_renderers = {\n \"Horizontal Bar Chart\": makeC3Chart({\n type: \"bar\",\n horizontal: true\n }),\n \"Horizontal Stacked Bar Chart\": makeC3Chart({\n type: \"bar\",\n stacked: true,\n horizontal: true\n }),\n \"Bar Chart\": makeC3Chart({\n type: \"bar\"\n }),\n \"Stacked Bar Chart\": makeC3Chart({\n type: \"bar\",\n stacked: true\n }),\n \"Line Chart\": makeC3Chart(),\n \"Area Chart\": makeC3Chart({\n type: \"area\",\n stacked: true\n }),\n \"Scatter Chart\": makeC3Chart({\n type: \"scatter\"\n })\n };\n });\n\n}).call(this);\n\n//# sourceMappingURL=c3_renderers.js.map\n"]} \ No newline at end of file diff --git a/dist/d3_renderers.js b/dist/d3_renderers.js index 1e6e3da2..bc3bd8f4 100644 --- a/dist/d3_renderers.js +++ b/dist/d3_renderers.js @@ -102,4 +102,4 @@ }).call(this); -//# sourceMappingURL=d3_renderers.js.map \ No newline at end of file +//# sourceMappingURL=d3_renderers.js.map diff --git a/dist/d3_renderers.js.map b/dist/d3_renderers.js.map index e7ed02f8..91018fdb 100644 --- a/dist/d3_renderers.js.map +++ b/dist/d3_renderers.js.map @@ -1 +1 @@ -{"version":3,"sources":["d3_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;;AAAA,EAAA,cAAA,GAAiB,SAAC,WAAD,GAAA;AACb,IAAA,IAAG,MAAA,CAAA,OAAA,KAAkB,QAAlB,IAA+B,MAAA,CAAA,MAAA,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EAA+B,OAAA,CAAQ,IAAR,CAA/B,EADJ;KAAA,MAEK,IAAG,MAAA,CAAA,MAAA,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,EAAW,IAAX,CAAP,EAAyB,WAAzB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAAoB,EAApB,EAJC;KAHQ;EAAA,CAAjB,CAAA;;AAAA,EASA,cAAA,CAAe,SAAC,CAAD,EAAI,EAAJ,GAAA;WAEX,CAAC,CAAC,cAAc,CAAC,YAAjB,GAAgC;AAAA,MAAA,OAAA,EAAS,SAAC,SAAD,EAAY,IAAZ,GAAA;AACrC,YAAA,4FAAA;AAAA,QAAA,QAAA,GACI;AAAA,UAAA,aAAA,EAA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C,KAA5B,CAAmC,SAAC,CAAD,GAAA;iBAAO,CAAC,CAAC,MAAT;QAAA,CAAnC,CAAmD,CAAC,KANlE,CAOI,CAAC,KAPL,CAAA,CAOY,CAAC,MAPb,CAOoB,KAPpB,CAQI,CAAC,IARL,CAQU,OARV,EAQmB,MARnB,CASI,CAAC,KATL,CASW,YATX,EASyB,SAAC,CAAD,GAAA;AAAO,UAAA,IAAG,kBAAH;mBAAoB,YAApB;WAAA,MAAA;mBAAqC,KAAA,CAAM,CAAC,CAAC,IAAR,EAArC;WAAP;QAAA,CATzB,CAUI,CAAC,IAVL,CAUW,SAAC,CAAD,GAAA;iBAAO,CAAC,CAAC,KAAT;QAAA,CAVX,CAWI,CAAC,IAXL,CAWU,SAAA,GAAA;AACE,UAAA,IAAI,CAAC,KAAL,CAAW,MAAX,EAAoB,SAAC,CAAD,GAAA;mBAAO,CAAC,CAAC,CAAF,GAAI,KAAX;UAAA,CAApB,CACI,CAAC,KADL,CACW,KADX,EACoB,SAAC,CAAD,GAAA;mBAAO,CAAC,CAAC,CAAF,GAAI,KAAX;UAAA,CADpB,CAEI,CAAC,KAFL,CAEW,OAFX,EAEoB,SAAC,CAAD,GAAA;mBAAO,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAC,CAAC,EAAF,GAAO,CAAnB,CAAA,GAAsB,KAA7B;UAAA,CAFpB,CAGI,CAAC,KAHL,CAGW,QAHX,EAGoB,SAAC,CAAD,GAAA;mBAAO,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAC,CAAC,EAAF,GAAO,CAAnB,CAAA,GAAsB,KAA7B;UAAA,CAHpB,CAAA,CADF;QAAA,CAXV,CAvCA,CAAA;AAyDA,eAAO,MAAP,CA1DqC;MAAA,CAAT;MAFrB;EAAA,CAAf,CATA,CAAA;AAAA","file":"d3_renderers.js","sourceRoot":"/source/","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n\n d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n\n\n\n"]} \ No newline at end of file +{"version":3,"file":"d3_renderers.js","sources":["d3_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,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EAAM,CAAN,EAAQ,CAAR,CAAhB,CAA2B,CAAC,KAA5B,CAAmC,SAAC,CAAD;iBAAO,CAAC,CAAC;QAAT,CAAnC,CAAmD,CAAC,KANlE,CAOI,CAAC,KAPL,CAAA,CAOY,CAAC,MAPb,CAOoB,KAPpB,CAQI,CAAC,IARL,CAQU,OARV,EAQmB,MARnB,CASI,CAAC,KATL,CASW,YATX,EASyB,SAAC,CAAD;UAAO,IAAG,kBAAH;mBAAoB,YAApB;WAAA,MAAA;mBAAqC,KAAA,CAAM,CAAC,CAAC,IAAR,EAArC;;QAAP,CATzB,CAUI,CAAC,IAVL,CAUW,SAAC,CAAD;iBAAO,CAAC,CAAC;QAAT,CAVX,CAWI,CAAC,IAXL,CAWU,SAAA;UACE,IAAI,CAAC,KAAL,CAAW,MAAX,EAAoB,SAAC,CAAD;mBAAO,CAAC,CAAC,CAAF,GAAI;UAAX,CAApB,CACI,CAAC,KADL,CACW,KADX,EACoB,SAAC,CAAD;mBAAO,CAAC,CAAC,CAAF,GAAI;UAAX,CADpB,CAEI,CAAC,KAFL,CAEW,OAFX,EAEoB,SAAC,CAAD;mBAAO,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAC,CAAC,EAAF,GAAO,CAAnB,CAAA,GAAsB;UAA7B,CAFpB,CAGI,CAAC,KAHL,CAGW,QAHX,EAGoB,SAAC,CAAD;mBAAO,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAC,CAAC,EAAF,GAAO,CAAnB,CAAA,GAAsB;UAA7B,CAHpB;QADF,CAXV;AAkBA,eAAO;MA1D8B,CAAT;;EAFrB,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n\n d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n\n\n\n"]} \ No newline at end of file diff --git a/dist/d3_renderers.min.js b/dist/d3_renderers.min.js index 51bbc1a1..00709080 100644 --- a/dist/d3_renderers.min.js +++ b/dist/d3_renderers.min.js @@ -1,2 +1,2 @@ -(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery"),require("d3")):"function"==typeof define&&define.amd?define(["jquery","d3"],e):e(jQuery,d3)})(function(e,t){return e.pivotUtilities.d3_renderers={Treemap:function(n,i){var r,u,l,d,o,a,c,h,f,s,p,y,g;for(l={localeStrings:{},d3:{width:function(){return e(window).width()/1.4},height:function(){return e(window).height()/1.4}}},i=e.extend(!0,{},l,i),h=e("
").css({width:"100%",height:"100%"}),s={name:"All",children:[]},r=function(e,t,n){var i,u,l,d,o,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),a=t.shift(),o=e.children,u=0,l=o.length;l>u;u++)if(i=o[u],i.name===a)return void r(i,t,n);return d={name:a},r(d,t,n),e.children.push(d)},c=n.getRowKeys(),o=0,a=c.length;a>o;o++)f=c[o],y=n.getAggregator(f,[]).value(),null!=y&&r(s,f,y);return u=t.scale.category10(),g=i.d3.width(),d=i.d3.height(),p=t.layout.treemap().size([g,d]).sticky(!0).value(function(e){return e.size}),t.select(h[0]).append("div").style("position","relative").style("width",g+"px").style("height",d+"px").datum(s).selectAll(".node").data(p.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":u(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"})}),h}}})}).call(this); -//# sourceMappingURL=d3_renderers.min.js.map \ No newline at end of file +(function(){var e;(e=function(e){return"object"==typeof exports&&"object"==typeof module?e(require("jquery"),require("d3")):"function"==typeof define&&define.amd?define(["jquery","d3"],e):e(jQuery,d3)})(function(e,t){return e.pivotUtilities.d3_renderers={Treemap:function(n,i){var r,u,l,d,o,a,c,h,f,s,p,y,g;for(l={localeStrings:{},d3:{width:function(){return e(window).width()/1.4},height:function(){return e(window).height()/1.4}}},i=e.extend(!0,{},l,i),h=e("
").css({width:"100%",height:"100%"}),s={name:"All",children:[]},r=function(e,t,n){var i,u,l,d,o,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),a=t.shift(),o=e.children,u=0,l=o.length;u\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n\n d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n\n\n\n","(function(){var e;(e=function(e){return\"object\"==typeof exports&&\"object\"==typeof module?e(require(\"jquery\"),require(\"d3\")):\"function\"==typeof define&&define.amd?define([\"jquery\",\"d3\"],e):e(jQuery,d3)})(function(e,t){return e.pivotUtilities.d3_renderers={Treemap:function(n,i){var r,u,l,d,o,a,c,h,f,s,p,y,g;for(l={localeStrings:{},d3:{width:function(){return e(window).width()/1.4},height:function(){return e(window).height()/1.4}}},i=e.extend(!0,{},l,i),h=e(\"
\").css({width:\"100%\",height:\"100%\"}),s={name:\"All\",children:[]},r=function(e,t,n){var i,u,l,d,o,a;if(0===t.length)return void(e.value=n);for(null==e.children&&(e.children=[]),a=t.shift(),o=e.children,u=0,l=o.length;l>u;u++)if(i=o[u],i.name===a)return void r(i,t,n);return d={name:a},r(d,t,n),e.children.push(d)},c=n.getRowKeys(),o=0,a=c.length;a>o;o++)f=c[o],y=n.getAggregator(f,[]).value(),null!=y&&r(s,f,y);return u=t.scale.category10(),g=i.d3.width(),d=i.d3.height(),p=t.layout.treemap().size([g,d]).sticky(!0).value(function(e){return e.size}),t.select(h[0]).append(\"div\").style(\"position\",\"relative\").style(\"width\",g+\"px\").style(\"height\",d+\"px\").datum(s).selectAll(\".node\").data(p.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\":u(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\"})}),h}}})}).call(this);\n//# sourceMappingURL=d3_renderers.min.js.map"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["d3_renderers.coffee","d3_renderers.min.js"],"names":["callWithJQuery","pivotModule","exports","module","require","define","amd","jQuery","d3","$","pivotUtilities","d3_renderers","Treemap","pivotData","opts","addToTree","color","defaults","height","i","len","ref","result","rowKey","tree","treemap","value","width","localeStrings","window","extend","css","name","children","path","child","newChild","x","length","shift","push","getRowKeys","getAggregator","scale","category10","layout","size","sticky","d","select","append","style","datum","selectAll","data","padding","nodes","enter","attr","text","call","this","y","Math","max","dx","dy"],"mappings":"CAAA,WAAA,GAAAA,IAAAA,EAAiB,SAACC,GACd,MAAqB,gBAAXC,UAAyC,gBAAVC,QACrCF,EAAYG,QAAQ,UAAWA,QAAQ,OAClB,kBAAVC,SAAyBA,OAAOC,IAC3CD,QAAQ,SAAU,MAAOJ,GAGzBA,EAAYM,OAAQC,MAEb,SAACC,EAAGD,GCKf,MDHAC,GAAEC,eAAeC,cAAeC,QAAS,SAACC,EAAWC,GACjD,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CAyBA,KAzBAV,GACIW,iBACApB,IACImB,MAAO,WCMT,MDNYlB,GAAEoB,QAAQF,QAAU,KAC9BT,OAAQ,WCQV,MDRaT,GAAEoB,QAAQX,SAAW,OAExCJ,EAAOL,EAAEqB,QAAO,KAAUb,EAAUH,GAGpCQ,EAASb,EAAE,SAASsB,KAAIJ,MAAO,OAAQT,OAAQ,SAE/CM,GAAOQ,KAAM,MAAOC,aACpBlB,EAAY,SAACS,EAAMU,EAAMR,GACrB,GAAAS,GAAAhB,EAAAC,EAAAgB,EAAAf,EAAAgB,CAAA,IAAkB,IAAfH,EAAKI,OAEJ,YADAd,EAAKE,MAAQA,EAIjB,KCamB,MAAjBF,EAAKS,WDfPT,EAAKS,aACLI,EAAIH,EAAKK,QACTlB,EAAAG,EAAAS,SAAAd,EAAA,EAAAC,EAAAC,EAAAiB,OAAAnB,EAAAC,EAAAD,ICoBA,GADAgB,EAAQd,EAAIF,GDnBoBgB,EAAMH,OAAQK,EAE1C,WADAtB,GAAUoB,EAAOD,EAAMR,EC6B7B,OD3BEU,IAAWJ,KAAMK,GACjBtB,EAAUqB,EAAUF,EAAMR,GAC1BF,EAAKS,SAASO,KAAKJ,IAEvBf,EAAAR,EAAA4B,aAAAtB,EAAA,EAAAC,EAAAC,EAAAiB,OAAAnB,EAAAC,EAAAD,IC2BEI,EAASF,EAAIF,GD1BXO,EAAQb,EAAU6B,cAAcnB,MAAYG,QACzC,MAAAA,GACCX,EAAUS,EAAMD,EAAQG,EA6BhC,OA3BAV,GAAQR,EAAGmC,MAAMC,aACjBjB,EAAQb,EAAKN,GAAGmB,QAChBT,EAASJ,EAAKN,GAAGU,SAEjBO,EAAUjB,EAAGqC,OAAOpB,UACfqB,MAAMnB,EAAOT,IACb6B,QAAO,GACPrB,MAAO,SAACsB,GCyBX,MDzBiBA,GAAEF,OAErBtC,EAAGyC,OAAO3B,EAAO,IACZ4B,OAAO,OACHC,MAAM,WAAY,YAClBA,MAAM,QAASxB,EAAQ,MACvBwB,MAAM,SAAUjC,EAAS,MAC7BkC,MAAM5B,GAAM6B,UAAU,SAClBC,KAAK7B,EAAQ8B,SAAS,GAAG,EAAE,EAAE,IAAI7B,MAAO,SAACsB,GCoBhD,MDpBsDA,GAAEtB,QAAQ8B,OAC7DC,QAAQP,OAAO,OACfQ,KAAK,QAAS,QACdP,MAAM,aAAc,SAACH,GAAM,MAAG,OAAAA,EAAAf,SAAiB,YAAiBjB,EAAMgC,EAAEhB,QACxE2B,KAAM,SAACX,GCwBV,MDxBgBA,GAAEhB,OACf4B,KAAK,WACEC,KAAKV,MAAM,OAAS,SAACH,GCyB7B,MDzBmCA,GAAEX,EAAE,OAC1Bc,MAAM,MAAS,SAACH,GC0B7B,MD1BmCA,GAAEc,EAAE,OAC1BX,MAAM,QAAS,SAACH,GC2B7B,MD3BmCe,MAAKC,IAAI,EAAGhB,EAAEiB,GAAK,GAAG,OAC5Cd,MAAM,SAAS,SAACH,GC4B7B,MD5BmCe,MAAKC,IAAI,EAAGhB,EAAEkB,GAAK,GAAG,SAGtD5C,QCiCZsC,KAAKC","file":"d3_renderers.min.js","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\"), require(\"d3\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\", \"d3\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery, d3\n\ncallWithJQuery ($, d3) ->\n\n $.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->\n defaults =\n localeStrings: {}\n d3:\n width: -> $(window).width() / 1.4\n height: -> $(window).height() / 1.4\n\n opts = $.extend(true, {}, defaults, opts)\n\n\n result = $(\"
\").css(width: \"100%\", height: \"100%\")\n\n tree = name: \"All\", children: []\n addToTree = (tree, path, value) ->\n if path.length == 0\n tree.value = value\n return\n tree.children ?= []\n x = path.shift()\n for child in tree.children when child.name == x\n addToTree(child, path, value)\n return\n newChild = name: x\n addToTree(newChild, path, value)\n tree.children.push newChild\n\n for rowKey in pivotData.getRowKeys()\n value = pivotData.getAggregator(rowKey, []).value()\n if value?\n addToTree(tree, rowKey, value)\n\n color = d3.scale.category10()\n width = opts.d3.width()\n height = opts.d3.height()\n\n treemap = d3.layout.treemap()\n .size([width, height])\n .sticky(true)\n .value( (d) -> d.size )\n\n d3.select(result[0])\n .append(\"div\")\n .style(\"position\", \"relative\")\n .style(\"width\", width + \"px\")\n .style(\"height\", height + \"px\")\n .datum(tree).selectAll(\".node\")\n .data(treemap.padding([15,0,0,0]).value( (d) -> d.value ).nodes)\n .enter().append(\"div\")\n .attr(\"class\", \"node\")\n .style(\"background\", (d) -> if d.children? then \"lightgrey\" else color(d.name) )\n .text( (d) -> d.name )\n .call ->\n this.style(\"left\", (d) -> d.x+\"px\" )\n .style(\"top\", (d) -> d.y+\"px\" )\n .style(\"width\", (d) -> Math.max(0, d.dx - 1)+\"px\" )\n .style(\"height\",(d) -> Math.max(0, d.dy - 1)+\"px\" )\n return\n\n return result\n\n\n\n","(function() {\n var callWithJQuery;\n\n callWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") {\n return pivotModule(require(\"jquery\"), require(\"d3\"));\n } else if (typeof define === \"function\" && define.amd) {\n return define([\"jquery\", \"d3\"], pivotModule);\n } else {\n return pivotModule(jQuery, d3);\n }\n };\n\n callWithJQuery(function($, d3) {\n return $.pivotUtilities.d3_renderers = {\n Treemap: function(pivotData, opts) {\n var addToTree, color, defaults, height, i, len, ref, result, rowKey, tree, treemap, value, width;\n defaults = {\n localeStrings: {},\n d3: {\n width: function() {\n return $(window).width() / 1.4;\n },\n height: function() {\n return $(window).height() / 1.4;\n }\n }\n };\n opts = $.extend(true, {}, defaults, opts);\n result = $(\"
\").css({\n width: \"100%\",\n height: \"100%\"\n });\n tree = {\n name: \"All\",\n children: []\n };\n addToTree = function(tree, path, value) {\n var child, i, len, newChild, ref, x;\n if (path.length === 0) {\n tree.value = value;\n return;\n }\n if (tree.children == null) {\n tree.children = [];\n }\n x = path.shift();\n ref = tree.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n if (!(child.name === x)) {\n continue;\n }\n addToTree(child, path, value);\n return;\n }\n newChild = {\n name: x\n };\n addToTree(newChild, path, value);\n return tree.children.push(newChild);\n };\n ref = pivotData.getRowKeys();\n for (i = 0, len = ref.length; i < len; i++) {\n rowKey = ref[i];\n value = pivotData.getAggregator(rowKey, []).value();\n if (value != null) {\n addToTree(tree, rowKey, value);\n }\n }\n color = d3.scale.category10();\n width = opts.d3.width();\n height = opts.d3.height();\n treemap = d3.layout.treemap().size([width, height]).sticky(true).value(function(d) {\n return d.size;\n });\n d3.select(result[0]).append(\"div\").style(\"position\", \"relative\").style(\"width\", width + \"px\").style(\"height\", height + \"px\").datum(tree).selectAll(\".node\").data(treemap.padding([15, 0, 0, 0]).value(function(d) {\n return d.value;\n }).nodes).enter().append(\"div\").attr(\"class\", \"node\").style(\"background\", function(d) {\n if (d.children != null) {\n return \"lightgrey\";\n } else {\n return color(d.name);\n }\n }).text(function(d) {\n return d.name;\n }).call(function() {\n this.style(\"left\", function(d) {\n return d.x + \"px\";\n }).style(\"top\", function(d) {\n return d.y + \"px\";\n }).style(\"width\", function(d) {\n return Math.max(0, d.dx - 1) + \"px\";\n }).style(\"height\", function(d) {\n return Math.max(0, d.dy - 1) + \"px\";\n });\n });\n return result;\n }\n };\n });\n\n}).call(this);\n\n//# sourceMappingURL=d3_renderers.js.map\n"]} \ No newline at end of file diff --git a/dist/export_renderers.js b/dist/export_renderers.js index 55815066..a8f659a0 100644 --- a/dist/export_renderers.js +++ b/dist/export_renderers.js @@ -77,4 +77,4 @@ }).call(this); -//# sourceMappingURL=export_renderers.js.map \ No newline at end of file +//# sourceMappingURL=export_renderers.js.map diff --git a/dist/export_renderers.js.map b/dist/export_renderers.js.map index 45d1dabc..9440add1 100644 --- a/dist/export_renderers.js.map +++ b/dist/export_renderers.js.map @@ -1 +1 @@ -{"version":3,"sources":["export_renderers.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;;AAAA,EAAA,cAAA,GAAiB,SAAC,WAAD,GAAA;AACb,IAAA,IAAG,MAAA,CAAA,OAAA,KAAkB,QAAlB,IAA+B,MAAA,CAAA,MAAA,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EADJ;KAAA,MAEK,IAAG,MAAA,CAAA,MAAA,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,CAAP,EAAmB,WAAnB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAJC;KAHQ;EAAA,CAAjB,CAAA;;AAAA,EASA,cAAA,CAAe,SAAC,CAAD,GAAA;WAEX,CAAC,CAAC,cAAc,CAAC,gBAAjB,GAAoC;AAAA,MAAA,YAAA,EAAc,SAAC,SAAD,EAAY,IAAZ,GAAA;AAC9C,YAAA,uJAAA;AAAA,QAAA,QAAA,GAAW;AAAA,UAAA,aAAA,EAAe,EAAf;SAAX,CAAA;AAAA,QAEA,IAAA,GAAO,CAAC,CAAC,MAAF,CAAS,IAAT,EAAe,EAAf,EAAmB,QAAnB,EAA6B,IAA7B,CAFP,CAAA;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N,CAAA;AACA,YAAA,IAAG,mBAAH;AACI,cAAA,GAAG,CAAC,IAAJ,CAAS,GAAG,CAAC,KAAJ,CAAA,CAAT,CAAA,CADJ;aAAA,MAAA;AAGI,cAAA,GAAG,CAAC,IAAJ,CAAS,EAAT,CAAA,CAHJ;aAFJ;AAAA,WAJA;AAAA,UAUA,MAAM,CAAC,IAAP,CAAY,GAAZ,CAVA,CADJ;AAAA,SAxBA;AAAA,QAoCA,IAAA,GAAO,EApCP,CAAA;AAqCA,aAAA,0CAAA;wBAAA;AACI,UAAA,IAAA,IAAQ,CAAC,CAAC,IAAF,CAAO,IAAP,CAAA,GAAa,IAArB,CADJ;AAAA,SArCA;AAwCA,eAAO,CAAA,CAAE,YAAF,CAAe,CAAC,IAAhB,CAAqB,IAArB,CAA0B,CAAC,GAA3B,CACC;AAAA,UAAA,KAAA,EAAO,CAAC,CAAA,CAAE,MAAF,CAAS,CAAC,KAAV,CAAA,CAAA,GAAoB,CAArB,CAAA,GAA0B,IAAjC;AAAA,UACA,MAAA,EAAQ,CAAC,CAAA,CAAE,MAAF,CAAS,CAAC,MAAV,CAAA,CAAA,GAAqB,CAAtB,CAAA,GAA2B,IADnC;SADD,CAAP,CAzC8C;MAAA,CAAd;MAFzB;EAAA,CAAf,CATA,CAAA;AAAA","file":"export_renderers.js","sourceRoot":"/source/","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n\n $.pivotUtilities.export_renderers = \"TSV Export\": (pivotData, opts) ->\n defaults = localeStrings: {}\n\n opts = $.extend(true, {}, defaults, opts)\n\n rowKeys = pivotData.getRowKeys()\n rowKeys.push [] if rowKeys.length == 0\n colKeys = pivotData.getColKeys()\n colKeys.push [] if colKeys.length == 0\n rowAttrs = pivotData.rowAttrs\n colAttrs = pivotData.colAttrs\n\n result = []\n\n row = []\n for rowAttr in rowAttrs\n row.push rowAttr\n if colKeys.length == 1 and colKeys[0].length == 0\n row.push pivotData.aggregatorName\n else\n for colKey in colKeys\n row.push colKey.join(\"-\")\n\n result.push row\n\n for rowKey in rowKeys\n row = []\n for r in rowKey\n row.push r\n\n for colKey in colKeys\n agg = pivotData.getAggregator(rowKey, colKey)\n if agg.value()?\n row.push agg.value()\n else\n row.push \"\"\n result.push row\n text = \"\"\n for r in result\n text += r.join(\"\\t\")+\"\\n\"\n\n return $(\"