Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3plus-hierarchy

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-hierarchy - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

10

build/d3plus-hierarchy.js
/*
d3plus-hierarchy v0.6.1
d3plus-hierarchy v0.6.2
Nested, hierarchical, and cluster charts built on D3

@@ -79,3 +79,5 @@ Copyright (c) 2018 D3plus - https://d3plus.org

function Pie() {
var this$1 = this;
Viz.call(this);

@@ -93,3 +95,3 @@

this._pie = d3Shape.pie();
this._sort = function (a, b) { return b.value - a.value; };
this._sort = function (a, b) { return this$1._value(b) - this$1._value(a); };
this._value = d3plusCommon.accessor("value");

@@ -133,3 +135,3 @@

var transform = "translate(" + (width / 2) + ", " + (height / 2) + ")";
var transform = "translate(" + (width / 2 + this._margin.left) + ", " + (height / 2 + this._margin.top) + ")";
this._shapes.push(new d3plusShape.Path()

@@ -227,3 +229,3 @@ .data(pieData)

]) / 4; };
this._padPixel = 5;
this._padPixel = 2;

@@ -230,0 +232,0 @@ }

4

build/d3plus-hierarchy.min.js
/*
d3plus-hierarchy v0.6.1
d3plus-hierarchy v0.6.2
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.accessor(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})});
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(){var i=this;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 i._value(e)-i._value(t)};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+this._margin.left)+", "+(r/2+this._margin.top)+")";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.accessor(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=2}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 _=v.extent(a,function(t){return t.y});this._labelHeight=v.min([this._orient==="vertical"?50:100,(_[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 d=x.scaleLinear().domain(_).range([p+this._labelHeight,i-c-this._labelHeight]);a.forEach(function(t){var e=d(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})});

@@ -20,3 +20,3 @@ import {min} from "d3-array";

]) / 4; };
this._padPixel = 5;
this._padPixel = 2;

@@ -23,0 +23,0 @@ }

@@ -15,3 +15,5 @@ import {min} from "d3-array";

function Pie() {
var this$1 = this;
Viz.call(this);

@@ -29,3 +31,3 @@

this._pie = pie();
this._sort = function (a, b) { return b.value - a.value; };
this._sort = function (a, b) { return this$1._value(b) - this$1._value(a); };
this._value = accessor("value");

@@ -69,3 +71,3 @@

var transform = "translate(" + (width / 2) + ", " + (height / 2) + ")";
var transform = "translate(" + (width / 2 + this._margin.left) + ", " + (height / 2 + this._margin.top) + ")";
this._shapes.push(new Path()

@@ -72,0 +74,0 @@ .data(pieData)

{
"name": "d3plus-hierarchy",
"version": "0.6.1",
"version": "0.6.2",
"description": "Nested, hierarchical, and cluster charts built on D3",

@@ -31,5 +31,5 @@ "main": "build/d3plus-hierarchy.js",

"d3-shape": "^1.0.3",
"d3plus-common": "^0.6.35",
"d3plus-shape": "^0.14.2",
"d3plus-viz": "^0.11.7"
"d3plus-common": "^0.6.39",
"d3plus-shape": "^0.14.7",
"d3plus-viz": "^0.11.12"
},

@@ -36,0 +36,0 @@ "scripts": {

# d3plus-hierarchy
[![NPM Release](http://img.shields.io/npm/v/d3plus-hierarchy.svg?style=flat)](https://www.npmjs.org/package/d3plus-hierarchy) [![Build Status](https://travis-ci.org/d3plus/d3plus-hierarchy.svg?branch=master)](https://travis-ci.org/d3plus/d3plus-hierarchy) [![Dependency Status](http://img.shields.io/david/d3plus/d3plus-hierarchy.svg?style=flat)](https://david-dm.org/d3plus/d3plus-hierarchy) [![Gitter](https://img.shields.io/badge/-chat_on_gitter-brightgreen.svg?style=flat&logo=gitter-white)](https://gitter.im/d3plus/)
[![NPM Release](http://img.shields.io/npm/v/d3plus-hierarchy.svg?style=flat)](https://www.npmjs.org/package/d3plus-hierarchy) [![Build Status](https://travis-ci.org/d3plus/d3plus-hierarchy.svg?branch=master)](https://travis-ci.org/d3plus/d3plus-hierarchy) [![Dependency Status](http://img.shields.io/david/d3plus/d3plus-hierarchy.svg?style=flat)](https://david-dm.org/d3plus/d3plus-hierarchy) [![Gitter](https://img.shields.io/badge/-chat_on_gitter-brightgreen.svg?style=flat&logo=gitter-white)](https://gitter.im/d3plus/) [![1.0 progress](https://img.shields.io/badge/1.0_progress-0%25-red.svg?style=flat)](https://github.com/d3plus/d3plus-hierarchy/projects/1)

@@ -50,2 +50,3 @@ Nested, hierarchical, and cluster charts built on D3

* [Hiding Tooltip on Click](http://d3plus.org/examples/d3plus-hierarchy/hiding-tooltip-on-click/)
* [Adding Background Images to Shapes](http://d3plus.org/examples/d3plus-hierarchy/background-image/)

@@ -300,2 +301,2 @@ * [Changing Font Styles](http://d3plus.org/examples/d3plus-hierarchy/custom-font/)

###### <sub>Documentation generated on Fri, 20 Apr 2018 18:48:21 GMT</sub>
###### <sub>Documentation generated on Tue, 05 Jun 2018 17:51:10 GMT</sub>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc