@antv/g6
Version:
graph visualization frame work
2 lines • 2.94 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@antv/g6")):"function"==typeof define&&define.amd?define(["@antv/g6"],e):"object"==typeof exports?exports["plugin.layout.circle"]=e(require("@antv/g6")):t["plugin.layout.circle"]=e(t.G6)}(window,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=88)}({6:function(e,n){e.exports=t},87:function(t,e,n){var r=n(6).Util,i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r.mix(this,{nodes:null,radius:null,sweep:null,avoidOverlap:!1,clockwise:!0,startAngle:1.5*Math.PI,width:null,height:null,center:null},e)}return t.prototype.execute=function(){var t=this,e=this.graph,n=this.nodes,i=this.width?this.width:e.getWidth(),o=this.height?this.height:e.getHeight(),a=this.center?this.center:{x:i/2,y:o/2},s=this.avoidOverlap,u=this.clockwise,c=(r.isNil(this.sweep)?2*Math.PI-2*Math.PI/n.length:this.sweep)/Math.max(1,n.length-1),l=this.radius,h=0,f=void 0;for(f=0;f<n.length;f++){var p=n[f],d=p.width,g=p.height;h=Math.max(h,d,g)}if(l=r.isNumber(this.radius)?this.radius:n.length<=1?0:Math.min(o,i)/2-h,n.length>1&&s){h*=1.75;var y=Math.cos(c)-Math.cos(0),v=Math.sin(c)-Math.sin(0),b=Math.sqrt(h*h/(y*y+v*v));l=Math.max(b,l)}this.sort&&n.sort(this.sort),r.each(n,function(e,n){var r=t.startAngle+n*c*(u?1:-1),i=l*Math.cos(r),o=l*Math.sin(r);e.x=a.x+i,e.y=a.y+o})},t}();t.exports=i},88:function(t,e,n){var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};var i=n(6),o=n(87);i.Layouts.Circle=o;var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e}return t.prototype.init=function(){var t=this,e=this.graph;e.on("beforeinit",function(){var n=new o(r({graph:e},t.options));e.set("layout",n)})},t}();i.Plugins["layout.circle"]=a,t.exports=a}})});
//# sourceMappingURL=plugin.layout.circle.js.map