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

d3plus-network

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-network - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

6

build/d3plus-network.js
/*
d3plus-network v0.1.1
d3plus-network v0.1.2
Javascript network visualizations built upon d3 modules.

@@ -124,3 +124,3 @@ Copyright (c) 2016 D3plus - https://d3plus.org

var r = scales[("scale" + (this._sizeScale.charAt(0).toUpperCase()) + (this._sizeScale.slice(1)))]()
.domain(rExtent).range([rExtent[0] === rExtent[1] ? rMax : this._sizeMin, rMax]),
.domain(rExtent).range([rExtent[0] === rExtent[1] ? rMax : d3Array.min([rMax / 2, this._sizeMin]), rMax]),
xDomain = x.domain(),

@@ -144,3 +144,3 @@ yDomain = y.domain();

rMax *= d3Array.min([xOldSize / xNewSize, yOldSize / yNewSize]);
r.range([rExtent[0] === rExtent[1] ? rMax : this._sizeMin, rMax]);
r.range([rExtent[0] === rExtent[1] ? rMax : d3Array.min([rMax / 2, this._sizeMin]), rMax]);
x.domain(xDomain);

@@ -147,0 +147,0 @@ y.domain(yDomain);

/*
d3plus-network v0.1.1
d3plus-network v0.1.2
Javascript network visualizations built upon d3 modules.

@@ -7,2 +7,2 @@ Copyright (c) 2016 D3plus - https://d3plus.org

*/
(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?t(exports,require("d3-array"),require("d3-collection"),require("d3-scale"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz")):typeof define==="function"&&define.amd?define("d3plus-network",["exports","d3-array","d3-collection","d3-scale","d3plus-common","d3plus-shape","d3plus-viz"],t):t(e.d3plus=e.d3plus||{},e.d3Array,e.d3Collection,e.scales,e.d3plusCommon,e.shapes,e.d3plusViz)})(this,function(e,t,n,i,r,s,o){"use strict";var a=function(e){function o(){e.call(this);this._links=[];this._nodes=[];this._sizeMin=5;this._sizeScale="sqrt";this._shape=r.constant("Circle");this._shapeConfig=r.assign(this._shapeConfig,{Path:{fill:"none",label:false,stroke:"#eee",strokeWidth:1},textAnchor:"middle",verticalAlign:"middle"});this._x=r.accessor("x");this._y=r.accessor("y")}if(e)o.__proto__=e;o.prototype=Object.create(e&&e.prototype);o.prototype.constructor=o;o.prototype.render=function o(a){var u=this;e.prototype.render.call(this,a);var h=this._height-this._margin.top-this._margin.bottom,c=this._select,f="translate("+this._margin.left+", "+this._margin.top+")",p=this._transition,d=this._width-this._margin.left-this._margin.right;var _=this._filteredData.reduce(function(e,t,n){e[u._id(t,n)]=t;return e},{});var l=this._nodes.reduce(function(e,t,n){e[u._nodeGroupBy?u._nodeGroupBy[u._drawDepth](t,n):u._id(t,n)]=t;return e},{});l=Array.from(new Set(Object.keys(_).concat(Object.keys(l)))).map(function(e,t){var n=_[e],i=l[e];return{__d3plus__:true,data:n||i,i:t,id:e,fx:n!==void 0&&u._x(n)!==void 0?u._x(n):u._x(i),fy:n!==void 0&&u._y(n)!==void 0?u._y(n):u._y(i),node:i,r:u._size?n!==void 0&&u._size(n)!==void 0?u._size(n):u._size(i):1,shape:n!==void 0&&u._shape(n)!==void 0?u._shape(n):u._shape(i)}});var y=t.extent(l.map(function(e){return e.fx})),g=t.extent(l.map(function(e){return e.fy}));var m=i.scaleLinear().domain(y).range([0,d]),v=i.scaleLinear().domain(g).range([0,h]);var x=(y[1]-y[0])/(g[1]-g[0]),z=d/h;if(x>z){var k=h*z/x;v.range([(h-k)/2,h-(h-k)/2])}else{var w=d*x/z;m.range([(d-w)/2,d-(d-w)/2])}l.forEach(function(e){e.x=m(e.fx);e.y=v(e.fy)});var M=t.extent(l.map(function(e){return e.r}));var b=this._sizeMax||t.min(t.merge(l.map(function(e){return l.map(function(t){return e===t?null:s.pointDistance(e,t)})})))/2;var C=i["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(M).range([M[0]===M[1]?b:this._sizeMin,b]),S=m.domain(),q=v.domain();var A=S[1]-S[0],O=q[1]-q[0];l.forEach(function(e){var t=C(e.r);if(S[0]>m.invert(e.x-t)){S[0]=m.invert(e.x-t)}if(S[1]<m.invert(e.x+t)){S[1]=m.invert(e.x+t)}if(q[0]>v.invert(e.y-t)){q[0]=v.invert(e.y-t)}if(q[1]<v.invert(e.y+t)){q[1]=v.invert(e.y+t)}});var j=S[1]-S[0],B=q[1]-q[0];b*=t.min([A/j,O/B]);C.range([M[0]===M[1]?b:this._sizeMin,b]);m.domain(S);v.domain(q);l.forEach(function(e){e.x=m(e.fx);e.fx=e.x;e.y=v(e.fy);e.fy=e.y;e.r=C(e.r);e.width=e.r*2;e.height=e.r*2});var G=l.reduce(function(e,t){e[t.id]=t;return e},{});var P=l.map(function(e){return e.node});var E=this._links.map(function(e){return{source:typeof e.source==="number"?l[P.indexOf(u._nodes[e.source])]:G[e.source.id],target:typeof e.target==="number"?l[P.indexOf(u._nodes[e.target])]:G[e.target.id]}});this._shapes.push((new s.Path).config(this._shapeConfig).config(this._shapeConfig.Path).d(function(e){return"M"+e.source.x+","+e.source.y+" "+e.target.x+","+e.target.y}).data(E).select(r.elem("g.d3plus-network-links",{parent:c,transition:p,enter:{transform:f},update:{transform:f}}).node()).render());var D={label:function(e){return u._drawLabel(e.data||e.node,e.i)},select:r.elem("g.d3plus-network-nodes",{parent:c,transition:p,enter:{transform:f},update:{transform:f}}).node()};n.nest().key(function(e){return e.shape}).entries(l).forEach(function(e){u._shapes.push((new s[e.key]).config(u._shapeConfigPrep(e.key)).config(D).data(e.values).render())});return this};o.prototype.links=function e(t){return arguments.length?(this._links=t,this):this._links};o.prototype.nodeGroupBy=function e(t){var n=this;if(!arguments.length){return this._nodeGroupBy}if(!(t instanceof Array)){t=[t]}return this._nodeGroupBy=t.map(function(e){if(typeof e==="function"){return e}else{if(!n._aggs[e]){n._aggs[e]=function(e){var t=Array.from(new Set(e));return t.length===1?t[0]:t}}return r.accessor(e)}}),this};o.prototype.nodes=function e(t){return arguments.length?(this._nodes=t,this):this._nodes};o.prototype.x=function e(n){if(arguments.length){if(typeof n==="function"){this._x=n}else{this._x=r.accessor(n);if(!this._aggs[n]){this._aggs[n]=function(e){return t.mean(e)}}}return this}else{return this._x}};o.prototype.size=function e(t){return arguments.length?(this._size=typeof t==="function"||!t?t:r.accessor(t),this):this._size};o.prototype.sizeMax=function e(t){return arguments.length?(this._sizeMax=t,this):this._sizeMax};o.prototype.sizeMin=function e(t){return arguments.length?(this._sizeMin=t,this):this._sizeMin};o.prototype.sizeScale=function e(t){return arguments.length?(this._sizeScale=t,this):this._sizeScale};o.prototype.y=function e(n){if(arguments.length){if(typeof n==="function"){this._y=n}else{this._y=r.accessor(n);if(!this._aggs[n]){this._aggs[n]=function(e){return t.mean(e)}}}return this}else{return this._y}};return o}(o.Viz);e.Network=a;Object.defineProperty(e,"__esModule",{value:true})});
(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?t(exports,require("d3-array"),require("d3-collection"),require("d3-scale"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz")):typeof define==="function"&&define.amd?define("d3plus-network",["exports","d3-array","d3-collection","d3-scale","d3plus-common","d3plus-shape","d3plus-viz"],t):t(e.d3plus=e.d3plus||{},e.d3Array,e.d3Collection,e.scales,e.d3plusCommon,e.shapes,e.d3plusViz)})(this,function(e,t,n,i,r,s,o){"use strict";var a=function(e){function o(){e.call(this);this._links=[];this._nodes=[];this._sizeMin=5;this._sizeScale="sqrt";this._shape=r.constant("Circle");this._shapeConfig=r.assign(this._shapeConfig,{Path:{fill:"none",label:false,stroke:"#eee",strokeWidth:1},textAnchor:"middle",verticalAlign:"middle"});this._x=r.accessor("x");this._y=r.accessor("y")}if(e)o.__proto__=e;o.prototype=Object.create(e&&e.prototype);o.prototype.constructor=o;o.prototype.render=function o(a){var u=this;e.prototype.render.call(this,a);var h=this._height-this._margin.top-this._margin.bottom,c=this._select,f="translate("+this._margin.left+", "+this._margin.top+")",p=this._transition,d=this._width-this._margin.left-this._margin.right;var _=this._filteredData.reduce(function(e,t,n){e[u._id(t,n)]=t;return e},{});var l=this._nodes.reduce(function(e,t,n){e[u._nodeGroupBy?u._nodeGroupBy[u._drawDepth](t,n):u._id(t,n)]=t;return e},{});l=Array.from(new Set(Object.keys(_).concat(Object.keys(l)))).map(function(e,t){var n=_[e],i=l[e];return{__d3plus__:true,data:n||i,i:t,id:e,fx:n!==void 0&&u._x(n)!==void 0?u._x(n):u._x(i),fy:n!==void 0&&u._y(n)!==void 0?u._y(n):u._y(i),node:i,r:u._size?n!==void 0&&u._size(n)!==void 0?u._size(n):u._size(i):1,shape:n!==void 0&&u._shape(n)!==void 0?u._shape(n):u._shape(i)}});var y=t.extent(l.map(function(e){return e.fx})),g=t.extent(l.map(function(e){return e.fy}));var m=i.scaleLinear().domain(y).range([0,d]),v=i.scaleLinear().domain(g).range([0,h]);var x=(y[1]-y[0])/(g[1]-g[0]),z=d/h;if(x>z){var k=h*z/x;v.range([(h-k)/2,h-(h-k)/2])}else{var w=d*x/z;m.range([(d-w)/2,d-(d-w)/2])}l.forEach(function(e){e.x=m(e.fx);e.y=v(e.fy)});var M=t.extent(l.map(function(e){return e.r}));var b=this._sizeMax||t.min(t.merge(l.map(function(e){return l.map(function(t){return e===t?null:s.pointDistance(e,t)})})))/2;var C=i["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(M).range([M[0]===M[1]?b:t.min([b/2,this._sizeMin]),b]),S=m.domain(),q=v.domain();var A=S[1]-S[0],O=q[1]-q[0];l.forEach(function(e){var t=C(e.r);if(S[0]>m.invert(e.x-t)){S[0]=m.invert(e.x-t)}if(S[1]<m.invert(e.x+t)){S[1]=m.invert(e.x+t)}if(q[0]>v.invert(e.y-t)){q[0]=v.invert(e.y-t)}if(q[1]<v.invert(e.y+t)){q[1]=v.invert(e.y+t)}});var j=S[1]-S[0],B=q[1]-q[0];b*=t.min([A/j,O/B]);C.range([M[0]===M[1]?b:t.min([b/2,this._sizeMin]),b]);m.domain(S);v.domain(q);l.forEach(function(e){e.x=m(e.fx);e.fx=e.x;e.y=v(e.fy);e.fy=e.y;e.r=C(e.r);e.width=e.r*2;e.height=e.r*2});var G=l.reduce(function(e,t){e[t.id]=t;return e},{});var P=l.map(function(e){return e.node});var E=this._links.map(function(e){return{source:typeof e.source==="number"?l[P.indexOf(u._nodes[e.source])]:G[e.source.id],target:typeof e.target==="number"?l[P.indexOf(u._nodes[e.target])]:G[e.target.id]}});this._shapes.push((new s.Path).config(this._shapeConfig).config(this._shapeConfig.Path).d(function(e){return"M"+e.source.x+","+e.source.y+" "+e.target.x+","+e.target.y}).data(E).select(r.elem("g.d3plus-network-links",{parent:c,transition:p,enter:{transform:f},update:{transform:f}}).node()).render());var D={label:function(e){return u._drawLabel(e.data||e.node,e.i)},select:r.elem("g.d3plus-network-nodes",{parent:c,transition:p,enter:{transform:f},update:{transform:f}}).node()};n.nest().key(function(e){return e.shape}).entries(l).forEach(function(e){u._shapes.push((new s[e.key]).config(u._shapeConfigPrep(e.key)).config(D).data(e.values).render())});return this};o.prototype.links=function e(t){return arguments.length?(this._links=t,this):this._links};o.prototype.nodeGroupBy=function e(t){var n=this;if(!arguments.length){return this._nodeGroupBy}if(!(t instanceof Array)){t=[t]}return this._nodeGroupBy=t.map(function(e){if(typeof e==="function"){return e}else{if(!n._aggs[e]){n._aggs[e]=function(e){var t=Array.from(new Set(e));return t.length===1?t[0]:t}}return r.accessor(e)}}),this};o.prototype.nodes=function e(t){return arguments.length?(this._nodes=t,this):this._nodes};o.prototype.x=function e(n){if(arguments.length){if(typeof n==="function"){this._x=n}else{this._x=r.accessor(n);if(!this._aggs[n]){this._aggs[n]=function(e){return t.mean(e)}}}return this}else{return this._x}};o.prototype.size=function e(t){return arguments.length?(this._size=typeof t==="function"||!t?t:r.accessor(t),this):this._size};o.prototype.sizeMax=function e(t){return arguments.length?(this._sizeMax=t,this):this._sizeMax};o.prototype.sizeMin=function e(t){return arguments.length?(this._sizeMin=t,this):this._sizeMin};o.prototype.sizeScale=function e(t){return arguments.length?(this._sizeScale=t,this):this._sizeScale};o.prototype.y=function e(n){if(arguments.length){if(typeof n==="function"){this._y=n}else{this._y=r.accessor(n);if(!this._aggs[n]){this._aggs[n]=function(e){return t.mean(e)}}}return this}else{return this._y}};return o}(o.Viz);e.Network=a;Object.defineProperty(e,"__esModule",{value:true})});
{
"name": "d3plus-network",
"version": "0.1.1",
"version": "0.1.2",
"description": "Javascript network visualizations built upon d3 modules.",

@@ -30,4 +30,4 @@ "main": "build/d3plus-network.js",

"d3plus-common": "^0.6.9",
"d3plus-shape": "^0.10.5",
"d3plus-viz": "^0.4.10"
"d3plus-shape": "^0.10.8",
"d3plus-viz": "^0.4.11"
},

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

@@ -192,2 +192,2 @@ # d3plus-network

###### <sub>Documentation generated on Thu, 01 Dec 2016 16:49:18 GMT</sub>
###### <sub>Documentation generated on Mon, 05 Dec 2016 04:20:40 GMT</sub>

@@ -120,3 +120,3 @@ import {extent, mean, min, merge} from "d3-array";

const r = scales[`scale${this._sizeScale.charAt(0).toUpperCase()}${this._sizeScale.slice(1)}`]()
.domain(rExtent).range([rExtent[0] === rExtent[1] ? rMax : this._sizeMin, rMax]),
.domain(rExtent).range([rExtent[0] === rExtent[1] ? rMax : min([rMax / 2, this._sizeMin]), rMax]),
xDomain = x.domain(),

@@ -140,3 +140,3 @@ yDomain = y.domain();

rMax *= min([xOldSize / xNewSize, yOldSize / yNewSize]);
r.range([rExtent[0] === rExtent[1] ? rMax : this._sizeMin, rMax]);
r.range([rExtent[0] === rExtent[1] ? rMax : min([rMax / 2, this._sizeMin]), rMax]);
x.domain(xDomain);

@@ -143,0 +143,0 @@ y.domain(yDomain);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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