mpld3 0.5.3 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{mpld3.v0.5.2.min.js → mpld3.v0.5.7.min.js} +84 -35
- package/mpld3.v0.5.7.js +2079 -0
- package/mpld3.v0.5.7.min.js +2 -0
- package/package.json +3 -3
- package/mpld3.v0.5.2.js +0 -1820
- package/mpld3.v0.5.2.min.js +0 -2
package/mpld3.v0.5.2.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(t){function s(t){var s={};for(var i in t)s[i]=t[i];return s}function i(t,s){t="undefined"!=typeof t?t:10,s="undefined"!=typeof s?s:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var i=s.charAt(Math.round(Math.random()*(s.length-11))),e=1;t>e;e++)i+=s.charAt(Math.round(Math.random()*(s.length-1)));return i}function e(s,i){var e=t.interpolate([s[0].valueOf(),s[1].valueOf()],[i[0].valueOf(),i[1].valueOf()]);return function(t){var s=e(t);return[new Date(s[0]),new Date(s[1])]}}function o(t){return"undefined"==typeof t}function r(t){return null==t||o(t)}function n(t,s){return t.length>0?t[s%t.length]:null}function a(t){function s(t,s){var n=function(t){return"function"==typeof t?t:function(){return t}},a=n(i),p=n(e),h=[],l=[],c=0,u=-1,d=0,f=!1;if(!s){s=["M"];for(var y=1;y<t.length;y++)s.push("L")}for(;++u<s.length;){for(d=c+r[s[u]],h=[];d>c;)o.call(this,t[c],c)?(h.push(a.call(this,t[c],c),p.call(this,t[c],c)),c++):(h=null,c=d);h?f&&h.length>0?(l.push("M",h[0],h[1]),f=!1):(l.push(s[u]),l=l.concat(h)):f=!0}return c!=t.length&&console.warn("Warning: not all vertices used in Path"),l.join(" ")}var i=function(t,s){return t[0]},e=function(t,s){return t[1]},o=function(t,s){return!0},r={M:1,m:1,L:1,l:1,Q:2,q:2,T:1,t:1,S:2,s:2,C:3,c:3,Z:0,z:0};return s.x=function(t){return arguments.length?(i=t,s):i},s.y=function(t){return arguments.length?(e=t,s):e},s.defined=function(t){return arguments.length?(o=t,s):o},s.call=s,s}function p(t){function s(t){return i.forEach(function(s){t=s(t)}),t}var i=Array.prototype.slice.call(arguments,0),e=i.length;return s.domain=function(t){return arguments.length?(i[0].domain(t),s):i[0].domain()},s.range=function(t){return arguments.length?(i[e-1].range(t),s):i[e-1].range()},s.step=function(t){return i[t]},s}function h(t,s){if(_.call(this,t,s),this.cssclass="mpld3-"+this.props.xy+"grid","x"==this.props.xy)this.transform="translate(0,"+this.ax.height+")",this.position="bottom",this.scale=this.ax.xdom,this.tickSize=-this.ax.height;else{if("y"!=this.props.xy)throw"unrecognized grid xy specifier: should be 'x' or 'y'";this.transform="translate(0,0)",this.position="left",this.scale=this.ax.ydom,this.tickSize=-this.ax.width}}function l(t,s){_.call(this,t,s);var i={bottom:[0,this.ax.height],top:[0,0],left:[0,0],right:[this.ax.width,0]},e={bottom:"x",top:"x",left:"y",right:"y"};this.ax=t,this.transform="translate("+i[this.props.position]+")",this.props.xy=e[this.props.position],this.cssclass="mpld3-"+this.props.xy+"axis",this.scale=this.ax[this.props.xy+"dom"],this.tickNr=null,this.tickFormat=null}function c(t,s){if(this.trans=t,"undefined"==typeof s){if(this.ax=null,this.fig=null,"display"!==this.trans)throw"ax must be defined if transform != 'display'"}else this.ax=s,this.fig=s.fig;if(this.zoomable="data"===this.trans,this.x=this["x_"+this.trans],this.y=this["y_"+this.trans],"undefined"==typeof this.x||"undefined"==typeof this.y)throw"unrecognized coordinate code: "+this.trans}function u(t,s){_.call(this,t,s),this.data=t.fig.get_data(this.props.data),this.pathcodes=this.props.pathcodes,this.pathcoords=new c(this.props.coordinates,this.ax),this.offsetcoords=new c(this.props.offsetcoordinates,this.ax),this.datafunc=a()}function d(t,s){_.call(this,t,s),(null==this.props.facecolors||0==this.props.facecolors.length)&&(this.props.facecolors=["none"]),(null==this.props.edgecolors||0==this.props.edgecolors.length)&&(this.props.edgecolors=["none"]);var i=this.ax.fig.get_data(this.props.offsets);(null===i||0===i.length)&&(i=[null]);var e=Math.max(this.props.paths.length,i.length);if(i.length===e)this.offsets=i;else{this.offsets=[];for(var o=0;e>o;o++)this.offsets.push(n(i,o))}this.pathcoords=new c(this.props.pathcoordinates,this.ax),this.offsetcoords=new c(this.props.offsetcoordinates,this.ax)}function f(s,i){_.call(this,s,i);var e=this.props;e.facecolor="none",e.edgecolor=e.color,delete e.color,e.edgewidth=e.linewidth,delete e.linewidth;const o=e.drawstyle;switch(delete e.drawstyle,this.defaultProps=u.prototype.defaultProps,u.call(this,s,e),o){case"steps":case"steps-pre":this.datafunc=t.line().curve(t.curveStepBefore);break;case"steps-post":this.datafunc=t.line().curve(t.curveStepAfter);break;case"steps-mid":this.datafunc=t.line().curve(t.curveStep);break;default:this.datafunc=t.line().curve(t.curveLinear)}}function y(s,i){_.call(this,s,i),null!==this.props.markerpath?this.marker=0==this.props.markerpath[0].length?null:F.path().call(this.props.markerpath[0],this.props.markerpath[1]):this.marker=null===this.props.markername?null:t.symbol(this.props.markername).size(Math.pow(this.props.markersize,2))();var e={paths:[this.props.markerpath],offsets:s.fig.parse_offsets(s.fig.get_data(this.props.data,!0)),xindex:this.props.xindex,yindex:this.props.yindex,offsetcoordinates:this.props.coordinates,edgecolors:[this.props.edgecolor],edgewidths:[this.props.edgewidth],facecolors:[this.props.facecolor],alphas:[this.props.alpha],zorder:this.props.zorder,id:this.props.id};this.requiredProps=d.prototype.requiredProps,this.defaultProps=d.prototype.defaultProps,d.call(this,s,e)}function m(t,s){_.call(this,t,s),this.coords=new c(this.props.coordinates,this.ax)}function g(t,s){_.call(this,t,s),this.text=this.props.text,this.position=this.props.position,this.coords=new c(this.props.coordinates,this.ax)}function x(s,i){function e(t){return new Date(t[0],t[1],t[2],t[3],t[4],t[5])}function o(t,s){return"date"!==t?s:[e(s[0]),e(s[1])]}function r(s,i,e){var o="date"===s?t.scaleTime():"log"===s?t.scaleLog():t.scaleLinear();return o.domain(i).range(e)}_.call(this,s,i),this.axnum=this.fig.axes.length,this.axid=this.fig.figid+"_ax"+(this.axnum+1),this.clipid=this.axid+"_clip",this.props.xdomain=this.props.xdomain||this.props.xlim,this.props.ydomain=this.props.ydomain||this.props.ylim,this.sharex=[],this.sharey=[],this.elements=[],this.axisList=[];var n=this.props.bbox;this.position=[n[0]*this.fig.width,(1-n[1]-n[3])*this.fig.height],this.width=n[2]*this.fig.width,this.height=n[3]*this.fig.height,this.isZoomEnabled=null,this.zoom=null,this.lastTransform=t.zoomIdentity,this.isBoxzoomEnabled=null,this.isLinkedBrushEnabled=null,this.isCurrentLinkedBrushTarget=!1,this.brushG=null,this.props.xdomain=o(this.props.xscale,this.props.xdomain),this.props.ydomain=o(this.props.yscale,this.props.ydomain),this.x=this.xdom=r(this.props.xscale,this.props.xdomain,[0,this.width]),this.y=this.ydom=r(this.props.yscale,this.props.ydomain,[this.height,0]),"date"===this.props.xscale&&(this.x=F.multiscale(t.scaleLinear().domain(this.props.xlim).range(this.props.xdomain.map(Number)),this.xdom)),"date"===this.props.yscale&&(this.y=F.multiscale(t.scaleLinear().domain(this.props.ylim).range(this.props.ydomain.map(Number)),this.ydom));for(var a=this.props.axes,p=0;p<a.length;p++){var h=new F.Axis(this,a[p]);this.axisList.push(h),this.elements.push(h),(this.props.gridOn||h.props.grid.gridOn)&&this.elements.push(h.getGrid())}for(var l=this.props.paths,p=0;p<l.length;p++)this.elements.push(new F.Path(this,l[p]));for(var c=this.props.lines,p=0;p<c.length;p++)this.elements.push(new F.Line(this,c[p]));for(var u=this.props.markers,p=0;p<u.length;p++)this.elements.push(new F.Markers(this,u[p]));for(var d=this.props.texts,p=0;p<d.length;p++)this.elements.push(new F.Text(this,d[p]));for(var f=this.props.collections,p=0;p<f.length;p++)this.elements.push(new F.PathCollection(this,f[p]));for(var y=this.props.images,p=0;p<y.length;p++)this.elements.push(new F.Image(this,y[p]));this.elements.sort(function(t,s){return t.props.zorder-s.props.zorder})}function b(t,s){_.call(this,t,s),this.buttons=[],this.props.buttons.forEach(this.addButton.bind(this))}function v(t,s){_.call(this,t),this.toolbar=t,this.fig=this.toolbar.fig,this.cssclass="mpld3-"+s+"button",this.active=!1}function A(t,s){_.call(this,t,s)}function k(t,s){A.call(this,t,s);var i=F.ButtonFactory({buttonID:"reset",sticky:!1,onActivate:function(){this.toolbar.fig.reset()},icon:function(){return F.icons.reset}});this.fig.buttons.push(i)}function w(t,s){A.call(this,t,s),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var e=F.ButtonFactory({buttonID:"zoom",sticky:!0,actions:["scroll","drag"],onActivate:this.activate.bind(this),onDeactivate:this.deactivate.bind(this),onDraw:function(){this.setState(i)},icon:function(){return F.icons.move}});this.fig.buttons.push(e)}}function B(t,s){A.call(this,t,s),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var e=F.ButtonFactory({buttonID:"boxzoom",sticky:!0,actions:["drag"],onActivate:this.activate.bind(this),onDeactivate:this.deactivate.bind(this),onDraw:function(){this.setState(i)},icon:function(){return F.icons.zoom}});this.fig.buttons.push(e)}this.extentClass="boxzoombrush"}function z(t,s){A.call(this,t,s)}function E(t,s){F.Plugin.call(this,t,s),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var e=F.ButtonFactory({buttonID:"linkedbrush",sticky:!0,actions:["drag"],onActivate:this.activate.bind(this),onDeactivate:this.deactivate.bind(this),onDraw:function(){this.setState(i)},icon:function(){return F.icons.brush}});this.fig.buttons.push(e)}this.pathCollectionsByAxes=[],this.objectsByAxes=[],this.allObjects=[],this.extentClass="linkedbrush",this.dataKey="offsets",this.objectClass=null}function P(t,s){F.Plugin.call(this,t,s)}function O(s,i){_.call(this,null,i),this.figid=s,this.width=this.props.width,this.height=this.props.height,this.data=this.props.data,this.buttons=[],this.root=t.select("#"+s).append("div").style("position","relative"),this.axes=[];for(var e=0;e<this.props.axes.length;e++)this.axes.push(new x(this,this.props.axes[e]));this.plugins=[],this.pluginsByType={},this.props.plugins.forEach(function(t){this.addPlugin(t)}.bind(this)),this.toolbar=new F.Toolbar(this,{buttons:this.buttons})}function _(t,s){this.parent=r(t)?null:t,this.props=r(s)?{}:this.processProps(s),this.fig=t instanceof O?t:t&&"fig"in t?t.fig:null,this.ax=t instanceof x?t:t&&"ax"in t?t.ax:null}var F={_mpld3IsLoaded:!0,figures:[],plugin_map:{}};F.version="0.5.2",F.register_plugin=function(t,s){F.plugin_map[t]=s},F.remove_figure=function(t){var s=document.getElementById(t);null!==s&&(s.innerHTML="");for(var i=0;i<F.figures.length;i++){var e=F.figures[i];e.figid===t&&F.figures.splice(i,1)}return!0},F.draw_figure=function(t,s,i,e){var o=document.getElementById(t);if(e="undefined"!=typeof e?e:!1,e&&F.remove_figure(t),null===o)throw t+" is not a valid id";var r=new F.Figure(t,s);return i&&i(r,o),F.figures.push(r),r.draw(),r},F.cloneObj=s,F.boundsToTransform=function(t,s){var i=t.width,e=t.height,o=s[1][0]-s[0][0],r=s[1][1]-s[0][1],n=(s[0][0]+s[1][0])/2,a=(s[0][1]+s[1][1])/2,p=Math.max(1,Math.min(8,.9/Math.max(o/i,r/e))),h=[i/2-p*n,e/2-p*a];return{translate:h,scale:p}},F.getTransformation=function(t){var s=document.createElementNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform",t);var i,e,o,r=s.transform.baseVal.consolidate().matrix,n=r.a,a=r.b,p=r.c,h=r.d,l=r.e,c=r.f;(i=Math.sqrt(n*n+a*a))&&(n/=i,a/=i),(o=n*p+a*h)&&(p-=n*o,h-=a*o),(e=Math.sqrt(p*p+h*h))&&(p/=e,h/=e,o/=e),a*p>n*h&&(n=-n,a=-a,o=-o,i=-i);var u={translateX:l,translateY:c,rotate:180*Math.atan2(a,n)/Math.PI,skewX:180*Math.atan(o)/Math.PI,scaleX:i,scaleY:e},d="translate("+u.translateX+","+u.translateY+")rotate("+u.rotate+")skewX("+u.skewX+")scale("+u.scaleX+","+u.scaleY+")";return d},F.merge_objects=function(t){for(var s,i={},e=0;e<arguments.length;e++){s=arguments[e];for(var o in s)i[o]=s[o]}return i},F.generate_id=function(t,s){return console.warn("mpld3.generate_id is deprecated. Use mpld3.generateId instead."),i(t,s)},F.generateId=i,F.get_element=function(t,s){var i,e,o;i="undefined"==typeof s?F.figures:"undefined"==typeof s.length?[s]:s;for(var r=0;r<i.length;r++){if(s=i[r],s.props.id===t)return s;for(var n=0;n<s.axes.length;n++){if(e=s.axes[n],e.props.id===t)return e;for(var a=0;a<e.elements.length;a++)if(o=e.elements[a],o.props.id===t)return o}}return null},F.insert_css=function(t,s){var i=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style"),o=t+" {";for(var r in s)o+=r+":"+s[r]+"; ";o+="}",e.type="text/css",e.styleSheet?e.styleSheet.cssText=o:e.appendChild(document.createTextNode(o)),i.appendChild(e)},F.process_props=function(t,s,i,e){function o(t){_.call(this,null,t)}console.warn("mpld3.process_props is deprecated. Plot elements should derive from mpld3.PlotElement"),o.prototype=Object.create(_.prototype),o.prototype.constructor=o,o.prototype.requiredProps=e,o.prototype.defaultProps=i;var r=new o(s);return r.props},F.interpolateDates=e,F.path=function(){return a()},F.multiscale=p,F.icons={reset:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI\nWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gIcACMoD/OzIwAAAJhJREFUOMtjYKAx4KDUgNsMDAx7\nyNV8i4GB4T8U76VEM8mGYNNMtCH4NBM0hBjNMIwSsMzQ0MamcDkDA8NmQi6xggpUoikwQbIkHk2u\nE0rLI7vCBknBSyxeRDZAE6qHgQkq+ZeBgYERSfFPAoHNDNUDN4BswIRmKgxwEasP2dlsDAwMYlA/\n/mVgYHiBpkkGKscIDaPfVMmuAGnOTaGsXF0MAAAAAElFTkSuQmCC\n",move:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI\nWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gIcACQMfLHBNQAAANZJREFUOMud07FKA0EQBuAviaKB\nlFr7COJrpAyYRlKn8hECEkFEn8ROCCm0sBMRYgh5EgVFtEhsRjiO27vkBoZd/vn5d3b+XcrjFI9q\nxgXWkc8pUjOB93GMd3zgB9d1unjDSxmhWSHQqOJki+MtOuv/b3ZifUqctIrMxwhHuG1gim4Ma5kR\nWuEkXFgU4B0MW1Ho4TeyjX3s4TDq3zn8ALvZ7q5wX9DqLOHCDA95cFBAnOO1AL/ZdNopgY3fQcqF\nyriMe37hM9w521ZkkvlMo7o/8g7nZYQ/QDctp1nTCf0AAAAASUVORK5CYII=\n",zoom:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI\nWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gMPDiIRPL/2oQAAANBJREFUOMvF0b9KgzEcheHHVnCT\nKoI4uXbtLXgB3oJDJxevw1VwkoJ/NjepQ2/BrZRCx0ILFURQKV2kyOeSQpAmn7WDB0Lg955zEhLy\n2scdXlBggits+4WOQqjAJ3qYR7NGLrwXGU9+sGbEtlIF18FwmuBngZ+nCt6CIacC3Rx8LSl4xzgF\nn0tusBn4UyVhuA/7ZYIv5g+pE3ail25hN/qdmzCfpsJVjKKCZesDBwtzrAqGOMQj6vhCDRsY4ALH\nmOVObltR/xeG/jph6OD2r+Fv5lZBWEhMx58AAAAASUVORK5CYII=\n",brush:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI\nWXMAAEQkAABEJAFAZ8RUAAAAB3RJTUUH3gMCEiQKB9YaAgAAAWtJREFUOMuN0r1qVVEQhuFn700k\nnfEvBq0iNiIiOKXgH4KCaBeIhWARK/EibLwFCwVLjyAWaQzRGG9grC3URkHUBKKgRuWohWvL5pjj\nyTSLxcz7rZlZHyMiItqzFxGTEVF18/UoODNFxDIO4x12dkXqTcBPsCUzD+AK3ndFqhHwEsYz82gn\nN4dbmMRK9R/4KY7jAvbiWmYeHBT5Z4QCP8J1rGAeN3GvU3Mbl/Gq3qCDcxjLzOV+v78fq/iFIxFx\nPyJ2lNJpfBy2g59YzMyzEbEVLzGBJjOriLiBq5gaJrCIU3hcRCbwAtuwjm/Yg/V6I9NgDA1OR8RC\nZq6Vcd7iUwtn5h8fdMBdETGPE+Xe4ExELDRNs4bX2NfCUHe+7UExyfkCP8MhzOA7PuAkvrbwXyNF\nxF3MDqxiqlhXC7SPdaOKiN14g0u4g3H0MvOiTUSNY3iemb0ywmfMdfYyUmAJ2yPiBx6Wr/oy2Oqw\n+A1SupBzAOuE/AAAAABJRU5ErkJggg==\n"},F.Grid=h,h.prototype=Object.create(_.prototype),h.prototype.constructor=h,h.prototype.requiredProps=["xy"],h.prototype.defaultProps={color:"gray",dasharray:"2,2",alpha:"0.5",nticks:10,gridOn:!0,tickvalues:null,zorder:0},h.prototype.draw=function(){var s={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.position];this.grid=t[s](this.scale).ticks(this.props.nticks).tickValues(this.props.tickvalues).tickSize(this.tickSize,0,0).tickFormat(""),this.elem=this.ax.axes.append("g").attr("class",this.cssclass).attr("transform",this.transform).call(this.grid),F.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .tick",{stroke:this.props.color,"stroke-dasharray":this.props.dasharray,"stroke-opacity":this.props.alpha}),F.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" path",{"stroke-width":0}),F.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .domain",{"pointer-events":"none"})},h.prototype.zoomed=function(t){t?"x"==this.props.xy?this.elem.call(this.grid.scale(t.rescaleX(this.scale))):this.elem.call(this.grid.scale(t.rescaleY(this.scale))):this.elem.call(this.grid)},F.Axis=l,l.prototype=Object.create(_.prototype),l.prototype.constructor=l,l.prototype.requiredProps=["position"],l.prototype.defaultProps={nticks:10,tickvalues:null,tickformat:null,filtered_tickvalues:null,filtered_tickformat:null,tickformat_formatter:null,fontsize:"11px",fontcolor:"black",axiscolor:"black",scale:"linear",grid:{},zorder:0,visible:!0},l.prototype.getGrid=function(){var t={nticks:this.props.nticks,zorder:this.props.zorder,tickvalues:null,xy:this.props.xy};if(this.props.grid)for(var s in this.props.grid)t[s]=this.props.grid[s];return new h(this.ax,t)},l.prototype.wrapTicks=function(){function s(s,i,e){e=e||1.2,s.each(function(){for(var s,o=t.select(this),r=o.node().getBBox(),n=r.height,a=o.text().split(/\s+/).reverse(),p=[],h=0,l=o.attr("y"),c=n,u=o.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",c);s=a.pop();)p.push(s),u.text(p.join(" ")),u.node().getComputedTextLength()>i&&(p.pop(),u.text(p.join(" ")),p=[s],u=o.append("tspan").attr("x",0).attr("y",l).attr("dy",++h*(n*e)+c).text(s))})}var i=80;"x"==this.props.xy&&this.elem.selectAll("text").call(s,i)},l.prototype.draw=function(){var s="x"===this.props.xy?this.parent.props.xscale:this.parent.props.yscale;if("date"===s&&this.props.tickvalues){var i="x"===this.props.xy?this.parent.x.domain():this.parent.y.domain(),e="x"===this.props.xy?this.parent.xdom.domain():this.parent.ydom.domain(),o=t.scaleLinear().domain(i).range(e);this.props.tickvalues=this.props.tickvalues.map(function(t){return new Date(o(t))})}var r={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.props.position];this.axis=t[r](this.scale);var n=this;this.filter_ticks(this.axis.scale().domain()),"index"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,s){return n.props.filtered_tickformat[t]}):"percent"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(s,i){var e=s/n.props.tickformat.xmax*100,o=n.props.tickformat.decimals||0,r=t.format("."+o+"f")(e);return r+n.props.tickformat.symbol}):"str_method"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(s,i){var e=t.format(n.props.tickformat.format_string)(s);return n.props.tickformat.prefix+e+n.props.tickformat.suffix}):"fixed"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,s){return n.props.filtered_tickformat[s]}):this.tickFormat&&(this.axis=this.axis.tickFormat(this.tickFormat)),this.tickNr&&(this.axis=this.axis.ticks(this.tickNr)),this.axis=this.axis.tickValues(this.props.filtered_tickvalues),this.elem=this.ax.baseaxes.append("g").attr("transform",this.transform).attr("class",this.cssclass).call(this.axis),this.wrapTicks(),F.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" line, ."+this.cssclass+" path",{"shape-rendering":"crispEdges",stroke:this.props.axiscolor,fill:"none"}),F.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" text",{"font-family":"sans-serif","font-size":this.props.fontsize+"px",fill:this.props.fontcolor,stroke:"none"})},l.prototype.zoomed=function(t){this.filter_ticks(this.axis.scale().domain()),this.axis=this.axis.tickValues(this.props.filtered_tickvalues),t?("x"==this.props.xy?this.elem.call(this.axis.scale(t.rescaleX(this.scale))):this.elem.call(this.axis.scale(t.rescaleY(this.scale))),this.wrapTicks()):this.elem.call(this.axis)},l.prototype.setTicks=function(t,s){this.tickNr=t,this.tickFormat=s},l.prototype.filter_ticks=function(t){if(this.props.tickvalues){const s=this,i=this.props.tickvalues.map(function(t,s){return s}).filter(function(i,e){const o=s.props.tickvalues[i];return o>=t[0]&&o<=t[1]});this.props.filtered_tickvalues=this.props.tickvalues.filter(function(t,s){return i.includes(s)}),this.props.tickformat?this.props.filtered_tickformat=this.props.tickformat.filter(function(t,s){return i.includes(s)}):this.props.filtered_tickformat=this.props.tickformat}else this.props.filtered_tickvalues=this.props.tickvalues,this.props.filtered_tickformat=this.props.tickformat},F.Coordinates=c,c.prototype.xy=function(t,s,i){return s="undefined"==typeof s?0:s,i="undefined"==typeof i?1:i,[this.x(t[s]),this.y(t[i])]},c.prototype.x_data=function(t){return this.ax.x(t)},c.prototype.y_data=function(t){return this.ax.y(t)},c.prototype.x_display=function(t){return t},c.prototype.y_display=function(t){return t},c.prototype.x_axes=function(t){return t*this.ax.width},c.prototype.y_axes=function(t){return this.ax.height*(1-t)},c.prototype.x_figure=function(t){return t*this.fig.width-this.ax.position[0]},c.prototype.y_figure=function(t){return(1-t)*this.fig.height-this.ax.position[1]},F.Path=u,u.prototype=Object.create(_.prototype),u.prototype.constructor=u,u.prototype.requiredProps=["data"],u.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",facecolor:"green",edgecolor:"black",edgewidth:1,dasharray:"none",pathcodes:null,offset:null,offsetcoordinates:"data",alpha:1,drawstyle:"none",zorder:1},u.prototype.finiteFilter=function(t,s){return isFinite(this.pathcoords.x(t[this.props.xindex]))&&isFinite(this.pathcoords.y(t[this.props.yindex]))},u.prototype.draw=function(){if(this.datafunc.defined(this.finiteFilter.bind(this)).x(function(t){return this.pathcoords.x(t[this.props.xindex])}.bind(this)).y(function(t){return this.pathcoords.y(t[this.props.yindex])}.bind(this)),this.pathcoords.zoomable?this.path=this.ax.paths.append("svg:path"):this.path=this.ax.staticPaths.append("svg:path"),this.path=this.path.attr("d",this.datafunc(this.data,this.pathcodes)).attr("class","mpld3-path").style("stroke",this.props.edgecolor).style("stroke-width",this.props.edgewidth).style("stroke-dasharray",this.props.dasharray).style("stroke-opacity",this.props.alpha).style("fill",this.props.facecolor).style("fill-opacity",this.props.alpha).attr("vector-effect","non-scaling-stroke"),null!==this.props.offset){var t=this.offsetcoords.xy(this.props.offset);this.path.attr("transform","translate("+t+")")}},u.prototype.elements=function(t){return this.path},F.PathCollection=d,d.prototype=Object.create(_.prototype),d.prototype.constructor=d,d.prototype.requiredProps=["paths","offsets"],d.prototype.defaultProps={xindex:0,yindex:1,pathtransforms:[],pathcoordinates:"display",offsetcoordinates:"data",offsetorder:"before",edgecolors:["#000000"],drawstyle:"none",edgewidths:[1],facecolors:["#0000FF"],alphas:[1],zorder:2},d.prototype.transformFunc=function(t,s){var i=this.props.pathtransforms,e=0==i.length?"":F.getTransformation("matrix("+n(i,s)+")").toString(),o=null===t||"undefined"==typeof t?"translate(0, 0)":"translate("+this.offsetcoords.xy(t,this.props.xindex,this.props.yindex)+")";return"after"===this.props.offsetorder?e+o:o+e},d.prototype.pathFunc=function(t,s){return a().x(function(t){return this.pathcoords.x(t[0])}.bind(this)).y(function(t){return this.pathcoords.y(t[1])}.bind(this)).apply(this,n(this.props.paths,s))},d.prototype.styleFunc=function(t,s){var i={stroke:n(this.props.edgecolors,s),"stroke-width":n(this.props.edgewidths,s),"stroke-opacity":n(this.props.alphas,s),fill:n(this.props.facecolors,s),"fill-opacity":n(this.props.alphas,s)},e="";for(var o in i)e+=o+":"+i[o]+";";return e},d.prototype.allFinite=function(t){return t instanceof Array?t.length==t.filter(isFinite).length:!0},d.prototype.draw=function(){this.offsetcoords.zoomable||this.pathcoords.zoomable?this.group=this.ax.paths.append("svg:g"):this.group=this.ax.staticPaths.append("svg:g"),this.pathsobj=this.group.selectAll("paths").data(this.offsets.filter(this.allFinite)).enter().append("svg:path").attr("d",this.pathFunc.bind(this)).attr("class","mpld3-path").attr("transform",this.transformFunc.bind(this)).attr("style",this.styleFunc.bind(this)).attr("vector-effect","non-scaling-stroke")},d.prototype.elements=function(t){return this.group.selectAll("path")},F.Line=f,f.prototype=Object.create(u.prototype),f.prototype.constructor=f,f.prototype.requiredProps=["data"],f.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",color:"salmon",linewidth:2,dasharray:"none",alpha:1,zorder:2,drawstyle:"none"},F.Markers=y,y.prototype=Object.create(d.prototype),y.prototype.constructor=y,y.prototype.requiredProps=["data"],y.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",facecolor:"salmon",edgecolor:"black",edgewidth:1,alpha:1,markersize:6,markername:"circle",drawstyle:"none",markerpath:null,zorder:3},y.prototype.pathFunc=function(t,s){return this.marker},F.Image=m,m.prototype=Object.create(_.prototype),m.prototype.constructor=m,m.prototype.requiredProps=["data","extent"],m.prototype.defaultProps={alpha:1,coordinates:"data",drawstyle:"none",zorder:1},m.prototype.draw=function(){this.image=this.ax.paths.append("svg:image"),this.image=this.image.attr("class","mpld3-image").attr("xlink:href","data:image/png;base64,"+this.props.data).style("opacity",this.props.alpha).attr("preserveAspectRatio","none"),this.updateDimensions()},m.prototype.elements=function(s){return t.select(this.image)},m.prototype.updateDimensions=function(){var t=this.props.extent;this.image.attr("x",this.coords.x(t[0])).attr("y",this.coords.y(t[3])).attr("width",this.coords.x(t[1])-this.coords.x(t[0])).attr("height",this.coords.y(t[2])-this.coords.y(t[3]))},F.Text=g,g.prototype=Object.create(_.prototype),g.prototype.constructor=g,g.prototype.requiredProps=["text","position"],g.prototype.defaultProps={coordinates:"data",h_anchor:"start",v_baseline:"auto",rotation:0,fontsize:11,drawstyle:"none",color:"black",alpha:1,zorder:3},g.prototype.draw=function(){"data"==this.props.coordinates?this.coords.zoomable?this.obj=this.ax.paths.append("text"):this.obj=this.ax.staticPaths.append("text"):this.obj=this.ax.baseaxes.append("text"),this.obj.attr("class","mpld3-text").text(this.text).style("text-anchor",this.props.h_anchor).style("dominant-baseline",this.props.v_baseline).style("font-size",this.props.fontsize).style("fill",this.props.color).style("opacity",this.props.alpha),this.applyTransform()},g.prototype.elements=function(s){return t.select(this.obj)},g.prototype.applyTransform=function(){var t=this.coords.xy(this.position);this.obj.attr("x",t[0]).attr("y",t[1]),this.props.rotation&&this.obj.attr("transform","rotate("+this.props.rotation+","+t+")")},F.Axes=x,x.prototype=Object.create(_.prototype),x.prototype.constructor=x,x.prototype.requiredProps=["xlim","ylim"],x.prototype.defaultProps={bbox:[.1,.1,.8,.8],axesbg:"#FFFFFF",axesbgalpha:1,gridOn:!1,xdomain:null,ydomain:null,xscale:"linear",yscale:"linear",zoomable:!0,axes:[{position:"left"},{position:"bottom"}],lines:[],paths:[],markers:[],texts:[],collections:[],sharex:[],sharey:[],images:[]},x.prototype.draw=function(){for(var s=0;s<this.props.sharex.length;s++)this.sharex.push(F.get_element(this.props.sharex[s]));for(var s=0;s<this.props.sharey.length;s++)this.sharey.push(F.get_element(this.props.sharey[s]));this.baseaxes=this.fig.canvas.append("g").attr("transform","translate("+this.position[0]+","+this.position[1]+")").attr("width",this.width).attr("height",this.height).attr("class","mpld3-baseaxes"),this.axes=this.baseaxes.append("g").attr("class","mpld3-axes").style("pointer-events","visiblefill"),this.clip=this.axes.append("svg:clipPath").attr("id",this.clipid).append("svg:rect").attr("x",0).attr("y",0).attr("width",this.width).attr("height",this.height),this.axesbg=this.axes.append("svg:rect").attr("width",this.width).attr("height",this.height).attr("class","mpld3-axesbg").style("fill",this.props.axesbg).style("fill-opacity",this.props.axesbgalpha),this.pathsContainer=this.axes.append("g").attr("clip-path","url(#"+this.clipid+")").attr("x",0).attr("y",0).attr("width",this.width).attr("height",this.height).attr("class","mpld3-paths-container"),this.paths=this.pathsContainer.append("g").attr("class","mpld3-paths"),this.staticPaths=this.axes.append("g").attr("class","mpld3-staticpaths"),this.brush=t.brush().extent([[0,0],[this.fig.width,this.fig.height]]).on("start",this.brushStart.bind(this)).on("brush",this.brushMove.bind(this)).on("end",this.brushEnd.bind(this)).on("start.nokey",function(){t.select(window).on("keydown.brush keyup.brush",null)});for(var s=0;s<this.elements.length;s++)this.elements[s].draw()},x.prototype.bindZoom=function(){this.zoom||(this.zoom=t.zoom(),this.zoom.on("zoom",this.zoomed.bind(this)),this.axes.call(this.zoom))},x.prototype.unbindZoom=function(){this.zoom&&(this.zoom.on("zoom",null),this.axes.on(".zoom",null),this.zoom=null)},x.prototype.bindBrush=function(){this.brushG||(this.brushG=this.axes.append("g").attr("class","mpld3-brush").call(this.brush))},x.prototype.unbindBrush=function(){this.brushG&&(this.brushG.remove(),this.brushG.on(".brush",null),this.brushG=null)},x.prototype.reset=function(){this.zoom?this.doZoom(!1,t.zoomIdentity,750):(this.bindZoom(),this.doZoom(!1,t.zoomIdentity,750,function(){this.isSomeTypeOfZoomEnabled||this.unbindZoom()}.bind(this)))},x.prototype.enableOrDisableBrushing=function(){this.isBoxzoomEnabled||this.isLinkedBrushEnabled?this.bindBrush():this.unbindBrush()},x.prototype.isSomeTypeOfZoomEnabled=function(){return this.isZoomEnabled||this.isBoxzoomEnabled},x.prototype.enableOrDisableZooming=function(){this.isSomeTypeOfZoomEnabled()?this.bindZoom():this.unbindZoom()},x.prototype.enableLinkedBrush=function(){this.isLinkedBrushEnabled=!0,this.enableOrDisableBrushing()},x.prototype.disableLinkedBrush=function(){this.isLinkedBrushEnabled=!1,this.enableOrDisableBrushing()},x.prototype.enableBoxzoom=function(){this.isBoxzoomEnabled=!0,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},x.prototype.disableBoxzoom=function(){this.isBoxzoomEnabled=!1,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},x.prototype.enableZoom=function(){this.isZoomEnabled=!0,this.enableOrDisableZooming(),this.axes.style("cursor","move")},x.prototype.disableZoom=function(){this.isZoomEnabled=!1,this.enableOrDisableZooming(),this.axes.style("cursor",null)},x.prototype.doZoom=function(t,s,i,e){if(this.props.zoomable&&this.zoom){if(i){var o=this.axes.transition().duration(i).call(this.zoom.transform,s);e&&o.on("end",e)}else this.axes.call(this.zoom.transform,s);t?(this.lastTransform=s,this.sharex.forEach(function(t){t.doZoom(!1,s,i)}),this.sharey.forEach(function(t){t.doZoom(!1,s,i)})):this.lastTransform=s}},x.prototype.zoomed=function(){var s=t.event.sourceEvent&&"zoom"!=t.event.sourceEvent.type;if(s)this.doZoom(!0,t.event.transform,!1);else{var i=t.event.transform;this.paths.attr("transform",i),this.elements.forEach(function(t){t.zoomed&&t.zoomed(i)}.bind(this))}},x.prototype.resetBrush=function(){this.brushG.call(this.brush.move,null)},x.prototype.doBoxzoom=function(s){if(s&&this.brushG){var i=s.map(this.lastTransform.invert,this.lastTransform),e=i[1][0]-i[0][0],o=i[1][1]-i[0][1],r=(i[0][0]+i[1][0])/2,n=(i[0][1]+i[1][1])/2,a=e>o?this.width/e:this.height/o,p=this.width/2-a*r,h=this.height/2-a*n,l=t.zoomIdentity.translate(p,h).scale(a);this.doZoom(!0,l,750),this.resetBrush()}},x.prototype.brushStart=function(){this.isLinkedBrushEnabled&&(this.isCurrentLinkedBrushTarget="MouseEvent"==t.event.sourceEvent.constructor.name,this.isCurrentLinkedBrushTarget&&this.fig.resetBrushForOtherAxes(this.axid))},x.prototype.brushMove=function(){var s=t.event.selection;this.isLinkedBrushEnabled&&this.fig.updateLinkedBrush(s)},x.prototype.brushEnd=function(){var s=t.event.selection;this.isBoxzoomEnabled&&this.doBoxzoom(s),this.isLinkedBrushEnabled&&(s||this.fig.endLinkedBrush(),this.isCurrentLinkedBrushTarget=!1)},x.prototype.setTicks=function(t,s,i){this.axisList.forEach(function(e){e.props.xy==t&&e.setTicks(s,i)})},F.Toolbar=b,b.prototype=Object.create(_.prototype),b.prototype.constructor=b,b.prototype.defaultProps={buttons:["reset","move"]},b.prototype.addButton=function(t){this.buttons.push(new t(this))},b.prototype.draw=function(){function s(){this.buttonsobj.transition(750).attr("y",0)}function i(){this.buttonsobj.transition(750).delay(250).attr("y",16)}F.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image",{cursor:"pointer",opacity:.2,display:"inline-block",margin:"0px"}),F.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.active",{
|
|
2
|
-
opacity:.4}),F.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.pressed",{opacity:.6}),this.fig.canvas.on("mouseenter",s.bind(this)).on("mouseleave",i.bind(this)).on("touchenter",s.bind(this)).on("touchstart",s.bind(this)),this.toolbar=this.fig.canvas.append("svg:svg").attr("width",16*this.buttons.length).attr("height",16).attr("x",2).attr("y",this.fig.height-16-2).attr("class","mpld3-toolbar"),this.buttonsobj=this.toolbar.append("svg:g").selectAll("buttons").data(this.buttons).enter().append("svg:image").attr("class",function(t){return t.cssclass}).attr("xlink:href",function(t){return t.icon()}).attr("width",16).attr("height",16).attr("x",function(t,s){return 16*s}).attr("y",16).on("click",function(t){t.click()}).on("mouseenter",function(){t.select(this).classed("active",!0)}).on("mouseleave",function(){t.select(this).classed("active",!1)});for(var e=0;e<this.buttons.length;e++)this.buttons[e].onDraw()},b.prototype.deactivate_all=function(){this.buttons.forEach(function(t){t.deactivate()})},b.prototype.deactivate_by_action=function(t){function s(s){return-1!==t.indexOf(s)}t.length>0&&this.buttons.forEach(function(t){t.actions.filter(s).length>0&&t.deactivate()})},F.Button=v,v.prototype=Object.create(_.prototype),v.prototype.constructor=v,v.prototype.setState=function(t){t?this.activate():this.deactivate()},v.prototype.click=function(){this.active?this.deactivate():this.activate()},v.prototype.activate=function(){this.toolbar.deactivate_by_action(this.actions),this.onActivate(),this.active=!0,this.toolbar.toolbar.select("."+this.cssclass).classed("pressed",!0),this.sticky||this.deactivate()},v.prototype.deactivate=function(){this.onDeactivate(),this.active=!1,this.toolbar.toolbar.select("."+this.cssclass).classed("pressed",!1)},v.prototype.sticky=!1,v.prototype.actions=[],v.prototype.icon=function(){return""},v.prototype.onActivate=function(){},v.prototype.onDeactivate=function(){},v.prototype.onDraw=function(){},F.ButtonFactory=function(t){function s(t){v.call(this,t,this.buttonID)}if("string"!=typeof t.buttonID)throw"ButtonFactory: buttonID must be present and be a string";s.prototype=Object.create(v.prototype),s.prototype.constructor=s;for(var i in t)s.prototype[i]=t[i];return s},F.Plugin=A,A.prototype=Object.create(_.prototype),A.prototype.constructor=A,A.prototype.requiredProps=[],A.prototype.defaultProps={},A.prototype.draw=function(){},F.ResetPlugin=k,F.register_plugin("reset",k),k.prototype=Object.create(A.prototype),k.prototype.constructor=k,k.prototype.requiredProps=[],k.prototype.defaultProps={},F.ZoomPlugin=w,F.register_plugin("zoom",w),w.prototype=Object.create(A.prototype),w.prototype.constructor=w,w.prototype.requiredProps=[],w.prototype.defaultProps={button:!0,enabled:null},w.prototype.activate=function(){this.fig.enableZoom()},w.prototype.deactivate=function(){this.fig.disableZoom()},w.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},F.BoxZoomPlugin=B,F.register_plugin("boxzoom",B),B.prototype=Object.create(A.prototype),B.prototype.constructor=B,B.prototype.requiredProps=[],B.prototype.defaultProps={button:!0,enabled:null},B.prototype.activate=function(){this.fig.enableBoxzoom()},B.prototype.deactivate=function(){this.fig.disableBoxzoom()},B.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},F.TooltipPlugin=z,F.register_plugin("tooltip",z),z.prototype=Object.create(A.prototype),z.prototype.constructor=z,z.prototype.requiredProps=["id"],z.prototype.defaultProps={labels:null,hoffset:0,voffset:10,location:"mouse"},z.prototype.draw=function(){function s(t,s){this.tooltip.style("visibility","visible").text(null===r?"("+t+")":n(r,s))}function i(s,i){if("mouse"===a){var e=t.mouse(this.fig.canvas.node());this.x=e[0]+this.props.hoffset,this.y=e[1]-this.props.voffset}this.tooltip.attr("x",this.x).attr("y",this.y)}function e(t,s){this.tooltip.style("visibility","hidden")}var o=F.get_element(this.props.id,this.fig),r=this.props.labels,a=this.props.location;this.tooltip=this.fig.canvas.append("text").attr("class","mpld3-tooltip-text").attr("x",0).attr("y",0).text("").style("visibility","hidden"),"bottom left"==a||"top left"==a?(this.x=o.ax.position[0]+5+this.props.hoffset,this.tooltip.style("text-anchor","beginning")):"bottom right"==a||"top right"==a?(this.x=o.ax.position[0]+o.ax.width-5+this.props.hoffset,this.tooltip.style("text-anchor","end")):this.tooltip.style("text-anchor","middle"),"bottom left"==a||"bottom right"==a?this.y=o.ax.position[1]+o.ax.height-5+this.props.voffset:("top left"==a||"top right"==a)&&(this.y=o.ax.position[1]+5+this.props.voffset),o.elements().on("mouseover",s.bind(this)).on("mousemove",i.bind(this)).on("mouseout",e.bind(this))},F.LinkedBrushPlugin=E,F.register_plugin("linkedbrush",E),E.prototype=Object.create(F.Plugin.prototype),E.prototype.constructor=E,E.prototype.requiredProps=["id"],E.prototype.defaultProps={button:!0,enabled:null},E.prototype.activate=function(){this.fig.enableLinkedBrush()},E.prototype.deactivate=function(){this.fig.disableLinkedBrush()},E.prototype.isPathInSelection=function(t,s,i,e){var o=e[0][0]<t[s]&&e[1][0]>t[s]&&e[0][1]<t[i]&&e[1][1]>t[i];return o},E.prototype.invertSelection=function(t,s){var i=[s.x.invert(t[0][0]),s.x.invert(t[1][0])],e=[s.y.invert(t[1][1]),s.y.invert(t[0][1])];return[[Math.min.apply(Math,i),Math.min.apply(Math,e)],[Math.max.apply(Math,i),Math.max.apply(Math,e)]]},E.prototype.update=function(t){t&&this.pathCollectionsByAxes.forEach(function(s,i){var e=s[0],o=this.objectsByAxes[i],r=this.invertSelection(t,this.fig.axes[i]),n=e.props.xindex,a=e.props.yindex;o.selectAll("path").classed("mpld3-hidden",function(t,s){return!this.isPathInSelection(t,n,a,r)}.bind(this))}.bind(this))},E.prototype.end=function(){this.allObjects.selectAll("path").classed("mpld3-hidden",!1)},E.prototype.draw=function(){F.insert_css("#"+this.fig.figid+" path.mpld3-hidden",{stroke:"#ccc !important",fill:"#ccc !important"});var t=F.get_element(this.props.id);if(!t)throw new Error("[LinkedBrush] Could not find path collection");if(!("offsets"in t.props))throw new Error("[LinkedBrush] Figure is not a scatter plot.");this.objectClass="mpld3-brushtarget-"+t.props[this.dataKey],this.pathCollectionsByAxes=this.fig.axes.map(function(s){return s.elements.map(function(s){return s.props[this.dataKey]==t.props[this.dataKey]?(s.group.classed(this.objectClass,!0),s):void 0}.bind(this)).filter(function(t){return t})}.bind(this)),this.objectsByAxes=this.fig.axes.map(function(t){return t.axes.selectAll("."+this.objectClass)}.bind(this)),this.allObjects=this.fig.canvas.selectAll("."+this.objectClass)},F.register_plugin("mouseposition",P),P.prototype=Object.create(F.Plugin.prototype),P.prototype.constructor=P,P.prototype.requiredProps=[],P.prototype.defaultProps={fontsize:12,fmt:".3g"},P.prototype.draw=function(){for(var s=this.fig,i=t.format(this.props.fmt),e=s.canvas.append("text").attr("class","mpld3-coordinates").style("text-anchor","end").style("font-size",this.props.fontsize).attr("x",this.fig.width-5).attr("y",this.fig.height-5),o=0;o<this.fig.axes.length;o++){var r=function(){var r=s.axes[o];return function(){var s=t.mouse(this),o=r.x.invert(s[0]),n=r.y.invert(s[1]);e.text("("+i(o)+", "+i(n)+")")}}();s.axes[o].baseaxes.on("mousemove",r).on("mouseout",function(){e.text("")})}},F.Figure=O,O.prototype=Object.create(_.prototype),O.prototype.constructor=O,O.prototype.requiredProps=["width","height"],O.prototype.defaultProps={data:{},axes:[],plugins:[{type:"reset"},{type:"zoom"},{type:"boxzoom"}]},O.prototype.addPlugin=function(t){if(!t.type)return console.warn("unspecified plugin type. Skipping this");var i;if(!(t.type in F.plugin_map))return console.warn("Skipping unrecognized plugin: "+i);i=F.plugin_map[t.type],(t.clear_toolbar||t.buttons)&&console.warn("DEPRECATION WARNING: You are using pluginInfo.clear_toolbar or pluginInfo, which have been deprecated. Please see the build-in plugins for the new method to add buttons, otherwise contact the mpld3 maintainers.");var e=s(t);delete e.type;var o=new i(this,e);this.plugins.push(o),this.pluginsByType[t.type]=o},O.prototype.draw=function(){F.insert_css("div#"+this.figid,{"font-family":"Helvetica, sans-serif"}),this.canvas=this.root.append("svg:svg").attr("class","mpld3-figure").attr("width",this.width).attr("height",this.height);for(var t=0;t<this.axes.length;t++)this.axes[t].draw();this.disableZoom();for(var t=0;t<this.plugins.length;t++)this.plugins[t].draw();this.toolbar.draw()},O.prototype.resetBrushForOtherAxes=function(t){this.axes.forEach(function(s){s.axid!=t&&s.resetBrush()})},O.prototype.updateLinkedBrush=function(t){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.update(t)},O.prototype.endLinkedBrush=function(){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.end()},O.prototype.reset=function(t){this.axes.forEach(function(t){t.reset()})},O.prototype.enableLinkedBrush=function(){this.axes.forEach(function(t){t.enableLinkedBrush()})},O.prototype.disableLinkedBrush=function(){this.axes.forEach(function(t){t.disableLinkedBrush()})},O.prototype.enableBoxzoom=function(){this.axes.forEach(function(t){t.enableBoxzoom()})},O.prototype.disableBoxzoom=function(){this.axes.forEach(function(t){t.disableBoxzoom()})},O.prototype.enableZoom=function(){this.axes.forEach(function(t){t.enableZoom()})},O.prototype.disableZoom=function(){this.axes.forEach(function(t){t.disableZoom()})},O.prototype.toggleZoom=function(){this.isZoomEnabled?this.disableZoom():this.enableZoom()},O.prototype.setTicks=function(t,s,i){this.axes.forEach(function(e){e.setTicks(t,s,i)})},O.prototype.setXTicks=function(t,s){this.setTicks("x",t,s)},O.prototype.setYTicks=function(t,s){this.setTicks("y",t,s)},O.prototype.removeNaN=function(t){output=output.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},O.prototype.parse_offsets=function(t){return t.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},O.prototype.get_data=function(t){var s=t;return null===t||"undefined"==typeof t?s=null:"string"==typeof t&&(s=this.data[t]),s},F.PlotElement=_,_.prototype.requiredProps=[],_.prototype.defaultProps={},_.prototype.processProps=function(t){t=s(t);var i={},e=this.name();this.requiredProps.forEach(function(s){if(!(s in t))throw"property '"+s+"' must be specified for "+e;i[s]=t[s],delete t[s]});for(var o in this.defaultProps)o in t?(i[o]=t[o],delete t[o]):i[o]=this.defaultProps[o];"id"in t?(i.id=t.id,delete t.id):"id"in i||(i.id=F.generateId());for(var o in t)console.warn("Unrecognized property '"+o+"' for object "+this.name()+" (value = "+t[o]+").");return i},_.prototype.name=function(){var t=/function (.{1,})\(/,s=t.exec(this.constructor.toString());return s&&s.length>1?s[1]:""},"object"==typeof module&&module.exports?module.exports=F:this.mpld3=F,console.log("Loaded mpld3 version "+F.version)}(d3);
|