diff --git a/dist/unipept-visualizations.min.js b/dist/unipept-visualizations.min.js index d96349b..70754ac 100644 --- a/dist/unipept-visualizations.min.js +++ b/dist/unipept-visualizations.min.js @@ -1,3 +1,3 @@ -/*! unipept-visualizations 1.2.3 07-09-2017 */ +/*! unipept-visualizations 1.3.0 07-09-2017 */ "use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};!function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){function d(a){return a&&a.__esModule?a:{default:a}}var e=c(1),f=(d(e),c(5)),g=(d(f),c(7));d(g)},function(a,b,c){function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(){B=h({},A,v),l.default.settings=B,B.width=B.width-x.right-x.left,B.height=B.height-x.top-x.bottom,B.enableTooltips&&d(),B.enableInnerArcs&&e(),G=d3.layout.tree().nodeSize([2,10]).separation(function(a,b){var c=i(a)+i(b),d=c/2+4;return a.parent===b.parent?d:d+4}),I=d3.svg.diagonal().projection(function(a){return[a.y,a.x]}),J=d3.scale.linear().range([B.minNodeSize,B.maxNodeSize]),L=d3.behavior.zoom().scaleExtent([.1,3]).on("zoom",function(){M.attr("transform","translate("+d3.event.translate+")scale("+d3.event.scale+")")}),M=d3.select(a).append("svg").attr("version","1.1").attr("xmlns","http://www.w3.org/2000/svg").attr("viewBox","0 0 "+(B.width+x.right+x.left)+" "+(B.height+x.top+x.bottom)).attr("width",B.width+x.right+x.left).attr("height",B.height+x.top+x.bottom).call(L).append("g").attr("transform","translate("+x.left+","+x.top+")").append("g"),f(l.default.createNode(b))}function d(){H=d3.select("body").append("div").attr("id",a.id+"-tooltip").attr("class","tip").style("position","absolute").style("z-index","10").style("visibility","hidden").style("background-color","white").style("padding","2px").style("border","1px solid #dddddd").style("border-radius","3px;")}function e(){var a=d3.scale.linear().range([0,2*Math.PI]);K=d3.svg.arc().outerRadius(i).startAngle(0).endAngle(function(b){return a(b.data.self_count/b.data.count)||0})}function f(a){var b=this;J.domain([0,a.data.count]),F=a,F.x0=B.height/2,F.y0=0,F.setSelected(!0),F.children.forEach(function(a,c){a.color=d3.functor(B.colors).call(b,a,c),a.setRecursiveProperty("color",a.color)}),B.enableExpandOnClick?(F.collapseAll(),F.expand()):F.expandAll(),g(F),o(F)}function g(a){var b=G.nodes(F).reverse(),c=G.links(b);b.forEach(function(a){a.y=a.depth*B.nodeDistance});var d=M.selectAll("g.node").data(b,function(a){return a.id||(a.id=++E)}),e=d.enter().append("g").attr("class","node").style("cursor","pointer").attr("transform",function(b){return"translate("+(a.y||0)+","+(a.x0||0)+")"}).on("click",k).on("mouseover",p).on("mouseout",q).on("contextmenu",m);e.append("circle").attr("r",1e-6).style("stroke-width","1.5px").style("stroke",B.nodeStrokeColor).style("fill",B.nodeFillColor),B.enableInnerArcs&&e.append("path").attr("d",K).style("fill",B.nodeStrokeColor).style("fill-opacity",0),B.enableLabels&&e.append("text").attr("x",function(a){return a.isLeaf()?10:-10}).attr("dy",".35em").attr("text-anchor",function(a){return a.isLeaf()?"start":"end"}).text(B.getLabel).style("font","10px sans-serif").style("fill-opacity",1e-6);var f=d.transition().duration(y).attr("transform",function(a){return"translate("+a.y+","+a.x+")"});f.select("circle").attr("r",i).style("fill-opacity",function(a){return a._children?1:0}).style("stroke",B.nodeStrokeColor).style("fill",B.nodeFillColor),B.enableLabels&&f.select("text").style("fill-opacity",1),B.enableInnerArcs&&f.select("path").duration(y).attr("d",K).style("fill-opacity",.8);var g=d.exit().transition().duration(y).attr("transform",function(b){return"translate("+a.y+","+a.x+")"}).remove();g.select("circle").attr("r",1e-6),g.select("path").style("fill-opacity",1e-6),g.select("text").style("fill-opacity",1e-6);var h=M.selectAll("path.link").data(c,function(a){return a.target.id});h.enter().insert("path","g").attr("class","link").style("fill","none").style("stroke-opacity","0.5").style("stroke-linecap","round").style("stroke",B.linkStrokeColor).style("stroke-width",1e-6).attr("d",function(b){var c={x:a.x0||0,y:a.y0||0};return I({source:c,target:c})}),h.transition().duration(y).attr("d",I).style("stroke",B.linkStrokeColor).style("stroke-width",function(a){return a.source.selected?J(a.target.data.count)+"px":"4px"}),h.exit().transition().duration(y).style("stroke-width",1e-6).attr("d",function(b){var c={x:a.x,y:a.y};return I({source:c,target:c})}).remove(),b.forEach(function(a){var b=[a.x,a.y];a.x0=b[0],a.y0=b[1]})}function i(a){return a.selected?J(a.data.count)/2:2}function k(a){B.enableExpandOnClick&&(d3.event.defaultPrevented||(d3.event.shiftKey?a.expandAll():a.children?a.collapse():a.expand(),g(a),o(a)))}function m(a){B.enableRightClick&&n(a)}function n(a){return a===C&&a!==F?void n(F):(C=a,F.setSelected(!1),a.setSelected(!0),J.domain([0,a.data.count]),a.expand(),null!==d3.event&&d3.event.preventDefault(),g(a),o(a),void(B.rerootCallback&&B.rerootCallback.call(null,a)))}function o(a){var b=L.scale(),c=-a.y0,d=-a.x0;c=c*b+B.width/4,d=d*b+B.height/2,M.transition().duration(y).attr("transform","translate("+c+","+d+")scale("+b+")"),L.scale(b),L.translate([c,d])}function p(a,b){B.enableTooltips&&(H.html(B.getTooltip(a)).style("top",d3.event.pageY-5+"px").style("left",d3.event.pageX+15+"px"),D=setTimeout(function(){H.style("visibility","visible")},1e3))}function q(a,b){B.enableTooltips&&(clearTimeout(D),H.style("visibility","hidden"))}function r(a){return a.selected?a._children?a.color||"#aaa":"#fff":"#aaa"}function s(a){return a.selected?a.color||"#aaa":"#aaa"}function t(a){return a.source.selected?a.target.color:"#aaa"}function u(a){return"

"+B.getTooltipTitle(a)+"

"+B.getTooltipText(a)+"

"}var v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},w={},x={top:5,right:5,bottom:5,left:5},y=750,z=d3.scale.category10(),A={height:300,width:600,nodeDistance:180,levelsToExpand:2,minNodeSize:2,maxNodeSize:105,countAccessor:function(a){return a.data.count},rerootCallback:void 0,colors:function(a){return z(a.name)},nodeFillColor:r,nodeStrokeColor:s,linkStrokeColor:t,enableInnerArcs:!0,enableExpandOnClick:!0,enableRightClick:!0,enableLabels:!0,getLabel:function(a){return a.name},enableTooltips:!0,getTooltip:u,getTooltipTitle:j.default.getTooltipTitle,getTooltipText:j.default.getTooltipText},B=void 0,C=void 0,D=void 0,E=0,F=void 0,G=void 0,H=void 0,I=void 0,J=void 0,K=void 0,L=void 0,M=void 0;return w.reset=function(){L.scale(1),n(F)},c(),w}function f(a,b){return this.each(function(){var c=$(this),d=c.data("vis.treeview"),f=$.extend({},c.data(),"object"===("undefined"==typeof b?"undefined":g(b))&&b);d||c.data("vis.treeview",d=new e(this,a,f)),"string"==typeof b&&d[b]()})}Object.defineProperty(b,"__esModule",{value:!0});var g="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(a){return"undefined"==typeof a?"undefined":_typeof2(a)}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":"undefined"==typeof a?"undefined":_typeof2(a)},h=Object.assign||function(a){for(var b=1;b0&&void 0!==arguments[0]?arguments[0]:{};e(this,b);var c=f(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.settings=b.settings,c.setCount(),c}return g(b,a),h(b,[{key:"setCount",value:function(){this.settings.countAccessor(this)?this.data.count=this.settings.countAccessor(this):this.children?this.data.count=this.children.reduce(function(a,b){return a+b.data.count},0):this.data.count=0}},{key:"setSelected",value:function(a){this.setRecursiveProperty("selected",a)}},{key:"collapseAll",value:function(){this.children&&0===this.children.length&&(this.children=null),this.children&&(this._children=this.children,this._children.forEach(function(a){a.collapseAll()}),this.children=null)}},{key:"collapse",value:function(){this.children&&(this._children=this.children,this.children=null)}},{key:"expandAll",value:function(){this.expand(100)}},{key:"expand",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.settings.levelsToExpand;a>0&&(this._children&&(this.children=this._children,this._children=null),this.children&&this.children.forEach(function(b){b.expand(a-1)}))}}],[{key:"new",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new b(a)}},{key:"createNode",value:function(a){return j.default.createNode(a,b.new)}}]),b}(j.default);b.default=k},function(a,b){function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(b,"__esModule",{value:!0});var d=Object.assign||function(a){for(var b=1;b0&&void 0!==arguments[0]?arguments[0]:{};c(this,a),this.data={},d(this,b)}return e(a,[{key:"setRecursiveProperty",value:function(a,b){this[a]=b,this.children?this.children.forEach(function(c){c.setRecursiveProperty(a,b)}):this._children&&this._children.forEach(function(c){c.setRecursiveProperty(a,b)})}},{key:"isLeaf",value:function(){return!this.children&&!this._children||this.children&&0===this.children.length||this._children&&0===this._children.length}},{key:"getHeight",value:function(){return void 0===this._height&&(this.isLeaf()?this._height=0:this._height=d3.max(this.children,function(a){return a.getHeight()})+1),this._height}},{key:"getDepth",value:function(){return void 0===this._depth&&(void 0===this.parent?this._depth=0:this._depth=this.parent.getDepth()+1),this._depth}}],[{key:"new",value:function(){var b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new a(b)}},{key:"createNode",value:function(b){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.new;return b.children&&(b.children=b.children.map(function(b){return a.createNode(b,c)})),c.call(null,b)}}]),a}();b.default=f},function(a,b,c){function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){function c(){w=h({},v,s),x=l.default.createNode(b),w.width=w.width-u.right-u.left,w.height=w.height-u.top-u.bottom,w.levels=w.levels||x.getHeight(),w.enableTooltips&&d(),e(),f(x),i(x,!1)}function d(){D=d3.select("body").append("div").attr("id",a.id+"-tooltip").attr("class","tip").style("position","absolute").style("z-index","10").style("visibility","hidden").style("background-color","white").style("padding","2px").style("border","1px solid #dddddd").style("border-radius","3px;")}function e(){var b=w.className;$(a).addClass(b),$("