/** * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/almond for details */ !function(t,e){var n=e();"undefined"!=typeof define&&define.amd&&define(n),t.Bionya=n}(this,function(){var t,e,n;return function(r){function a(t,e){return v.call(t,e)}function i(t,e){var n,r,a,i,o,s,l,u,c,p,d,f=e&&e.split("/"),h=_.map,g=h&&h["*"]||{};if(t&&"."===t.charAt(0))if(e){for(f=f.slice(0,f.length-1),t=t.split("/"),o=t.length-1,_.nodeIdCompat&&k.test(t[o])&&(t[o]=t[o].replace(k,"")),t=f.concat(t),c=0;c0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((f||g)&&h){for(n=t.split("/"),c=n.length;c>0;c-=1){if(r=n.slice(0,c).join("/"),f)for(p=f.length;p>0;p-=1)if(a=h[f.slice(0,p).join("/")],a&&(a=a[r])){i=a,s=c;break}if(i)break;!l&&g&&g[r]&&(l=g[r],u=c)}!i&&l&&(i=l,s=u),i&&(n.splice(0,s,i),t=n.join("/"))}return t}function o(t,e){return function(){return f.apply(r,b.call(arguments,0).concat([t,e]))}}function s(t){return function(e){return i(e,t)}}function l(t){return function(e){x[t]=e}}function u(t){if(a(m,t)){var e=m[t];delete m[t],y[t]=!0,d.apply(r,e)}if(!a(x,t)&&!a(y,t))throw new Error("No "+t);return x[t]}function c(t){var e,n=t?t.indexOf("!"):-1;return n>-1&&(e=t.substring(0,n),t=t.substring(n+1,t.length)),[e,t]}function p(t){return function(){return _&&_.config&&_.config[t]||{}}}var d,f,h,g,x={},m={},_={},y={},v=Object.prototype.hasOwnProperty,b=[].slice,k=/\.js$/;h=function(t,e){var n,r=c(t),a=r[0];return t=r[1],a&&(a=i(a,e),n=u(a)),a?t=n&&n.normalize?n.normalize(t,s(e)):i(t,e):(t=i(t,e),r=c(t),a=r[0],t=r[1],a&&(n=u(a))),{f:a?a+"!"+t:t,n:t,pr:a,p:n}},g={require:function(t){return o(t)},exports:function(t){var e=x[t];return"undefined"!=typeof e?e:x[t]={}},module:function(t){return{id:t,uri:"",exports:x[t],config:p(t)}}},d=function(t,e,n,i){var s,c,p,d,f,_,v=[],b=typeof n;if(i=i||t,"undefined"===b||"function"===b){for(e=!e.length&&n.length?["require","exports","module"]:e,f=0;f=0?this.outer_thickness:this.inner_thickness},e.prototype.getCenter=function(){return this.center},e.prototype.getRange=function(t){var e,n;return t>0?(e=this.outer_radius+this.outer_thickness*(t-1),n=e+this.outer_thickness):(n=this.inner_radius,e=n-this.inner_thickness),[e,n]},e.prototype.get=function(t,e,n){var r,a;return r=t>0?this.outer_radius+this.outer_thickness*t:this.inner_radius-this.inner_thickness*t*-1,a=this.scales[e](n),{x:r*Math.sin(a),y:-r*Math.cos(a),r:r,theta:a}},e}),n("components/axis",["tools"],function(t){function e(e,n,r){var a=t._,i=t.Manager,o={width:0,height:0,margin:{top:0,bottom:0,left:0,right:0},x_label:"X",y_label:"Y",zoom:!0,zoom_range:[.5,5],rotate_x_label:0,rotate_y_label:0,pane_uuid:null,z_index:0,extra:{}},s={df_id:null,inner_radius:150,outer_radius:170,group_by:null,fill_by:null,axis:null,chord:!1,matrix:null,padding:.05,inner_num:0,outer_num:1,color:["#253494"],text_color:"#fff",text_size:"1em"};arguments.length>2&&(a.extend(o,r),a.extend(s,r.extra),o.extra=s);var l=i.getData(o.extra.df_id),u=l.column(o.extra.group_by),c={},p=o.extra.chord?o.extra.matrix:[],d=function(){if(o.extra.fill_by){var t=l.scale(o.extra.fill_by,o.extra.color),e=a.zip.apply(null,a.map(l.column(o.extra.fill_by),function(e,n){return[n,t(e)]}));return d3.scale.ordinal().domain(e[0]).range(e[1])}return d3.scale.ordinal().range(o.extra.color)}();a.each(u,function(t,e){var n=l.nested_column(e,o.extra.axis);if(c[t]=n,null==o.extra.matrix){p[e]=[];for(var r=0;r3&&n.extend(o,i),this.height_scale=function(){var t=e.getHeight(o.layer);return d3.scale.linear().domain(o.range).range([0,t])}(),this.inner_radius=e.getRange(o.layer)[0],this.model=function(){var n=e.getCenter();return t.append("g").attr("transform","translate("+n.x+","+n.y+")")}(),this.scales=e,this.df=r.getData(a),this.color_scale=d3.scale.ordinal().range(o.color),this.uuid=o.uuid,this.options=o,this}var n=t._,r=t.Manager;return e.prototype.update=function(){var t=this.scales.groups(),e=this;this.options.axis&&!function(){var t=e.height_scale.ticks(5);t.reverse().pop();var n=e.model.append("g").selectAll("g").data(t).enter().append("g");n.append("circle").attr("fill","none").attr("stroke","#000").attr("r",function(t){return e.inner_radius+e.height_scale(t)}),n.append("text").attr("y",function(t){return-1*(e.inner_radius+e.height_scale(t)+4)}).text(function(t){return t})}(),n.each(t,function(t,r){var a=e.df.nested_column(r,e.options.x),i=e.df.nested_column(r,e.options.y),o=function(){var t=e.options.color;if(e.options.fill_by){var r=e.options.fill_by,a=e.df.scale(r,t),i=n.zip.apply(null,n.map(e.df.column(r),function(t,e){return[e,a(t)]}));return d3.scale.ordinal().domain(i[0]).range(i[1])}return d3.scale.ordinal().range(t)}(),s=e.processData(t,a,i,o);e.updateModels(s)})},e.prototype.processData=function(t,e,r,a){var i=this;return n.map(e,function(e,n){var o=i.scales.get(i.options.layer,t,e);return o.height=i.height_scale(r[n]),o.fill=a(n),o})},e.prototype.updateModels=function(t){var e=this.height_scale(0),n=this.inner_radius,r=this.scales.getWidth()*this.options.width;this.model.append("g").selectAll("path").data(t).enter().append("path").attr("d",d3.svg.arc().startAngle(function(t){return t.theta-r/2}).endAngle(function(t){return t.theta+r/2}).innerRadius(n+e).outerRadius(function(t){return n+t.height})).attr("stroke",function(t){return t.fill}).attr("fill",function(t){return t.fill})},e.prototype.getLegend=function(){},e.prototype.checkSelectedData=function(){},e}),n("diagrams/connector",["tools"],function(t){function e(t,e,a,i){var o={color:"#737373",fill_by:null,from:null,to:null,shape:"circle",stroke_width:2,size:100,shape_fill:"#fff",shape_stroke:"#3182bd",shape_stroke_width:2,arc_height:30,layer:0};arguments.length>3&&n.extend(o,i),this.model=function(){var n=e.getCenter();return t.append("g").attr("transform","translate("+n.x+","+n.y+")")}(),this.scales=e,this.df=r.getData(a),this.uuid=o.uuid,this.options=o}var n=t._,r=t.Manager;return e.prototype.update=function(){var t=this.df.column(this.options.from),e=this.df.column(this.options.to),n=this.processData(t,e);this.updateModels(n)},e.prototype.processData=function(t,e){var r=this.scales,a=this.options.layer,i=this.options.arc_height;return n.map(n.zip(t,e),function(t){var e=n.map(t,function(t){var e=t.split(/(.+)\.(.+)/),n=e[1],i=e[2],o=r.get(a,n,i);return{x:o.x,y:o.y}}),o=function(){var t=n.map(["x","y"],function(t){return(e[0][t]+e[1][t])/2}),r=Math.sqrt(t[0]*t[0]+t[1]*t[1]),a=n.map(t,function(t){return t/r});return{x:a[0]*(r-i),y:a[1]*(r-i)}}();return[e[0],o,e[1]]})},e.prototype.updateModels=function(t){var e=(this.scales,this.layer,this.options),r=this.model.selectAll("g").data(t).enter().append("g");r.append("path").attr("d",d3.svg.line().tension(.2).x(function(t){return t.x}).y(function(t){return t.y}).interpolate("cardinal")).attr("fill","none").attr("stroke",e.color).attr("stroke-width",e.stroke_width),r.append("g").selectAll("path").data(n.filter(n.flatten(t),function(t,e){return e%3!=1})).enter().append("path").attr("d",d3.svg.symbol().type(e.shape).size(e.size)).attr("fill",e.shape_fill).attr("stroke",e.shape_stroke).attr("stroke-width",e.shape_stroke_width).attr("transform",function(t){return"translate("+t.x+","+t.y+")"})},e.prototype.getLegend=function(){},e.prototype.checkSelectedData=function(){},e}),n("diagrams/labels",["tools"],function(t){function e(t,e,a,i){var o={color:"#000",fill_by:null,x:null,text:null,stroke_width:4,text_size:"1em",layer:1};arguments.length>3&&n.extend(o,i),this.model=function(){var n=e.getCenter();return t.append("g").attr("transform","translate("+n.x+","+n.y+")")}(),this.scales=e,this.df=r.getData(a),this.uuid=o.uuid,this.options=o}var n=t._,r=t.Manager;return e.prototype.update=function(){var t=this.scales.groups(),e=this;n.each(t,function(t,n){var r=e.df.nested_column(n,e.options.x),a=e.df.nested_column(n,e.options.text),i=e.processData(t,r,a);e.updateModels(i)})},e.prototype.processData=function(t,e,r){var a=this.scales,i=this.options.layer;return n.filter(n.map(n.zip(e,r),function(e){return{theta:a.get(i,t,e[0]).theta,text:e[1]}}),function(t){return null!=t.text&&t.text.length>0})},e.prototype.updateModels=function(t){var e=this.scales,n=this.options.layer,r=this.options,a=e.getRange(n)[0],i=this.model.append("g").selectAll("g").data(t).enter().append("g").attr("transform",function(t){return"rotate("+180*((t.theta-Math.PI/2)/Math.PI)+")"});i.append("text").text(function(t){return t.text}).attr("text-anchor","start").attr("dominant-baseline","middle").attr("fill",r.color).attr("x",a+10).attr("y",0).attr("font-size",r.text_size),i.append("line").attr("x1",a).attr("x2",a+5).attr("y1",0).attr("y2",0).attr("stroke","#000")},e.prototype.getLegend=function(){},e.prototype.checkSelectedData=function(){},e}),n("main",["require","exports","module","components/scale","components/axis","diagrams/arc","diagrams/connector","diagrams/labels"],function(t){var e={};return e.Nya={scale:t("components/scale"),axis:t("components/axis"),diagrams:{arc:t("diagrams/arc"),connector:t("diagrams/connector"),labels:t("diagrams/labels")}},e}),e("main")});