From a1ab2e7ea3edc7432ce3e56ff7299cacaa8f4f5f Mon Sep 17 00:00:00 2001 From: svpace Date: Fri, 21 Jul 2017 00:46:18 -0300 Subject: [PATCH 1/3] Added CellRenderers --- dist/c3_renderers.js | 2 +- dist/d3_renderers.js | 2 +- dist/d3_renderers.js.map | 2 +- dist/d3_renderers.min.js | 4 +-- dist/d3_renderers.min.js.map | 2 +- dist/export_renderers.js | 2 +- dist/export_renderers.js.map | 2 +- dist/export_renderers.min.js | 4 +-- dist/export_renderers.min.js.map | 2 +- dist/gchart_renderers.js | 2 +- dist/gchart_renderers.js.map | 2 +- dist/gchart_renderers.min.js | 4 +-- dist/gchart_renderers.min.js.map | 2 +- dist/pivot.da.js | 2 +- dist/pivot.da.js.map | 2 +- dist/pivot.da.min.js | 2 +- dist/pivot.da.min.js.map | 2 +- dist/pivot.de.js | 2 +- dist/pivot.de.js.map | 2 +- dist/pivot.de.min.js | 2 +- dist/pivot.de.min.js.map | 2 +- dist/pivot.es.js | 2 +- dist/pivot.es.js.map | 2 +- dist/pivot.es.min.js | 2 +- dist/pivot.es.min.js.map | 2 +- dist/pivot.fr.js | 2 +- dist/pivot.fr.js.map | 2 +- dist/pivot.fr.min.js | 2 +- dist/pivot.fr.min.js.map | 2 +- dist/pivot.it.js | 2 +- dist/pivot.it.js.map | 2 +- dist/pivot.it.min.js | 2 +- dist/pivot.it.min.js.map | 2 +- dist/pivot.js | 37 +++++++++++++++-------- dist/pivot.nl.js | 2 +- dist/pivot.nl.js.map | 2 +- dist/pivot.nl.min.js | 2 +- dist/pivot.nl.min.js.map | 2 +- dist/pivot.pl.js | 2 +- dist/pivot.pl.js.map | 2 +- dist/pivot.pl.min.js | 2 +- dist/pivot.pl.min.js.map | 2 +- dist/pivot.pt.js | 2 +- dist/pivot.ru.js | 2 +- dist/pivot.ru.js.map | 2 +- dist/pivot.ru.min.js | 2 +- dist/pivot.ru.min.js.map | 2 +- dist/pivot.tr.js | 2 +- dist/pivot.tr.js.map | 2 +- dist/pivot.tr.min.js | 2 +- dist/pivot.tr.min.js.map | 2 +- dist/pivot.zh.js | 2 +- dist/pivot.zh.js.map | 2 +- dist/pivot.zh.min.js | 2 +- dist/pivot.zh.min.js.map | 2 +- dist/pivot_spec.js | 26 ++++++++++++++-- examples/blue.png | Bin 0 -> 697 bytes examples/cell_renderer.html | 50 +++++++++++++++++++++++++++++++ examples/red.png | Bin 0 -> 485 bytes src/pivot.coffee | 19 ++++++++---- tests/pivot_spec.coffee | 22 +++++++++++++- 61 files changed, 189 insertions(+), 79 deletions(-) create mode 100644 examples/blue.png create mode 100644 examples/cell_renderer.html create mode 100644 examples/red.png 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/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,IAAg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pB,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,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,SAAC,CAAD,EAAI,EAAJ;WAEX,CAAC,CAAC,cAAc,CAAC,YAAjB,GAAgC;MAAA,OAAA,EAAS,SAAC,SAAD,EAAY,IAAZ;AACrC,YAAA;QAAA,QAAA,GACI;UAAA,aAAA,EAAe,EAAf;UACA,EAAA,EACI;YAAA,KAAA,EAAO,SAAA;qBAAG,CAAA,CAAE,MAAF,CAAS,CAAC,KAAV,CAAA,CAAA,GAAoB;YAAvB,CAAP;YACA,MAAA,EAAQ,SAAA;qBAAG,CAAA,CAAE,MAAF,CAAS,CAAC,MAAV,CAAA,CAAA,GAAqB;YAAxB,CADR;WAFJ;;QAKJ,IAAA,GAAO,CAAC,CAAC,MAAF,CAAS,IAAT,EAAe,EAAf,EAAmB,QAAnB,EAA6B,IAA7B;QAGP,M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,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,OAE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yB7B,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,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ithJQuery = (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 $(\"