@d3fc/d3fc-label-layout
Advanced tools
Comparing version 6.0.5 to 6.0.6
@@ -62,9 +62,9 @@ (function (global, factory) { | ||
if (transition) { | ||
update = update.transition(transition); | ||
enter.style('opacity', effectivelyZero).transition(transition).style('opacity', 1); | ||
exit = exit.transition(transition).style('opacity', effectivelyZero).remove(); | ||
} else { | ||
exit.remove(); | ||
update = update.transition(transition).style('opacity', 1); | ||
enter.style('opacity', effectivelyZero); | ||
exit = exit.transition(transition).style('opacity', effectivelyZero); | ||
} | ||
exit.remove(); | ||
update.enter = function () { | ||
@@ -71,0 +71,0 @@ return enter; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-selection"),require("d3-scale")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-selection","d3-scale"],n):n(t.fc=t.fc||{},t.d3,t.d3,t.d3)}(this,function(t,n,r,e){"use strict";var i=function(t){return"function"==typeof t?t:function(){return t}},o=function(t,n){t=t||"g";var r=function(t,n){return n},e=null,i=function(i,o){o=o||function(t){return t};var u=i.selection?i:null;u&&(i=i.selection());var c=i.selectAll(function(t,n,r){return Array.from(r[n].childNodes).filter(function(t){return 1===t.nodeType})}).filter(null==n?t:t+"."+n),a=c.data(o,r),f=a.enter().append(t).attr("class",n),h=a.exit();a=a.merge(f);var l=u||e;return l?(a=a.transition(l),f.style("opacity",1e-6).transition(l).style("opacity",1),h=h.transition(l).style("opacity",1e-6).remove()):h.remove(),a.enter=function(){return f},a.exit=function(){return h},a};return i.element=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i.className=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],i):n},i.key=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i.transition=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i},u=function(t,n,r){var e=n[r];if("function"!=typeof e)throw new Error("Attempt to rebind "+r+" which isn't a function on the source object");return function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];var u=e.apply(n,i);return u===n?t:u}},c=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},a=function(t,n){for(var r=arguments.length,e=Array(r>2?r-2:0),i=2;i<r;i++)e[i-2]=arguments[i];var o=c(e),a=!0,f=!1,h=void 0;try{for(var l,d=Object.keys(n)[Symbol.iterator]();!(a=(l=d.next()).done);a=!0){var g=l.value,y=o(g);y&&(t[y]=u(t,n,g))}}catch(t){f=!0,h=t}finally{try{!a&&d.return&&d.return()}finally{if(f)throw h}}return t},f=function(t){return t.map(function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t})},h=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return n=f(n),function(t){return n.some(function(n){return n.test(t)})&&t}},l=function(t){var n=function(){},u=function(){return[0,0]},c=function(t,n){return[t.x,t.y]},f=t||function(t){return t},l=function(){},d=e.scaleIdentity(),g=e.scaleIdentity(),y=o("g","label"),s=function(t){t.each(function(t,e,i){var o=y(r.select(i[e]),t).call(l),a=o.nodes(),h=a.map(function(t,n){var e=r.select(t).datum(),i=c(e,n,a),o=[d(i[0]),g(i[1])],f=u(e,n,a);return{hidden:!1,x:o[0],y:o[1],width:f[0],height:f[1]}}),s=f(h);o.attr("style",function(t,n){return"display:"+(s[n].hidden?"none":"inherit")}).attr("transform",function(t,n){return"translate("+s[n].x+", "+s[n].y+")"}).attr("layout-width",function(t,n){return s[n].width}).attr("layout-height",function(t,n){return s[n].height}).attr("anchor-x",function(t,n,r){return h[n].x-s[n].x}).attr("anchor-y",function(t,n,r){return h[n].y-s[n].y}),o.call(l),n(o,t,e)})};return a(s,y,h("key")),a(s,f),s.size=function(){return arguments.length?(u=i(arguments.length<=0?void 0:arguments[0]),s):u},s.position=function(){return arguments.length?(c=i(arguments.length<=0?void 0:arguments[0]),s):c},s.component=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],s):l},s.decorate=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],s):n},s.xScale=function(){return arguments.length?(d=arguments.length<=0?void 0:arguments[0],s):d},s.yScale=function(){return arguments.length?(g=arguments.length<=0?void 0:arguments[0],s):g},s},d=function(t){var n=2,e=function(t){return t},u=o("text"),c=o("rect"),a=o("circle"),f=function(t){t.each(function(t,i,o){var f=o[i],h=r.select(f),l=Number(f.getAttribute("layout-width")),d=Number(f.getAttribute("layout-height"));c(h,[t]).attr("width",l).attr("height",d);var g=Number(f.getAttribute("anchor-x")),y=Number(f.getAttribute("anchor-y"));a(h,[t]).attr("r",2).attr("cx",g).attr("cy",y);var s=u(h,[t]);s.enter().attr("dy","0.9em").attr("transform","translate("+n+", "+n+")"),s.text(e)})};return f.padding=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],f):n},f.value=function(){return arguments.length?(e=i(arguments.length<=0?void 0:arguments[0]),f):e},f},g=function(t,n){return!(t.x>=n.x+n.width||t.x+t.width<=n.x||t.y>=n.y+n.height||t.y+t.height<=n.y)},y=function(t,n){if(g(t,n)){var r=Math.max(t.x,n.x),e=Math.min(t.x+t.width,n.x+n.width),i=Math.max(t.y,n.y);return(e-r)*(Math.min(t.y+t.height,n.y+n.height)-i)}return 0},s=function(t,r){return n.sum(t.map(function(n,e){return r===e?0:y(t[r],n)}))},v=function(t,n,r,e,i){return{x:t,y:n,width:r,height:e,location:i}},m=function(t){var n=t.x,r=t.y,e=t.width,i=t.height;return[v(n,r,e,i,"bottom-right"),v(n-e,r,e,i,"bottom-left"),v(n-e,r-i,e,i,"top-left"),v(n,r-i,e,i,"top-right"),v(n,r-i/2,e,i,"middle-right"),v(n-e/2,r,e,i,"bottom-center"),v(n-e,r-i/2,e,i,"middle-left"),v(n-e/2,r-i,e,i,"top-center")]},p=function(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)},x=function(t,n,r){return[].concat(p(t.slice(0,n)),[r],p(t.slice(n+1)))},b=function(t,n){return t<n},w=function t(){var r=null,e=b,i=function(){return 0},o=void 0,u=function(t,n){return r-i(o[n],n,o)+i(t,n,x(o,n,t))},c=function c(a,f){r||(r=n.sum(o.map(function(t,n){return i(t,n,o)})));var h=u(a,f);return e(h,r)?t().locationScore(i).winningScore(e).score(h).rectangles(x(o,f,a)):c};return c.rectangles=function(){return arguments.length?(o=arguments.length<=0?void 0:arguments[0],c):o},c.score=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],c):r},c.winningScore=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],c):e},c.locationScore=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],c):i},c},A=function(){var t=void 0,n=function(n){return t?n.width*n.height-y(n,t):0},r=function(t,r,e){return s(e,r)+n(t)},e=function(t){var n=w().locationScore(r).rectangles(t);return t.forEach(function(t,r){m(t).forEach(function(t,e){n=n(t,r)})}),n.rectangles()};return e.bounds=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},e},S=function(t){return t[M(t)]},M=function(t){return Math.floor(Math.random()*t.length)},k=function(){var t=1e3,n=1,r=void 0,e=function(t){switch(t.location){case"bottom-right":return 0;case"middle-right":case"bottom-center":return t.width*t.height/8}return t.width*t.height/4},i=function(t){return r?t.width*t.height-y(t,r):0},o=function(t,n,r){return s(r,n)+i(t)+e(t)},u=function(r){for(var e=t,i=function(t,n){return Math.exp((n-t)/e)>Math.random()},u=w().locationScore(o).winningScore(i).rectangles(r);e>0;){var c=M(r);u=u(S(m(r[c])),c),e-=n}return u.rectangles()};return u.temperature=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],u):t},u.cooling=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],u):n},u.bounds=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],u):r},u},N=function(t,r){return t[n.scan(t,r)]},j=function(t){t=t||function(t){return t};var n=function(n){n=t(n);for(;;){if("break"===function(){var t=n.filter(function(t){return!t.hidden}),r=t.map(function(n,r){return[n,s(t,r)]}),e=N(r,function(t,n){return n[1]-t[1]});if(!(e[1]>0))return"break";e[0].hidden=!0}())break}return n};return a(n,t),n},E=function(){var t=[0,0],n=function(n){return n.map(function(n,r){var e=n.x,i=n.y;return e+n.width>t[0]&&(e-=n.width),i+n.height>t[1]&&(i-=n.height),{height:n.height,width:n.width,x:e,y:i}})};return n.bounds=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],n):t},n};t.layoutLabel=l,t.layoutTextLabel=d,t.layoutGreedy=A,t.layoutAnnealing=k,t.layoutRemoveOverlaps=j,t.layoutBoundingBox=E,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-selection"),require("d3-scale")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-selection","d3-scale"],n):n(t.fc=t.fc||{},t.d3,t.d3,t.d3)}(this,function(t,n,r,e){"use strict";var i=function(t){return"function"==typeof t?t:function(){return t}},o=function(t,n){t=t||"g";var r=function(t,n){return n},e=null,i=function(i,o){o=o||function(t){return t};var u=i.selection?i:null;u&&(i=i.selection());var c=i.selectAll(function(t,n,r){return Array.from(r[n].childNodes).filter(function(t){return 1===t.nodeType})}).filter(null==n?t:t+"."+n),a=c.data(o,r),f=a.enter().append(t).attr("class",n),h=a.exit();a=a.merge(f);var l=u||e;return l&&(a=a.transition(l).style("opacity",1),f.style("opacity",1e-6),h=h.transition(l).style("opacity",1e-6)),h.remove(),a.enter=function(){return f},a.exit=function(){return h},a};return i.element=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i.className=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],i):n},i.key=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i.transition=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i},u=function(t,n,r){var e=n[r];if("function"!=typeof e)throw new Error("Attempt to rebind "+r+" which isn't a function on the source object");return function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];var u=e.apply(n,i);return u===n?t:u}},c=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},a=function(t,n){for(var r=arguments.length,e=Array(r>2?r-2:0),i=2;i<r;i++)e[i-2]=arguments[i];var o=c(e),a=!0,f=!1,h=void 0;try{for(var l,d=Object.keys(n)[Symbol.iterator]();!(a=(l=d.next()).done);a=!0){var g=l.value,y=o(g);y&&(t[y]=u(t,n,g))}}catch(t){f=!0,h=t}finally{try{!a&&d.return&&d.return()}finally{if(f)throw h}}return t},f=function(t){return t.map(function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t})},h=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return n=f(n),function(t){return n.some(function(n){return n.test(t)})&&t}},l=function(t){var n=function(){},u=function(){return[0,0]},c=function(t,n){return[t.x,t.y]},f=t||function(t){return t},l=function(){},d=e.scaleIdentity(),g=e.scaleIdentity(),y=o("g","label"),s=function(t){t.each(function(t,e,i){var o=y(r.select(i[e]),t).call(l),a=o.nodes(),h=a.map(function(t,n){var e=r.select(t).datum(),i=c(e,n,a),o=[d(i[0]),g(i[1])],f=u(e,n,a);return{hidden:!1,x:o[0],y:o[1],width:f[0],height:f[1]}}),s=f(h);o.attr("style",function(t,n){return"display:"+(s[n].hidden?"none":"inherit")}).attr("transform",function(t,n){return"translate("+s[n].x+", "+s[n].y+")"}).attr("layout-width",function(t,n){return s[n].width}).attr("layout-height",function(t,n){return s[n].height}).attr("anchor-x",function(t,n,r){return h[n].x-s[n].x}).attr("anchor-y",function(t,n,r){return h[n].y-s[n].y}),o.call(l),n(o,t,e)})};return a(s,y,h("key")),a(s,f),s.size=function(){return arguments.length?(u=i(arguments.length<=0?void 0:arguments[0]),s):u},s.position=function(){return arguments.length?(c=i(arguments.length<=0?void 0:arguments[0]),s):c},s.component=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],s):l},s.decorate=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],s):n},s.xScale=function(){return arguments.length?(d=arguments.length<=0?void 0:arguments[0],s):d},s.yScale=function(){return arguments.length?(g=arguments.length<=0?void 0:arguments[0],s):g},s},d=function(t){var n=2,e=function(t){return t},u=o("text"),c=o("rect"),a=o("circle"),f=function(t){t.each(function(t,i,o){var f=o[i],h=r.select(f),l=Number(f.getAttribute("layout-width")),d=Number(f.getAttribute("layout-height"));c(h,[t]).attr("width",l).attr("height",d);var g=Number(f.getAttribute("anchor-x")),y=Number(f.getAttribute("anchor-y"));a(h,[t]).attr("r",2).attr("cx",g).attr("cy",y);var s=u(h,[t]);s.enter().attr("dy","0.9em").attr("transform","translate("+n+", "+n+")"),s.text(e)})};return f.padding=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],f):n},f.value=function(){return arguments.length?(e=i(arguments.length<=0?void 0:arguments[0]),f):e},f},g=function(t,n){return!(t.x>=n.x+n.width||t.x+t.width<=n.x||t.y>=n.y+n.height||t.y+t.height<=n.y)},y=function(t,n){if(g(t,n)){var r=Math.max(t.x,n.x),e=Math.min(t.x+t.width,n.x+n.width),i=Math.max(t.y,n.y);return(e-r)*(Math.min(t.y+t.height,n.y+n.height)-i)}return 0},s=function(t,r){return n.sum(t.map(function(n,e){return r===e?0:y(t[r],n)}))},v=function(t,n,r,e,i){return{x:t,y:n,width:r,height:e,location:i}},m=function(t){var n=t.x,r=t.y,e=t.width,i=t.height;return[v(n,r,e,i,"bottom-right"),v(n-e,r,e,i,"bottom-left"),v(n-e,r-i,e,i,"top-left"),v(n,r-i,e,i,"top-right"),v(n,r-i/2,e,i,"middle-right"),v(n-e/2,r,e,i,"bottom-center"),v(n-e,r-i/2,e,i,"middle-left"),v(n-e/2,r-i,e,i,"top-center")]},p=function(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)},x=function(t,n,r){return[].concat(p(t.slice(0,n)),[r],p(t.slice(n+1)))},b=function(t,n){return t<n},w=function t(){var r=null,e=b,i=function(){return 0},o=void 0,u=function(t,n){return r-i(o[n],n,o)+i(t,n,x(o,n,t))},c=function c(a,f){r||(r=n.sum(o.map(function(t,n){return i(t,n,o)})));var h=u(a,f);return e(h,r)?t().locationScore(i).winningScore(e).score(h).rectangles(x(o,f,a)):c};return c.rectangles=function(){return arguments.length?(o=arguments.length<=0?void 0:arguments[0],c):o},c.score=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],c):r},c.winningScore=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],c):e},c.locationScore=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],c):i},c},A=function(){var t=void 0,n=function(n){return t?n.width*n.height-y(n,t):0},r=function(t,r,e){return s(e,r)+n(t)},e=function(t){var n=w().locationScore(r).rectangles(t);return t.forEach(function(t,r){m(t).forEach(function(t,e){n=n(t,r)})}),n.rectangles()};return e.bounds=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},e},S=function(t){return t[M(t)]},M=function(t){return Math.floor(Math.random()*t.length)},k=function(){var t=1e3,n=1,r=void 0,e=function(t){switch(t.location){case"bottom-right":return 0;case"middle-right":case"bottom-center":return t.width*t.height/8}return t.width*t.height/4},i=function(t){return r?t.width*t.height-y(t,r):0},o=function(t,n,r){return s(r,n)+i(t)+e(t)},u=function(r){for(var e=t,i=function(t,n){return Math.exp((n-t)/e)>Math.random()},u=w().locationScore(o).winningScore(i).rectangles(r);e>0;){var c=M(r);u=u(S(m(r[c])),c),e-=n}return u.rectangles()};return u.temperature=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],u):t},u.cooling=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],u):n},u.bounds=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],u):r},u},N=function(t,r){return t[n.scan(t,r)]},j=function(t){t=t||function(t){return t};var n=function(n){n=t(n);for(;;){if("break"===function(){var t=n.filter(function(t){return!t.hidden}),r=t.map(function(n,r){return[n,s(t,r)]}),e=N(r,function(t,n){return n[1]-t[1]});if(!(e[1]>0))return"break";e[0].hidden=!0}())break}return n};return a(n,t),n},E=function(){var t=[0,0],n=function(n){return n.map(function(n,r){var e=n.x,i=n.y;return e+n.width>t[0]&&(e-=n.width),i+n.height>t[1]&&(i-=n.height),{height:n.height,width:n.width,x:e,y:i}})};return n.bounds=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],n):t},n};t.layoutLabel=l,t.layoutTextLabel=d,t.layoutGreedy=A,t.layoutAnnealing=k,t.layoutRemoveOverlaps=j,t.layoutBoundingBox=E,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="6.0.6"></a> | ||
## [6.0.6](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-label-layout@6.0.5...@d3fc/d3fc-label-layout@6.0.6) (2018-08-29) | ||
### Bug Fixes | ||
* use single d3 reference for bundleSpecs ([3d0a47e](https://github.com/d3fc/d3fc/commit/3d0a47e)) | ||
<a name="6.0.5"></a> | ||
@@ -8,0 +19,0 @@ ## [6.0.5](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-label-layout@6.0.4...@d3fc/d3fc-label-layout@6.0.5) (2018-08-21) |
{ | ||
"name": "@d3fc/d3fc-label-layout", | ||
"version": "6.0.5", | ||
"version": "6.0.6", | ||
"description": "A D3 layout that places labels avoiding overlaps using either a greedy or simulated annealing strategy", | ||
@@ -32,3 +32,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@d3fc/d3fc-data-join": "^5.0.5", | ||
"@d3fc/d3fc-data-join": "^5.0.6", | ||
"@d3fc/d3fc-rebind": "^5.0.5", | ||
@@ -35,0 +35,0 @@ "d3-array": "^1.0.0", |
@@ -12,3 +12,3 @@ import jsdom from 'jsdom'; | ||
scripts: [ | ||
'./node_modules/d3/build/d3.js', | ||
require.resolve('d3/dist/d3.js'), | ||
'./node_modules/@d3fc/d3fc-data-join/build/d3fc-data-join.js', | ||
@@ -15,0 +15,0 @@ './node_modules/@d3fc/d3fc-rebind/build/d3fc-rebind.js', |
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
274783
1405
Updated@d3fc/d3fc-data-join@^5.0.6