UNPKG

tnt.board

Version:

TnT track-based board display

1 lines 24.7 kB
!function t(e,n,r){function a(o,c){if(!n[o]){if(!e[o]){var l="function"==typeof require&&require;if(!c&&l)return l(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var u=n[o]={exports:{}};e[o][0].call(u.exports,function(t){var n=e[o][1][t];return a(n?n:t)},u,u.exports,t,e,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)a(r[o]);return a}({1:[function(t,e,n){"undefined"==typeof tnt&&(e.exports=tnt={}),tnt.board=t("./index.js")},{"./index.js":2}],2:[function(t,e,n){e.exports=t("./src/index")},{"./src/index":13}],3:[function(t,e,n){e.exports=t("./src/api.js")},{"./src/api.js":4}],4:[function(t,e,n){var r=function(t){var e=function(){var t=[];return t.add_batch=function(e){t.unshift(e)},t.update=function(e,n){for(var r=0;r<t.length;r++)for(var a in t[r])if(a===e)return t[r][a]=n,!0;return!1},t.add=function(e,n){if(t.update(e,n));else{var r={};r[e]=n,t.add_batch(r)}},t.get=function(e){for(var n=0;n<t.length;n++)for(var r in t[n])if(r===e)return t[n][r]},t},n=e(),r=function(){};r.check=function(e,n,a){if(!(e instanceof Array))return"function"==typeof e?e.check(n,a):t[e].check(n,a),r;for(var i=0;i<e.length;i++)r.check(e[i],n,a)},r.transform=function(e,n){if(!(e instanceof Array))return"function"==typeof e?e.transform(n):t[e].transform(n),r;for(var a=0;a<e.length;a++)r.transform(e[a],n)};var a=function(e,r){var a=[],i=[],o=r.on_getter||function(){return n.get(e)},c=r.on_setter||function(t){for(var r=0;r<i.length;r++)t=i[r](t);for(var o=0;o<a.length;o++)if(!a[o].check(t)){var c=a[o].msg||"Value "+t+" doesn't seem to be valid for this method";throw c}n.add(e,t)},l=function(e){return arguments.length?(c(e),t):o()};l.check=function(t,e){return arguments.length?(a.push({check:t,msg:e}),this):a},l.transform=function(t){return arguments.length?(i.push(t),this):i},t[e]=l},i=function(t,e){if("object"==typeof t){n.add_batch(t);for(var r in t)a(r,e)}else n.add(t,e.default_value),a(t,e)};return r.getset=function(t,e){return i(t,{default_value:e}),r},r.get=function(t,e){var n=function(){throw"Method defined only as a getter (you are trying to use it as a setter"};return i(t,{default_value:e,on_setter:n}),r},r.set=function(t,e){var n=function(){throw"Method defined only as a setter (you are trying to use it as a getter"};return i(t,{default_value:e,on_getter:n}),r},r.method=function(e,n){if("object"==typeof e)for(var a in e)t[a]=e[a];else t[e]=n;return r},r};e.exports=n=r},{}],5:[function(t,e,n){e.exports=t("./src/index.js")},{"./src/index.js":6}],6:[function(t,e,n){var r=t("./utils.js");r.reduce=t("./reduce.js"),r.png=t("./png.js"),e.exports=n=r},{"./png.js":7,"./reduce.js":8,"./utils.js":9}],7:[function(t,e,n){var r=function(){var t,e='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',n=1,r=function(){},a=function(a){a=a.node();var i=function(t){var e=d3.select(a).selectAll("image"),n=e[0].length;0===n&&t(),e.each(function(){var e=d3.select(this),r=new Image;r.onload=function(){var a=document.createElement("canvas"),i=a.getContext("2d");a.width=r.width,a.height=r.height,i.drawImage(r,0,0);var o=a.toDataURL("image/png");e.attr("href",o),n--,0===n&&t()},r.src=e.attr("href")})},o=function(t,e){for(var n=t.children||t.childNodes;n.length>0;){var r=n[0];1===r.nodeType&&e.appendChild(r)}return e},c=function(e){for(var n="",r=document.styleSheets,a=0;a<r.length;a++){var i=r[a].href||"";if(t){for(var o=!0,c=0;c<t.length;c++)if(i.indexOf(t[c])>-1){o=!1;break}if(o)continue}for(var l=r[a].cssRules||[],u=0;u<l.length;u++){var s=l[u];if("undefined"!=typeof s.style){var f=e.querySelectorAll(s.selectorText);f.length>0&&(n+=s.selectorText+" { "+s.style.cssText+" }\n")}}}var d=e.querySelector("defs")||document.createElement("defs"),h=document.createElement("style");return h.setAttribute("type","text/css"),h.innerHTML="<![CDATA[\n"+n+"\n]]>",d.appendChild(h),d};i(function(){var t=document.createElement("div"),i=a.cloneNode(!0),l=parseInt(i.getAttribute("width")),u=parseInt(i.getAttribute("height"));i.setAttribute("version","1.1"),i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),i.setAttribute("width",l*n),i.setAttribute("height",u*n);var s=document.createElement("g");s.setAttribute("transform","scale("+n+")"),i.appendChild(o(i,s)),t.appendChild(i),i.insertBefore(c(i),i.firstChild);var f=e+t.innerHTML;f=f.replace("none","block");var d=new Image;d.src="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(f))),d.onload=function(){var t=document.createElement("canvas");t.width=d.width,t.height=d.height;var e=t.getContext("2d");e.drawImage(d,0,0);var n=t.toDataURL("image/png");r(n)}})};return a.scale_factor=function(t){return arguments.length?(n=t,this):n},a.callback=function(t){return arguments.length?(r=t,this):r},a.stylesheets=function(e){return arguments.length?(t=e,this):t},a},a=function(){var t="image.png",e={limit:1/0,onError:function(){console.log("image too large")}},n=r().callback(function(n){var r=document.createElement("a");r.download=t,r.href=n,document.body.appendChild(r),r.href.length>e.limit?(r.parentNode.removeChild(r),e.onError()):r.click()});return n.filename=function(e){return arguments.length?(t=e,n):t},n.limit=function(t){return arguments.length?(e=t,this):e},n};e.exports=n=a},{}],8:[function(t,e,n){var r=function(){var t=5,e="val",n=function(t,e){return t<e?e-t<=.2*e:t-e<=.2*t},r=function(t){return t},a=function(t){if(!t.length)return t;var e=c(t),n=r(e);return n},i=function(t,n){if(n.sort(function(t,n){return t[e]-n[e]}),n.length%2)t[e]=n[~~(n.length/2)][e];else{var r=~~(n.length/2)-1;t[e]=(n[r][e]+n[r+1][e])/2}return t},o=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},c=function(e){if(0===t)return e;for(var n=[],r=0;r<e.length;r++){var a=r<t?0:r-t,c=r>e.length-t?e.length:r+t;n[r]=i(o(e[r]),e.slice(a,c+1))}return n};return a.reducer=function(t){return arguments.length?(r=t,a):r},a.redundant=function(t){return arguments.length?(n=t,a):n},a.value=function(t){return arguments.length?(e=t,a):e},a.smooth=function(e){return arguments.length?(t=e,a):t},a},a=function(){var t=r().value("start"),e="end",n=function(n,r){return{object:{start:n.object[t.value()],end:r[e]},value:r[e]}};return t.reducer(function(r){for(var a=t.value(),i=t.redundant(),o=[],c={object:r[0],value:r[0][e]},l=1;l<r.length;l++)i(r[l][a],c.value)?c=n(c,r[l]):(o.push(c.object),c.object=r[l],c.value=r[l].end);return o.push(c.object),o}),r.join=function(e){return arguments.length?(n=e,t):n},r.value2=function(n){return arguments.length?(e=n,t):e},t},i=function(){var t=r();return t.reducer(function(e){for(var n=t.redundant(),r=t.value(),a=[],i=e[0],o=1;o<e.length-1;o++)n(e[o][r],i[r])||(a.push(i),i=e[o]);return a.push(i),a.push(e[e.length-1]),a}),t};e.exports=r,e.exports.line=i,e.exports.block=a},{}],9:[function(t,e,n){e.exports={iterator:function(t){var e=t||0,n=function(){return e++};return n},script_path:function(t){var e=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),n=new RegExp(e+"$"),r=new RegExp("(.*)"+e+"$"),a=document.getElementsByTagName("script"),i="";if(void 0!==a)for(var o in a)if(a[o].src&&a[o].src.match(n))return a[o].src.replace(r,"$1");return i},defer_cancel:function(t,e){var n,r=function(){var r=Array.prototype.slice.call(arguments),a=this;clearTimeout(n),n=setTimeout(function(){t.apply(a,r)},e)};return r}}},{}],10:[function(t,e,n){var r=t("tnt.api"),a=t("tnt.utils").defer_cancel,i=function(){"use strict";function t(t){t.parentNode.appendChild(t)}var e,n,i,o,c,l=[],u=50,s=0,f=920,d=20,h={species:void 0,chr:void 0,from:0,to:500},v={left:void 0,right:void 0},p=3,g=d3.rgb("#F8FBEF"),m=d3.behavior.zoom(),x={min:0,max:1e3,zoom_out:1e3,zoom_in:100},y=500,_=!0,w={ease:d3.ease("cubic-in-out"),extend_canvas:{left:0,right:0},show_frame:!0},b=function(t){n=d3.select(t).attr("id"),d3.select(t).classed("tnt",!0);var r=d3.select(t).append("div").attr("id","tnt_"+n).style("position","relative").classed("tnt_framed",!!w.show_frame).style("width",f+2*p+w.extend_canvas.right+w.extend_canvas.left+"px"),a=r.append("div").attr("class","tnt_groupDiv");e=a.append("svg").attr("class","tnt_svg").attr("width",f).attr("height",s).attr("pointer-events","all"),o=e.append("g").attr("transform","translate(0,20)").append("g").attr("class","tnt_g"),v.left=o.append("rect").attr("id","tnt_"+n+"_5pcap").attr("x",0).attr("y",0).attr("width",0).attr("height",s).attr("fill","red"),v.right=o.append("rect").attr("id","tnt_"+n+"_3pcap").attr("x",f-p).attr("y",0).attr("width",0).attr("height",s).attr("fill","red"),i=o.append("rect").attr("class","tnt_pane").attr("id","tnt_"+n+"_pane").attr("width",f).attr("height",s).style("fill",g)},k=r(b).getset(w).getset(x).getset(h);k.transform(b.extend_canvas,function(t){var e=b.extend_canvas();return t.left=t.left||e.left,t.right=t.right||e.right,t}),k.method("start",function(){x.max-x.min<x.zoom_out&&(x.zoom_out=x.max-x.min),A();for(var t=0;t<l.length;t++)l[t].g&&l[t].g.remove(),E(l[t]);z();var e=function(){h.to-h.from<x.zoom_in&&(h.from+x.zoom_in>x.max?h.to=x.max:h.to=h.from+x.zoom_in);for(var t=0;t<l.length;t++)j(l[t],h)};e()}),k.method("update",function(){for(var t=0;t<l.length;t++)j(l[t])});var j=function(t,e){if(t.data()){var n=t.data(),r=n;r.call(t,{loc:e,on_success:function(){t.display().update.call(t,e)}})}},A=function(){c=d3.scale.linear().domain([h.from,h.to]).range([0,f]),_&&o.call(m.x(c).scaleExtent([(h.to-h.from)/(x.zoom_out-1),(h.to-h.from)/x.zoom_in]).on("zoom",D))},C=function(t){for(var e=[],n=0;n<t.length;n++){for(var r=!1,a=0;a<l.length;a++)if(l[a].id()===t[n].id()){r=!0,e[a]=!0;break}r||(E(t[n]),j(t[n],{from:h.from,to:h.to}))}for(var i=0;i<l.length;i++)e[i]||l[i].g.remove();l=t,z()};k.method("scroll",function(t){var e=Math.abs(t);t>0?T(e,1):t<0&&T(e,-1)}),k.method("zoom",function(t){T(1/t,0)}),k.method("find_track",function(t){for(var e=0;e<l.length;e++)if(l[e].id()===t)return l[e]}),k.method("remove_track",function(t){t.g.remove()}),k.method("add_track",function(t){if(t instanceof Array){for(var e=0;e<t.length;e++)b.add_track(t[e]);return b}return l.push(t),b}),k.method("tracks",function(t){return arguments.length?(C(t),this):l}),k.method("width",function(t){if(!arguments.length)return f;if(t<u&&(t=u),void 0!==n){d3.select("#tnt_"+n).select("svg").attr("width",t),d3.select("#tnt_"+n).style("width",parseInt(t)+2*p+"px"),d3.select("#tnt_"+n+"_pane").attr("width",t),v.right.attr("x",t-p),f=t,c.range([0,f]),A();for(var e=0;e<l.length;e++)l[e].g.select("rect").attr("width",t),l[e].display().scale(c),l[e].display().reset.call(l[e]),l[e].display().init.call(l[e],t),l[e].display().update.call(l[e],h)}else f=t;return b}),k.method("allow_drag",function(t){return arguments.length?(_=t,_?void 0!==c&&o.call(m.x(c).scaleExtent([(h.to-h.from)/(x.zoom_out-1),(h.to-h.from)/x.zoom_in]).on("zoom",D)):m.x(d3.scale.linear()).on("zoom",null),b):_});var z=function(){for(var r=0,a=0;a<l.length;a++){var o=l[a];o.g.attr("transform")?o.g.transition().duration(y).attr("transform","translate("+w.extend_canvas.left+","+r+")"):o.g.attr("transform","translate("+w.extend_canvas.left+","+r+")"),r+=o.height()}return e.attr("height",r+d),d3.select("#tnt_"+n).style("height",r+10+d+"px"),d3.select("#tnt_"+n+"_5pcap").attr("height",r).each(function(e){t(this)}),d3.select("#tnt_"+n+"_3pcap").attr("height",r).each(function(e){t(this)}),i.attr("height",r+d),b},E=function(t){return t.g=e.select("g").select("g").append("g").attr("class","tnt_track").attr("height",t.height()),t.g.append("rect").attr("x",0).attr("y",0).attr("width",b.width()).attr("height",t.height()).style("fill",t.color()).style("pointer-events","none"),t.display()&&t.display().scale(c).init.call(t,f),b},T=function(t,e){var n,r=c.domain(),a=r[1]-r[0],i=a*t-a;switch(e){case 1:n=[~~r[0]-i,~~(r[1]-i)];break;case-1:n=[~~r[0]+i,~~(r[1]-i)];break;case 0:n=[r[0]-~~(i/2),r[1]+~~i/2]}var o=d3.interpolateNumber(r[0],n[0]),l=w.ease,u=0;d3.timer(function(){var t,n=o(l(u));switch(e){case-1:t=n+a;break;case 1:t=n+a;break;case 0:t=r[1]+r[0]-n}var i=[n,t];return c.domain(i),D(c),u+=.02,u>1})},N=function(){var t=c.domain();b.from(~~t[0]),b.to(~~t[1]);for(var e=0;e<l.length;e++){var n=l[e];j(n,h)}},P=a(N,300),D=function(t){void 0!==t&&_&&m.x(t);var e=c.domain();e[0]<=x.min+5&&d3.select("#tnt_"+n+"_5pcap").attr("width",p).transition().duration(200).attr("width",0),e[1]>=x.max-5&&d3.select("#tnt_"+n+"_3pcap").attr("width",p).transition().duration(200).attr("width",0),e[0]<x.min?m.translate([m.translate()[0]-c(x.min)+c.range()[0],m.translate()[1]]):e[1]>x.max&&m.translate([m.translate()[0]-c(x.max)+c.range()[1],m.translate()[1]]),P();for(var r=0;r<l.length;r++){var a=l[r];a.display().mover.call(a)}};return b};e.exports=n=i},{"tnt.api":3,"tnt.utils":5}],11:[function(t,e,n){var r=t("tnt.api"),a=t("./spinner.js")();tnt_data={},tnt_data.sync=function(){var t=function(e){var n=this;n.data().elements(t.retriever().call(n,e.loc)),e.on_success()};return r(t).getset("elements",[]).getset("retriever",function(){}),t},tnt_data.async=function(){var t=function(e){var n=this;a.on.call(n),t.retriever().call(n,e.loc).then(function(t){n.data().elements(t),e.on_success(),a.off.call(n)})};r(t).getset("elements",[]).getset("retriever");return t},tnt_data.empty=function(){var t=tnt_data.sync();return t},e.exports=n=tnt_data},{"./spinner.js":15,"tnt.api":3}],12:[function(t,e,n){var r=t("tnt.api"),a=t("./layout.js"),i=function(){var t=d3.dispatch("click","dblclick","mouseover","mouseout"),e={create:function(){throw"create_elem is not defined in the base feature object"},move:function(){throw"move_elem is not defined in the base feature object"},distribute:function(){},fixed:function(){},index:void 0,layout:a.identity(),color:"#000",scale:void 0},n={},i=function(){var t=this;t.g.selectAll(".tnt_elem").remove(),t.g.selectAll(".tnt_guider").remove(),t.g.selectAll(".tnt_fixed").remove()},o=function(t){var n=this;n.g.append("text").attr("class","tnt_fixed").attr("x",5).attr("y",12).attr("font-size",11).attr("fill","grey").text(n.label()),e.fixed.call(n,t)},c=function(n,r,a){n.on("click",function(e,n){d3.event.defaultPrevented||t.click.call(this,e,n)}),n.on("mouseover",function(e,n){d3.event.defaultPrevented||t.mouseover.call(this,e,n)}),n.on("dblclick",function(e,n){d3.event.defaultPrevented||t.dblclick.call(this,e,n)}),n.on("mouseout",function(e,n){d3.event.defaultPrevented||t.mouseout.call(this,e,n)}),e.create.call(r,n,a)},l=function(t,r){var a=this,i=a.g,o=a.data().elements();void 0!==r&&(o=o[r]);var c=e.layout.call(a,o);if(void 0!==c){var l,u;l=void 0!==r?i.selectAll(".tnt_elem_"+r):i.selectAll(".tnt_elem"),u=e.index?l.data(c,function(t){if(void 0!==t)return e.index(t)}):l.data(c),e.distribute.call(a,u,e.scale);var s=u.enter();s.append("g").attr("class","tnt_elem").classed("tnt_elem_"+r,r).call(n.plot,a,e.scale),u.exit().remove()}},u=function(t){var n,r=this,a=r.g;n=void 0!==t?a.selectAll(".tnt_elem_"+t):a.selectAll(".tnt_elem"),e.move.call(this,n)},s=function(t){t.parentNode.appendChild(t)},f=function(t){if(void 0!==t){var e=this,n=e.g;n.selectAll(".tnt_elem_"+t).each(function(){s(this)})}};return r(n).getset(e).method({reset:i,plot:c,update:l,mover:u,init:o,move_to_front:f}),d3.rebind(n,t,"on")};i.composite=function(){var t={},e=[],n={},a=function(){var e=this;for(var n in t)t.hasOwnProperty(n)&&t[n].reset.call(e)},i=function(e){var r=this;for(var a in t)t.hasOwnProperty(a)&&(t[a].scale(n.scale()),t[a].init.call(r,e))},o=function(){for(var n=this,r=0;r<e.length;r++)t[e[r]].update.call(n,void 0,e[r]),t[e[r]].move_to_front.call(n,e[r])},c=function(){var e=this;for(var n in t)t.hasOwnProperty(n)&&t[n].mover.call(e,n)},l=function(r,a){return t[r]=a,e.push(r),n},u=function(){for(var n=[],r=0;r<e.length;r++)n.push(t[e[r]]);return n};return r(n).getset("scale").method({reset:a,update:o,mover:c,init:i,add:l,displays:u}),n},i.area=function(){var t,e=i.line(),n=e.line(),r=d3.svg.area().interpolate(n.interpolate()).tension(e.tension()),a=e.create();e.create(function(i){var o=this,c=e.scale();void 0!==t&&o.g.select("path").remove(),a.call(o,i,c),r.x(n.x()).y1(n.y()).y0(o.height()),t=i.data(),i.remove(),o.g.append("path").attr("class","tnt_area").classed("tnt_elem",!0).datum(t).attr("d",r).attr("fill",d3.rgb(e.color()).brighter())});var o=e.move();return e.move(function(a){var i=this,c=e.scale();o.call(i,a,c),r.x(n.x()),i.g.select(".tnt_area").datum(t).attr("d",r)}),e},i.line=function(){var t=i(),e=function(t){return t.pos},n=function(t){return t.val},r=.7,a=d3.scale.linear(),o=d3.svg.line().interpolate("basis");t.line=function(){return o},t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(e){return arguments.length?(n=e,t):n},t.tension=function(e){return arguments.length?(r=e,t):r};var c;return t.create(function(i){var l=this,u=t.scale();void 0!==c&&l.g.select("path").remove(),o.tension(r).x(function(t){return u(e(t))}).y(function(t){return l.height()-a(n(t))}),c=i.data(),i.remove(),a.domain([0,1]).range([0,l.height()-2]),l.g.append("path").attr("class","tnt_elem").attr("d",o(c)).style("stroke",t.color()).style("stroke-width",4).style("fill","none")}),t.move(function(n){var r=this,a=t.scale();o.x(function(t){return a(e(t))}),r.g.select("path").attr("d",o(c))}),t},i.conservation=function(){var t=i.area(),e=t.create();return t.create(function(n){var r=this,a=t.scale();e.call(r,d3.select(n[0][0]),a)}),t},i.ensembl=function(){var t=i(),e="#7FFF00",n="#00BB00";return t.fixed(function(e){var n=this,r=~~(n.height()-.8*n.height())/2;n.g.append("line").attr("class","tnt_guider tnt_fixed").attr("x1",0).attr("x2",e).attr("y1",r).attr("y2",r).style("stroke",t.color()).style("stroke-width",1),n.g.append("line").attr("class","tnt_guider tnt_fixed").attr("x1",0).attr("x2",e).attr("y1",n.height()-r).attr("y2",n.height()-r).style("stroke",t.color()).style("stroke-width",1)}),t.create(function(e){var n=this,r=t.scale(),a=~~(n.height()-.8*n.height())/2;e.append("rect").attr("x",function(t){return r(t.start)}).attr("y",a).attr("width",function(t){return r(t.end)-r(t.start)}).attr("height",n.height()-~~(2*a)).attr("fill",n.color()).transition().duration(500).attr("fill",function(e){return"high"===e.type?d3.rgb(t.color()):"low"===e.type?d3.rgb(t.color2()):d3.rgb(t.color3())})}),t.distribute(function(e){var n=t.scale();e.select("rect").attr("width",function(t){return n(t.end)-n(t.start)})}),t.move(function(e){var n=t.scale();e.select("rect").attr("x",function(t){return n(t.start)}).attr("width",function(t){return n(t.end)-n(t.start)})}),t.color2=function(n){return arguments.length?(e=n,t):e},t.color3=function(e){return arguments.length?(n=e,t):n},t},i.vline=function(){var t=i();return t.create(function(e){var n=t.scale(),r=this;e.append("line").attr("x1",function(e){return n(t.index()(e))}).attr("x2",function(e){return n(t.index()(e))}).attr("y1",0).attr("y2",r.height()).attr("stroke",t.color()).attr("stroke-width",1)}),t.move(function(e){var n=t.scale();e.select("line").attr("x1",function(e){return n(t.index()(e))}).attr("x2",function(e){return n(t.index()(e))})}),t},i.pin=function(){var t=i(),e=d3.scale.linear().domain([0,0]).range([0,0]),n={pos:d3.functor("pos"),val:d3.functor("val"),domain:[0,1]},a=5;return r(t).getset(n),t.create(function(r){var i=this,o=t.scale();e.domain(t.domain()).range([a,i.height()-a-10]),r.append("line").attr("x1",function(t,e){return o(t[n.pos(t,e)])}).attr("y1",function(t){return i.height()}).attr("x2",function(t,e){return o(t[n.pos(t,e)])}).attr("y2",function(t,r){return i.height()-e(t[n.val(t,r)])}).attr("stroke",function(e){return d3.functor(t.color())(e)}),r.append("circle").attr("cx",function(t,e){return o(t[n.pos(t,e)])}).attr("cy",function(t,r){return i.height()-e(t[n.val(t,r)])}).attr("r",a).attr("fill",function(e){return d3.functor(t.color())(e)}),r.append("text").attr("font-size","13").attr("x",function(t,e){return o(t[n.pos(t,e)])}).attr("y",function(t,e){return 10}).style("text-anchor","middle").style("fill",function(e){return d3.functor(t.color())(e)}).text(function(t){return t.label||""})}),t.distribute(function(t){t.select("text").text(function(t){return t.label||""})}),t.move(function(r){var a=this,i=t.scale();r.select("line").attr("x1",function(t,e){return i(t[n.pos(t,e)])}).attr("y1",function(t){return a.height()}).attr("x2",function(t,e){return i(t[n.pos(t,e)])}).attr("y2",function(t,r){return a.height()-e(t[n.val(t,r)])}),r.select("circle").attr("cx",function(t,e){return i(t[n.pos(t,e)])}).attr("cy",function(t,r){return a.height()-e(t[n.val(t,r)])}),r.select("text").attr("x",function(t,e){return i(t[n.pos(t,e)])}).text(function(t){return t.label||""})}),t.fixed(function(t){var e=this;e.g.append("line").attr("class","tnt_fixed").attr("x1",0).attr("x2",t).attr("y1",e.height()).attr("y2",e.height()).style("stroke","black").style("stroke-with","1px")}),t},i.block=function(){var t=i();return r(t).getset("from",function(t){return t.start}).getset("to",function(t){return t.end}),t.create(function(e){var n=this,r=t.scale();e.append("rect").attr("x",function(e,n){return r(t.from()(e,n))}).attr("y",0).attr("width",function(e,n){return r(t.to()(e,n))-r(t.from()(e,n))}).attr("height",n.height()).attr("fill",n.color()).transition().duration(500).attr("fill",function(e){return void 0===e.color?t.color():e.color})}),t.distribute(function(e){var n=t.scale();e.select("rect").attr("width",function(t){return n(t.end)-n(t.start)})}),t.move(function(e){var n=t.scale();e.select("rect").attr("x",function(t){return n(t.start)}).attr("width",function(t){return n(t.end)-n(t.start)})}),t},i.axis=function(){var t,e,n="top",r={};return r.reset=function(){t=void 0;var e=this;e.g.selectAll(".tick").remove()},r.plot=function(){},r.mover=function(){var e=this,n=e.g;n.call(t)},r.init=function(){t=void 0},r.update=function(){void 0===t&&(t=d3.svg.axis().scale(e).orient(n));var r=this,a=r.g;a.call(t)},r.orientation=function(t){return arguments.length?(n=t,this):n},r.scale=function(t){return arguments.length?(e=t,this):e},r},i.location=function(){var t,e,n={};return n.reset=function(){t=void 0},n.plot=function(){},n.init=function(){t=void 0;var e=this;e.g.select("text").remove()},n.mover=function(){var n=e.domain();t.select("text").text("Location: "+~~n[0]+"-"+~~n[1])},n.scale=function(t){return arguments.length?(e=t,this):e},n.update=function(n){var r=this,a=r.g,i=e.domain();void 0===t&&(t=a,t.append("text").text("Location: "+Math.round(i[0])+"-"+Math.round(i[1])))},n},e.exports=n=i},{"./layout.js":14,"tnt.api":3}],13:[function(t,e,n){var r=t("./board.js");r.track=t("./track"),r.track.data=t("./data.js"),r.track.layout=t("./layout.js"),r.track.feature=t("./feature.js"),r.track.layout=t("./layout.js"),e.exports=n=r},{"./board.js":10,"./data.js":11,"./feature.js":12,"./layout.js":14,"./track":16}],14:[function(t,e,n){var r=t("tnt.api"),a=function(){var t=function(e){var n=this;return t.elements().call(n,e),e};r(t).getset("elements",function(){});return t};a.identity=function(){return a().elements(function(t){return t})},e.exports=n=a},{"tnt.api":3}],15:[function(t,e,n){var r=function(){function t(t,e,n){t.append("rect").attr("x","46.5").attr("y","40").attr("width","7").attr("height","20").attr("rx","5").attr("ry","5").attr("fill",d3.rgb(n).darker(2)).attr("transform","rotate("+30*e+" 50 50) translate(0 -30)").append("animate").attr("attributeName","opacity").attr("from","1").attr("to","0").attr("dur","1s").attr("begin",1/12*e+"s").attr("repeatCount","indefinite")}var e,n={};return n.on=function(){var n=this;if(n.spinner?n.spinner++:n.spinner=1,1==n.spinner){var r=n.g,a=n.color();e=r.append("svg").attr("class","tnt_spinner").attr("width","30px").attr("height","30px").attr("xmls","http://www.w3.org/2000/svg").attr("viewBox","0 0 100 100").attr("preserveAspectRatio","xMidYMid"),e.append("rect").attr("x","0").attr("y","0").attr("width","100").attr("height","100").attr("rx","50").attr("ry","50").attr("fill",a);for(var i=0;i<12;i++)t(e,i,a)}else if(n.spinner>0){var o=e.node();o.parentNode&&o.parentNode.appendChild(o)}},n.off=function(){var t=this;if(t.spinner--,!t.spinner){var e=t.g;e.selectAll(".tnt_spinner").remove()}},n};e.exports=n=r},{}],16:[function(t,e,n){var r=t("tnt.api"),a=t("tnt.utils").iterator,i=function(){"use strict";var t,e={color:d3.rgb("#CCCCCC"),height:250,data:i.data.empty(),label:"",id:i.id()},n={};r(n).getset(e);return n.display=function(n){if(!arguments.length)return t;if(t=n,"function"==typeof t)t.layout&&t.layout().height(e.height);else for(var r in t)t.hasOwnProperty(r)&&t[r].layout&&t[r].layout().height(e.height);return this},n};i.id=a(1),e.exports=n=i},{"tnt.api":3,"tnt.utils":5}]},{},[1]);