d3plus-hierarchy
Advanced tools
Comparing version 0.5.0 to 0.6.0
/* | ||
d3plus-hierarchy v0.5.0 | ||
d3plus-hierarchy v0.6.0 | ||
Nested, hierarchical, and cluster charts built on D3 | ||
@@ -499,3 +499,3 @@ Copyright (c) 2018 D3plus - https://d3plus.org | ||
this._padding = 1; | ||
this._layoutPadding = 1; | ||
this._shapeConfig = d3plusCommon.assign({}, this._shapeConfig, { | ||
@@ -534,3 +534,3 @@ labelConfig: { | ||
var tmapData = this._treemap | ||
.padding(this._padding) | ||
.padding(this._layoutPadding) | ||
.size([ | ||
@@ -607,4 +607,4 @@ this._width - this._margin.left - this._margin.right, | ||
*/ | ||
Treemap.prototype.padding = function padding (_) { | ||
return arguments.length ? (this._padding = typeof _ === "function" ? _ : d3plusCommon.constant(_), this) : this._padding; | ||
Treemap.prototype.layoutPadding = function layoutPadding (_) { | ||
return arguments.length ? (this._layoutPadding = typeof _ === "function" ? _ : d3plusCommon.constant(_), this) : this._layoutPadding; | ||
}; | ||
@@ -611,0 +611,0 @@ |
/* | ||
d3plus-hierarchy v0.5.0 | ||
d3plus-hierarchy v0.6.0 | ||
Nested, hierarchical, and cluster charts built on D3 | ||
@@ -7,2 +7,2 @@ Copyright (c) 2018 D3plus - https://d3plus.org | ||
*/ | ||
if(typeof Object.assign!=="function"){Object.defineProperty(Object,"assign",{value:function t(e){"use strict";if(e===null){throw new TypeError("Cannot convert undefined or null to object")}var i=Object(e);for(var r=1;r<arguments.length;r++){var n=arguments[r];if(n!==null){for(var a in n){if(Object.prototype.hasOwnProperty.call(n,a)){i[a]=n[a]}}}}return i},writable:true,configurable:true})}if(!Array.prototype.includes){Object.defineProperty(Array.prototype,"includes",{value:function t(e,i){var r=Object(this);var n=r.length>>>0;if(n===0)return false;var a=i|0;var o=Math.max(a>=0?a:n-Math.abs(a),0);function s(t,e){return t===e||typeof t==="number"&&typeof e==="number"&&isNaN(t)&&isNaN(e)}while(o<n){if(s(r[o],e)){return true}o++}return false}})}(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("d3-array"),require("d3-shape"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz"),require("d3-collection"),require("d3-hierarchy"),require("d3-scale")):typeof define==="function"&&define.amd?define("d3plus-hierarchy",["exports","d3-array","d3-shape","d3plus-common","d3plus-shape","d3plus-viz","d3-collection","d3-hierarchy","d3-scale"],e):e(t.d3plus={},t.d3Array,t.d3Shape,t.d3plusCommon,t.d3plusShape,t.d3plusViz,t.d3Collection,t.d3Hierarchy,t.d3Scale)})(this,function(t,v,l,y,m,e,c,b,x){"use strict";var i=function(u){function t(){u.call(this);this._shapeConfig=y.assign(this._shapeConfig,{Path:{labelConfig:{fontResize:true}}});this._innerRadius=0;this._padPixel=0;this._pie=l.pie();this._sort=function(t,e){return e.value-t.value};this._value=y.accessor("value")}if(u)t.__proto__=u;t.prototype=Object.create(u&&u.prototype);t.prototype.constructor=t;t.prototype._draw=function t(e){var i=this;u.prototype._draw.call(this,e);var r=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right;var a=v.min([n,r])/2;var o=this._pie.padAngle(this._padAngle||this._padPixel/a).sort(this._sort).value(this._value)(this._filteredData);o.forEach(function(t,e){t.__d3plus__=true;t.i=e});var s=l.arc().innerRadius(this._innerRadius).outerRadius(a);var h="translate("+n/2+", "+r/2+")";this._shapes.push((new m.Path).data(o).d(s).select(y.elem("g.d3plus-Pie",{parent:this._select,enter:{transform:h},update:{transform:h}}).node()).config({id:function(t){return i._ids(t).join("-")},x:0,y:0}).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Path")).render());return this};t.prototype.innerRadius=function t(e){return arguments.length?(this._innerRadius=e,this):this._innerRadius};t.prototype.padAngle=function t(e){return arguments.length?(this._padAngle=e,this):this._padAngle};t.prototype.padPixel=function t(e){return arguments.length?(this._padPixel=e,this):this._padPixel};t.prototype.sort=function t(e){return arguments.length?(this._sort=e,this):this._sort};t.prototype.value=function t(e){return arguments.length?(this._value=typeof e==="function"?e:y.constant(e),this):this._value};return t}(e.Viz);var r=function(e){function t(){var t=this;e.call(this);this._innerRadius=function(){return v.min([t._width-t._margin.left-t._margin.right,t._height-t._margin.top-t._margin.bottom])/4};this._padPixel=5}if(e)t.__proto__=e;t.prototype=Object.create(e&&e.prototype);t.prototype.constructor=t;return t}(i);function w(t,e){if(!(e instanceof Array)){e=[e]}var i=c.nest();for(var r=0;r<e.length;r++){i.key(e[r])}var n=i.entries(t);return a(n)}function a(t){return t.map(function(t){if(t.key&&t.values){if(t.values[0].key==="undefined"){return t.values[0].values[0]}else{t.values=a(t.values)}}return t})}var n=function(g){function t(){g.call(this);this._orient="vertical";this._separation=function(t,e){return t.parent===e.parent?1:2};this._shape=y.constant("Circle");this._shapeConfig=y.assign(this._shapeConfig,{labelConfig:{fontColor:"#444"},Path:{fill:"none",stroke:"#ccc",strokeWidth:1},r:y.constant(5),width:y.constant(10),height:y.constant(10)});this._tree=b.tree()}if(g)t.__proto__=g;t.prototype=Object.create(g&&g.prototype);t.prototype.constructor=t;t.prototype._draw=function t(e){var l=this;g.prototype._draw.call(this,e);var i=this._orient==="vertical"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right,o=this._orient==="vertical"?"left":"top",r=this,n="translate("+this._margin.left+", "+this._margin.top+")",s=this._orient==="horizontal"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right;var a=this._tree.separation(this._separation).size([s,i])(b.hierarchy({key:"root",values:w(this._filteredData,this._groupBy.slice(0,this._drawDepth+1))},function(t){return t.key&&t.values?t.values:null}).sort(this._sort)).descendants().filter(function(t){return t.depth<=l._groupBy.length&&t.parent});function h(t){return y.merge(t.values.map(function(t){return t.key&&t.values?h(t):t}),r._aggs)}a.forEach(function(t,e){if(t.data.key&&t.data.values){t.data=h(t.data)}t.__d3plus__=true;t.i=e});var u=this._shapeConfig.r;if(typeof u!=="function"){u=y.constant(u)}var p=v.max(a,function(t){return t.depth===1?u(t.data,t.i):0});var c=v.max(a,function(t){return t.children?0:u(t.data,t.i)});var d=v.extent(a,function(t){return t.y});this._labelHeight=v.min([this._orient==="vertical"?50:100,(d[1]-p-c)/(this._groupBy.length+1)]);this._labelWidths=w(a,function(t){return t.depth}).map(function(a){return a.values.reduce(function(t,e,i){var r=i<a.values.length-1?a.values[i+1].x:s+l._margin[o],n=i?a.values[i-1].x:l._margin[o];return v.min([t,r-e.x,e.x-n])},s)});var _=x.scaleLinear().domain(d).range([p+this._labelHeight,i-c-this._labelHeight]);a.forEach(function(t){var e=_(t.y);if(l._orient==="horizontal"){t.y=t.x;t.x=e}else{t.y=e}});var f={parent:this._select,enter:{transform:n},update:{transform:n}};this._shapes.push((new m.Path).data(a.filter(function(t){return t.depth>1})).select(y.elem("g.d3plus-Tree-Links",f).node()).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Path")).config({d:function(t){var e=l._shapeConfig.r;if(typeof e==="function"){e=e(t.data,t.i)}var i=t.parent.x-t.x+(l._orient==="vertical"?0:e),r=t.parent.y-t.y+(l._orient==="vertical"?e:0),n=l._orient==="vertical"?0:-e,a=l._orient==="vertical"?-e:0;return l._orient==="vertical"?"M"+n+","+a+"C"+n+","+(a+r)/2+" "+i+","+(a+r)/2+" "+i+","+r:"M"+n+","+a+"C"+(n+i)/2+","+a+" "+(n+i)/2+","+r+" "+i+","+r},id:function(t,e){return l._ids(t,e).join("-")}}).render());this._shapes.push((new m.Circle).data(a).select(y.elem("g.d3plus-Tree-Shapes",f).node()).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Circle")).config({id:function(t,e){return l._ids(t,e).join("-")},label:function(t,e){if(l._label){return l._label(t.data,e)}var i=l._ids(t,e).slice(0,t.depth);return i[i.length-1]},labelConfig:{textAnchor:function(t){return l._orient==="vertical"?"middle":t.data.children&&t.data.depth!==l._groupBy.length?"end":"start"},verticalAlign:function(t){return l._orient==="vertical"?t.data.depth===1?"bottom":"top":"middle"}},hitArea:function(t,e,i){var r=l._labelHeight,n=l._labelWidths[t.depth-1];return{width:l._orient==="vertical"?n:i.r*2+n,height:l._orient==="horizontal"?r:i.r*2+r,x:l._orient==="vertical"?-n/2:t.children&&t.depth!==l._groupBy.length?-(i.r+n):-i.r,y:l._orient==="horizontal"?-r/2:t.children&&t.depth!==l._groupBy.length?-(i.r+l._labelHeight):-i.r}},labelBounds:function(t,e,i){var r;var n=l._labelHeight,a=l._orient==="vertical"?"height":"width",o=l._labelWidths[t.depth-1],s=l._orient==="vertical"?"width":"height",h=l._orient==="vertical"?"x":"y",u=l._orient==="vertical"?"y":"x";return r={},r[s]=o,r[a]=n,r[h]=-o/2,r[u]=t.children&&t.depth!==l._groupBy.length?-(i.r+n):i.r,r}}).render());return this};t.prototype.orient=function t(e){return arguments.length?(this._orient=e,this):this._orient};t.prototype.separation=function t(e){return arguments.length?(this._separation=e,this):this._separation};return t}(e.Viz);var o=function(p){function t(){p.call(this);this._padding=1;this._shapeConfig=y.assign({},this._shapeConfig,{labelConfig:{fontMax:20,fontResize:true,padding:15}});this._sort=function(t,e){return e.value-t.value};this._sum=y.accessor("value");this._tile=b.treemapSquarify;this._treemap=b.treemap().round(true)}if(p)t.__proto__=p;t.prototype=Object.create(p&&p.prototype);t.prototype.constructor=t;t.prototype._draw=function t(e){var i=this;p.prototype._draw.call(this,e);var r=c.nest();for(var n=0;n<=this._drawDepth;n++){r.key(i._groupBy[n])}r=r.entries(this._filteredData);var a=this._treemap.padding(this._padding).size([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom]).tile(this._tile)(b.hierarchy({values:r},function(t){return t.values}).sum(this._sum).sort(this._sort));var o=[],s=this;function h(t){for(var e=0;e<t.length;e++){var i=t[e];if(i.depth<=s._drawDepth){h(i.children)}else{i.__d3plus__=true;i.id=i.data.key;i.data=y.merge(i.data.values);i.i=e;i.x=i.x0+(i.x1-i.x0)/2;i.y=i.y0+(i.y1-i.y0)/2;o.push(i)}}}if(a.children){h(a.children)}var u=a.value;var l="translate("+this._margin.left+", "+this._margin.top+")";this._shapes.push((new m.Rect).data(o).label(function(t){return[i._drawLabel(t.data,t.i),Math.round(i._sum(t.data,t.i)/u*100)+"%"]}).select(y.elem("g.d3plus-Treemap",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).config({height:function(t){return t.y1-t.y0},labelBounds:function(t,e,i){var r=i.height;var n=Math.min(50,r*.25);return[{width:i.width,height:r-n,x:-i.width/2,y:-r/2},{width:i.width,height:n,x:-i.width/2,y:r/2-n}]},labelConfig:{textAnchor:function(t){return t.l?"middle":"start"},verticalAlign:function(t){return t.l?"bottom":"top"}},width:function(t){return t.x1-t.x0}}).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Rect")).render());return this};t.prototype.padding=function t(e){return arguments.length?(this._padding=typeof e==="function"?e:y.constant(e),this):this._padding};t.prototype.sort=function t(e){return arguments.length?(this._sort=e,this):this._sort};t.prototype.sum=function t(e){return arguments.length?(this._sum=typeof e==="function"?e:y.accessor(e),this):this._sum};t.prototype.tile=function t(e){return arguments.length?(this._tile=e,this):this._tile};return t}(e.Viz);t.Donut=r;t.Pie=i;t.Tree=n;t.Treemap=o;Object.defineProperty(t,"__esModule",{value:true})}); | ||
if(typeof Object.assign!=="function"){Object.defineProperty(Object,"assign",{value:function t(e){"use strict";if(e===null){throw new TypeError("Cannot convert undefined or null to object")}var i=Object(e);for(var r=1;r<arguments.length;r++){var n=arguments[r];if(n!==null){for(var a in n){if(Object.prototype.hasOwnProperty.call(n,a)){i[a]=n[a]}}}}return i},writable:true,configurable:true})}if(!Array.prototype.includes){Object.defineProperty(Array.prototype,"includes",{value:function t(e,i){var r=Object(this);var n=r.length>>>0;if(n===0)return false;var a=i|0;var o=Math.max(a>=0?a:n-Math.abs(a),0);function s(t,e){return t===e||typeof t==="number"&&typeof e==="number"&&isNaN(t)&&isNaN(e)}while(o<n){if(s(r[o],e)){return true}o++}return false}})}(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("d3-array"),require("d3-shape"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz"),require("d3-collection"),require("d3-hierarchy"),require("d3-scale")):typeof define==="function"&&define.amd?define("d3plus-hierarchy",["exports","d3-array","d3-shape","d3plus-common","d3plus-shape","d3plus-viz","d3-collection","d3-hierarchy","d3-scale"],e):e(t.d3plus={},t.d3Array,t.d3Shape,t.d3plusCommon,t.d3plusShape,t.d3plusViz,t.d3Collection,t.d3Hierarchy,t.d3Scale)})(this,function(t,v,l,y,m,e,c,b,x){"use strict";var i=function(u){function t(){u.call(this);this._shapeConfig=y.assign(this._shapeConfig,{Path:{labelConfig:{fontResize:true}}});this._innerRadius=0;this._padPixel=0;this._pie=l.pie();this._sort=function(t,e){return e.value-t.value};this._value=y.accessor("value")}if(u)t.__proto__=u;t.prototype=Object.create(u&&u.prototype);t.prototype.constructor=t;t.prototype._draw=function t(e){var i=this;u.prototype._draw.call(this,e);var r=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right;var a=v.min([n,r])/2;var o=this._pie.padAngle(this._padAngle||this._padPixel/a).sort(this._sort).value(this._value)(this._filteredData);o.forEach(function(t,e){t.__d3plus__=true;t.i=e});var s=l.arc().innerRadius(this._innerRadius).outerRadius(a);var h="translate("+n/2+", "+r/2+")";this._shapes.push((new m.Path).data(o).d(s).select(y.elem("g.d3plus-Pie",{parent:this._select,enter:{transform:h},update:{transform:h}}).node()).config({id:function(t){return i._ids(t).join("-")},x:0,y:0}).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Path")).render());return this};t.prototype.innerRadius=function t(e){return arguments.length?(this._innerRadius=e,this):this._innerRadius};t.prototype.padAngle=function t(e){return arguments.length?(this._padAngle=e,this):this._padAngle};t.prototype.padPixel=function t(e){return arguments.length?(this._padPixel=e,this):this._padPixel};t.prototype.sort=function t(e){return arguments.length?(this._sort=e,this):this._sort};t.prototype.value=function t(e){return arguments.length?(this._value=typeof e==="function"?e:y.constant(e),this):this._value};return t}(e.Viz);var r=function(e){function t(){var t=this;e.call(this);this._innerRadius=function(){return v.min([t._width-t._margin.left-t._margin.right,t._height-t._margin.top-t._margin.bottom])/4};this._padPixel=5}if(e)t.__proto__=e;t.prototype=Object.create(e&&e.prototype);t.prototype.constructor=t;return t}(i);function w(t,e){if(!(e instanceof Array)){e=[e]}var i=c.nest();for(var r=0;r<e.length;r++){i.key(e[r])}var n=i.entries(t);return a(n)}function a(t){return t.map(function(t){if(t.key&&t.values){if(t.values[0].key==="undefined"){return t.values[0].values[0]}else{t.values=a(t.values)}}return t})}var n=function(g){function t(){g.call(this);this._orient="vertical";this._separation=function(t,e){return t.parent===e.parent?1:2};this._shape=y.constant("Circle");this._shapeConfig=y.assign(this._shapeConfig,{labelConfig:{fontColor:"#444"},Path:{fill:"none",stroke:"#ccc",strokeWidth:1},r:y.constant(5),width:y.constant(10),height:y.constant(10)});this._tree=b.tree()}if(g)t.__proto__=g;t.prototype=Object.create(g&&g.prototype);t.prototype.constructor=t;t.prototype._draw=function t(e){var l=this;g.prototype._draw.call(this,e);var i=this._orient==="vertical"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right,o=this._orient==="vertical"?"left":"top",r=this,n="translate("+this._margin.left+", "+this._margin.top+")",s=this._orient==="horizontal"?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right;var a=this._tree.separation(this._separation).size([s,i])(b.hierarchy({key:"root",values:w(this._filteredData,this._groupBy.slice(0,this._drawDepth+1))},function(t){return t.key&&t.values?t.values:null}).sort(this._sort)).descendants().filter(function(t){return t.depth<=l._groupBy.length&&t.parent});function h(t){return y.merge(t.values.map(function(t){return t.key&&t.values?h(t):t}),r._aggs)}a.forEach(function(t,e){if(t.data.key&&t.data.values){t.data=h(t.data)}t.__d3plus__=true;t.i=e});var u=this._shapeConfig.r;if(typeof u!=="function"){u=y.constant(u)}var p=v.max(a,function(t){return t.depth===1?u(t.data,t.i):0});var c=v.max(a,function(t){return t.children?0:u(t.data,t.i)});var d=v.extent(a,function(t){return t.y});this._labelHeight=v.min([this._orient==="vertical"?50:100,(d[1]-p-c)/(this._groupBy.length+1)]);this._labelWidths=w(a,function(t){return t.depth}).map(function(a){return a.values.reduce(function(t,e,i){var r=i<a.values.length-1?a.values[i+1].x:s+l._margin[o],n=i?a.values[i-1].x:l._margin[o];return v.min([t,r-e.x,e.x-n])},s)});var _=x.scaleLinear().domain(d).range([p+this._labelHeight,i-c-this._labelHeight]);a.forEach(function(t){var e=_(t.y);if(l._orient==="horizontal"){t.y=t.x;t.x=e}else{t.y=e}});var f={parent:this._select,enter:{transform:n},update:{transform:n}};this._shapes.push((new m.Path).data(a.filter(function(t){return t.depth>1})).select(y.elem("g.d3plus-Tree-Links",f).node()).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Path")).config({d:function(t){var e=l._shapeConfig.r;if(typeof e==="function"){e=e(t.data,t.i)}var i=t.parent.x-t.x+(l._orient==="vertical"?0:e),r=t.parent.y-t.y+(l._orient==="vertical"?e:0),n=l._orient==="vertical"?0:-e,a=l._orient==="vertical"?-e:0;return l._orient==="vertical"?"M"+n+","+a+"C"+n+","+(a+r)/2+" "+i+","+(a+r)/2+" "+i+","+r:"M"+n+","+a+"C"+(n+i)/2+","+a+" "+(n+i)/2+","+r+" "+i+","+r},id:function(t,e){return l._ids(t,e).join("-")}}).render());this._shapes.push((new m.Circle).data(a).select(y.elem("g.d3plus-Tree-Shapes",f).node()).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Circle")).config({id:function(t,e){return l._ids(t,e).join("-")},label:function(t,e){if(l._label){return l._label(t.data,e)}var i=l._ids(t,e).slice(0,t.depth);return i[i.length-1]},labelConfig:{textAnchor:function(t){return l._orient==="vertical"?"middle":t.data.children&&t.data.depth!==l._groupBy.length?"end":"start"},verticalAlign:function(t){return l._orient==="vertical"?t.data.depth===1?"bottom":"top":"middle"}},hitArea:function(t,e,i){var r=l._labelHeight,n=l._labelWidths[t.depth-1];return{width:l._orient==="vertical"?n:i.r*2+n,height:l._orient==="horizontal"?r:i.r*2+r,x:l._orient==="vertical"?-n/2:t.children&&t.depth!==l._groupBy.length?-(i.r+n):-i.r,y:l._orient==="horizontal"?-r/2:t.children&&t.depth!==l._groupBy.length?-(i.r+l._labelHeight):-i.r}},labelBounds:function(t,e,i){var r;var n=l._labelHeight,a=l._orient==="vertical"?"height":"width",o=l._labelWidths[t.depth-1],s=l._orient==="vertical"?"width":"height",h=l._orient==="vertical"?"x":"y",u=l._orient==="vertical"?"y":"x";return r={},r[s]=o,r[a]=n,r[h]=-o/2,r[u]=t.children&&t.depth!==l._groupBy.length?-(i.r+n):i.r,r}}).render());return this};t.prototype.orient=function t(e){return arguments.length?(this._orient=e,this):this._orient};t.prototype.separation=function t(e){return arguments.length?(this._separation=e,this):this._separation};return t}(e.Viz);var o=function(p){function t(){p.call(this);this._layoutPadding=1;this._shapeConfig=y.assign({},this._shapeConfig,{labelConfig:{fontMax:20,fontResize:true,padding:15}});this._sort=function(t,e){return e.value-t.value};this._sum=y.accessor("value");this._tile=b.treemapSquarify;this._treemap=b.treemap().round(true)}if(p)t.__proto__=p;t.prototype=Object.create(p&&p.prototype);t.prototype.constructor=t;t.prototype._draw=function t(e){var i=this;p.prototype._draw.call(this,e);var r=c.nest();for(var n=0;n<=this._drawDepth;n++){r.key(i._groupBy[n])}r=r.entries(this._filteredData);var a=this._treemap.padding(this._layoutPadding).size([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom]).tile(this._tile)(b.hierarchy({values:r},function(t){return t.values}).sum(this._sum).sort(this._sort));var o=[],s=this;function h(t){for(var e=0;e<t.length;e++){var i=t[e];if(i.depth<=s._drawDepth){h(i.children)}else{i.__d3plus__=true;i.id=i.data.key;i.data=y.merge(i.data.values);i.i=e;i.x=i.x0+(i.x1-i.x0)/2;i.y=i.y0+(i.y1-i.y0)/2;o.push(i)}}}if(a.children){h(a.children)}var u=a.value;var l="translate("+this._margin.left+", "+this._margin.top+")";this._shapes.push((new m.Rect).data(o).label(function(t){return[i._drawLabel(t.data,t.i),Math.round(i._sum(t.data,t.i)/u*100)+"%"]}).select(y.elem("g.d3plus-Treemap",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).config({height:function(t){return t.y1-t.y0},labelBounds:function(t,e,i){var r=i.height;var n=Math.min(50,r*.25);return[{width:i.width,height:r-n,x:-i.width/2,y:-r/2},{width:i.width,height:n,x:-i.width/2,y:r/2-n}]},labelConfig:{textAnchor:function(t){return t.l?"middle":"start"},verticalAlign:function(t){return t.l?"bottom":"top"}},width:function(t){return t.x1-t.x0}}).config(y.configPrep.bind(this)(this._shapeConfig,"shape","Rect")).render());return this};t.prototype.layoutPadding=function t(e){return arguments.length?(this._layoutPadding=typeof e==="function"?e:y.constant(e),this):this._layoutPadding};t.prototype.sort=function t(e){return arguments.length?(this._sort=e,this):this._sort};t.prototype.sum=function t(e){return arguments.length?(this._sum=typeof e==="function"?e:y.accessor(e),this):this._sum};t.prototype.tile=function t(e){return arguments.length?(this._tile=e,this):this._tile};return t}(e.Viz);t.Donut=r;t.Pie=i;t.Tree=n;t.Treemap=o;Object.defineProperty(t,"__esModule",{value:true})}); |
@@ -18,3 +18,3 @@ import {nest} from "d3-collection"; | ||
this._padding = 1; | ||
this._layoutPadding = 1; | ||
this._shapeConfig = assign({}, this._shapeConfig, { | ||
@@ -53,3 +53,3 @@ labelConfig: { | ||
var tmapData = this._treemap | ||
.padding(this._padding) | ||
.padding(this._layoutPadding) | ||
.size([ | ||
@@ -126,4 +126,4 @@ this._width - this._margin.left - this._margin.right, | ||
*/ | ||
Treemap.prototype.padding = function padding (_) { | ||
return arguments.length ? (this._padding = typeof _ === "function" ? _ : constant(_), this) : this._padding; | ||
Treemap.prototype.layoutPadding = function layoutPadding (_) { | ||
return arguments.length ? (this._layoutPadding = typeof _ === "function" ? _ : constant(_), this) : this._layoutPadding; | ||
}; | ||
@@ -130,0 +130,0 @@ |
{ | ||
"name": "d3plus-hierarchy", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Nested, hierarchical, and cluster charts built on D3", | ||
@@ -5,0 +5,0 @@ "main": "build/d3plus-hierarchy.js", |
@@ -12,3 +12,3 @@ # d3plus-hierarchy | ||
```html | ||
<script src="https://d3plus.org/js/d3plus-hierarchy.v0.5.full.min.js"></script> | ||
<script src="https://d3plus.org/js/d3plus-hierarchy.v0.6.full.min.js"></script> | ||
``` | ||
@@ -223,3 +223,3 @@ | ||
* [new Treemap()](#new_Treemap_new) | ||
* [.padding([*value*])](#Treemap.padding) | ||
* [.layoutPadding([*value*])](#Treemap.layoutPadding) | ||
* [.sort([*comparator*])](#Treemap.sort) | ||
@@ -238,3 +238,3 @@ * [.sum([*value*])](#Treemap.sum) | ||
<a name="Treemap.padding" href="#Treemap.padding">#</a> Treemap.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-hierarchy/blob/master/src/Treemap.js#L124) | ||
<a name="Treemap.layoutPadding" href="#Treemap.layoutPadding">#</a> Treemap.**layoutPadding**([*value*]) [<>](https://github.com/d3plus/d3plus-hierarchy/blob/master/src/Treemap.js#L124) | ||
@@ -302,2 +302,2 @@ If *value* is specified, sets the inner and outer padding accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current padding accessor. | ||
###### <sub>Documentation generated on Fri, 06 Apr 2018 15:16:43 GMT</sub> | ||
###### <sub>Documentation generated on Tue, 10 Apr 2018 19:30:37 GMT</sub> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143291