mpld3 0.5.11 → 0.5.12
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mpld3 = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
-
function mpld3_cloneObj(t){var e={};for(var i in t)e[i]=t[i];return e}function mpld3_generateId(t,e){t="undefined"!=typeof t?t:10,e="undefined"!=typeof e?e:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var i=e.charAt(Math.round(Math.random()*(e.length-11))),s=1;t>s;s++)i+=e.charAt(Math.round(Math.random()*(e.length-1)));return i}function mpld3_interpolateDates(t,e){var i=d3.interpolate([t[0].valueOf(),t[1].valueOf()],[e[0].valueOf(),e[1].valueOf()]);return function(t){var e=i(t);return[new Date(e[0]),new Date(e[1])]}}function isUndefined(t){return"undefined"==typeof t}function isUndefinedOrNull(t){return null==t||isUndefined(t)}function getMod(t,e){return t.length>0?t[e%t.length]:null}function mpld3_path(t){function e(t,e){var n=function(t){return"function"==typeof t?t:function(){return t}},p=n(i),a=n(s),l=[],h=[],d=0,c=-1,u=0,m=!1;if(!e){e=["M"];for(var f=1;f<t.length;f++)e.push("L")}for(;++c<e.length;){for(u=d+r[e[c]],l=[];u>d;)o.call(this,t[d],d)?(l.push(p.call(this,t[d],d),a.call(this,t[d],d)),d++):(l=null,d=u);l?m&&l.length>0?(h.push("M",l[0],l[1]),m=!1):(h.push(e[c]),h=h.concat(l)):m=!0}return d!=t.length&&console.warn("Warning: not all vertices used in Path"),h.join(" ")}var i=function(t,e){return t[0]},s=function(t,e){return t[1]},o=function(t,e){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 e.x=function(t){return arguments.length?(i=t,e):i},e.y=function(t){return arguments.length?(s=t,e):s},e.defined=function(t){return arguments.length?(o=t,e):o},e.call=e,e}function mpld3_multiscale(t){function e(t){return i.forEach(function(e){t=e(t)}),t}var i=Array.prototype.slice.call(arguments,0),s=i.length;return e.domain=function(t){return arguments.length?(i[0].domain(t),e):i[0].domain()},e.range=function(t){return arguments.length?(i[s-1].range(t),e):i[s-1].range()},e.step=function(t){return i[t]},e}function mpld3_Grid(t,e){if(mpld3_PlotElement.call(this,t,e),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 mpld3_Axis(t,e){mpld3_PlotElement.call(this,t,e);var i={bottom:[0,this.ax.height],top:[0,0],left:[0,0],right:[this.ax.width,0]},s={bottom:"x",top:"x",left:"y",right:"y"};this.ax=t,this.transform="translate("+i[this.props.position]+")",this.props.xy=s[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 mpld3_Coordinates(t,e){if(this.trans=t,"undefined"==typeof e){if(this.ax=null,this.fig=null,"display"!==this.trans)throw"ax must be defined if transform != 'display'"}else this.ax=e,this.fig=e.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 mpld3_Path(t,e){mpld3_PlotElement.call(this,t,e),this.data=t.fig.get_data(this.props.data),this.pathcodes=this.props.pathcodes,this.pathcoords=new mpld3_Coordinates(this.props.coordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax),this.datafunc=mpld3_path()}function mpld3_PathCollection(t,e){mpld3_PlotElement.call(this,t,e),(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 s=Math.max(this.props.paths.length,i.length);if(i.length===s)this.offsets=i;else{this.offsets=[];for(var o=0;s>o;o++)this.offsets.push(getMod(i,o))}this.pathcoords=new mpld3_Coordinates(this.props.pathcoordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax)}function mpld3_Line(t,e){mpld3_PlotElement.call(this,t,e);var i=this.props;i.facecolor="none",i.edgecolor=i.color,delete i.color,i.edgewidth=i.linewidth,delete i.linewidth;const s=i.drawstyle;switch(delete i.drawstyle,this.defaultProps=mpld3_Path.prototype.defaultProps,mpld3_Path.call(this,t,i),s){case"steps":case"steps-pre":this.datafunc=d3.line().curve(d3.curveStepBefore);break;case"steps-post":this.datafunc=d3.line().curve(d3.curveStepAfter);break;case"steps-mid":this.datafunc=d3.line().curve(d3.curveStep);break;default:this.datafunc=d3.line().curve(d3.curveLinear)}}function mpld3_Markers(t,e){mpld3_PlotElement.call(this,t,e),null!==this.props.markerpath?this.marker=0==this.props.markerpath[0].length?null:mpld3.path().call(this.props.markerpath[0],this.props.markerpath[1]):this.marker=null===this.props.markername?null:d3.symbol(this.props.markername).size(Math.pow(this.props.markersize,2))();var i={paths:[this.props.markerpath],offsets:t.fig.parse_offsets(t.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=mpld3_PathCollection.prototype.requiredProps,this.defaultProps=mpld3_PathCollection.prototype.defaultProps,mpld3_PathCollection.call(this,t,i)}function mpld3_Image(t,e){mpld3_PlotElement.call(this,t,e),this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Text(t,e){mpld3_PlotElement.call(this,t,e),this.text=this.props.text,this.position=this.props.position,this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Axes(t,e){function i(t){return new Date(t[0],t[1],t[2],t[3],t[4],t[5])}function s(t,e){return"date"!==t?e:[i(e[0]),i(e[1])]}function o(t,e,i){var s="date"===t?d3.scaleTime():"log"===t?d3.scaleLog():d3.scaleLinear();return s.domain(e).range(i)}mpld3_PlotElement.call(this,t,e),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 r=this.props.bbox;this.position=[r[0]*this.fig.width,(1-r[1]-r[3])*this.fig.height],this.width=r[2]*this.fig.width,this.height=r[3]*this.fig.height,this.isZoomEnabled=null,this.zoom=null,this.lastTransform=d3.zoomIdentity,this.isBoxzoomEnabled=null,this.isLinkedBrushEnabled=null,this.isCurrentLinkedBrushTarget=!1,this.brushG=null,this.props.xdomain=s(this.props.xscale,this.props.xdomain),this.props.ydomain=s(this.props.yscale,this.props.ydomain),this.x=this.xdom=o(this.props.xscale,this.props.xdomain,[0,this.width]),this.y=this.ydom=o(this.props.yscale,this.props.ydomain,[this.height,0]),"date"===this.props.xscale&&(this.x=mpld3.multiscale(d3.scaleLinear().domain(this.props.xlim).range(this.props.xdomain.map(Number)),this.xdom)),"date"===this.props.yscale&&(this.y=mpld3.multiscale(d3.scaleLinear().domain(this.props.ylim).range(this.props.ydomain.map(Number)),this.ydom));for(var n=this.props.axes,p=0;p<n.length;p++){var a=new mpld3.Axis(this,n[p]);this.axisList.push(a),this.elements.push(a),(this.props.gridOn||a.props.grid.gridOn)&&this.elements.push(a.getGrid())}for(var l=this.props.paths,p=0;p<l.length;p++)this.elements.push(new mpld3.Path(this,l[p]));for(var h=this.props.lines,p=0;p<h.length;p++)this.elements.push(new mpld3.Line(this,h[p]));for(var d=this.props.markers,p=0;p<d.length;p++)this.elements.push(new mpld3.Markers(this,d[p]));for(var c=this.props.texts,p=0;p<c.length;p++)this.elements.push(new mpld3.Text(this,c[p]));for(var u=this.props.collections,p=0;p<u.length;p++)this.elements.push(new mpld3.PathCollection(this,u[p]));for(var m=this.props.images,p=0;p<m.length;p++)this.elements.push(new mpld3.Image(this,m[p]));this.elements.sort(function(t,e){return t.props.zorder-e.props.zorder})}function mpld3_Toolbar(t,e){mpld3_PlotElement.call(this,t,e),this.buttons=[],this.props.buttons.forEach(this.addButton.bind(this))}function mpld3_Button(t,e){mpld3_PlotElement.call(this,t),this.toolbar=t,this.fig=this.toolbar.fig,this.cssclass="mpld3-"+e+"button",this.active=!1}function mpld3_Plugin(t,e){mpld3_PlotElement.call(this,t,e)}function mpld3_ResetPlugin(t,e){mpld3_Plugin.call(this,t,e);var i=mpld3.ButtonFactory({buttonID:"reset",sticky:!1,onActivate:function(){this.toolbar.fig.reset()},icon:function(){return mpld3.icons.reset}});this.fig.buttons.push(i)}function mpld3_ZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.move}});this.fig.buttons.push(s)}}function mpld3_BoxZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.zoom}});this.fig.buttons.push(s)}this.extentClass="boxzoombrush"}function mpld3_TooltipPlugin(t,e){mpld3_Plugin.call(this,t,e)}function mpld3_LinkedBrushPlugin(t,e){mpld3.Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.brush}});this.fig.buttons.push(s)}this.pathCollectionsByAxes=[],this.objectsByAxes=[],this.allObjects=[],this.extentClass="linkedbrush",this.dataKey="offsets",this.objectClass=null}function MousePositionPlugin(t,e){mpld3.Plugin.call(this,t,e)}function mpld3_Figure(t,e){mpld3_PlotElement.call(this,null,e),this.figid=t,this.width=this.props.width,this.height=this.props.height,this.data=this.props.data,this.buttons=[],this.root=d3.select("#"+t).append("div").style("position","relative"),this.axes=[];for(var i=0;i<this.props.axes.length;i++)this.axes.push(new mpld3_Axes(this,this.props.axes[i]));this.plugins=[],this.pluginsByType={},this.props.plugins.forEach(function(t){this.addPlugin(t)}.bind(this)),this.toolbar=new mpld3.Toolbar(this,{buttons:this.buttons})}function mpld3_PlotElement(t,e){this.parent=isUndefinedOrNull(t)?null:t,this.props=isUndefinedOrNull(e)?{}:this.processProps(e),this.fig=t instanceof mpld3_Figure?t:t&&"fig"in t?t.fig:null,this.ax=t instanceof mpld3_Axes?t:t&&"ax"in t?t.ax:null}if(!d3)var d3=require("d3");var mpld3={_mpld3IsLoaded:!0,figures:[],plugin_map:{}};mpld3.version="0.5.11",mpld3.register_plugin=function(t,e){mpld3.plugin_map[t]=e},mpld3.remove_figure=function(t){var e=document.getElementById(t);null!==e&&(e.innerHTML="");for(var i=0;i<mpld3.figures.length;i++){var s=mpld3.figures[i];s.figid===t&&mpld3.figures.splice(i,1)}return!0},mpld3.draw_figure=function(t,e,i,s){var o=document.getElementById(t);if(s="undefined"!=typeof s?s:!1,s&&mpld3.remove_figure(t),null===o)throw t+" is not a valid id";var r=new mpld3.Figure(t,e);return i&&i(r,o),mpld3.figures.push(r),r.draw(),r},mpld3.cloneObj=mpld3_cloneObj,mpld3.boundsToTransform=function(t,e){var i=t.width,s=t.height,o=e[1][0]-e[0][0],r=e[1][1]-e[0][1],n=(e[0][0]+e[1][0])/2,p=(e[0][1]+e[1][1])/2,a=Math.max(1,Math.min(8,.9/Math.max(o/i,r/s))),l=[i/2-a*n,s/2-a*p];return{translate:l,scale:a}},mpld3.getTransformation=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","g");e.setAttributeNS(null,"transform",t);var i,s,o,r=e.transform.baseVal.consolidate().matrix,n=r.a,p=r.b,a=r.c,l=r.d,h=r.e,d=r.f;(i=Math.sqrt(n*n+p*p))&&(n/=i,p/=i),(o=n*a+p*l)&&(a-=n*o,l-=p*o),(s=Math.sqrt(a*a+l*l))&&(a/=s,l/=s,o/=s),p*a>n*l&&(n=-n,p=-p,o=-o,i=-i);var c={translateX:h,translateY:d,rotate:180*Math.atan2(p,n)/Math.PI,skewX:180*Math.atan(o)/Math.PI,scaleX:i,scaleY:s},u="translate("+c.translateX+","+c.translateY+")rotate("+c.rotate+")skewX("+c.skewX+")scale("+c.scaleX+","+c.scaleY+")";return u},mpld3.merge_objects=function(t){for(var e,i={},s=0;s<arguments.length;s++){e=arguments[s];for(var o in e)i[o]=e[o]}return i},mpld3.generate_id=function(t,e){return console.warn("mpld3.generate_id is deprecated. Use mpld3.generateId instead."),mpld3_generateId(t,e)},mpld3.generateId=mpld3_generateId,mpld3.get_element=function(t,e){var i,s,o;i="undefined"==typeof e?mpld3.figures:"undefined"==typeof e.length?[e]:e;for(var r=0;r<i.length;r++){if(e=i[r],e.props.id===t)return e;for(var n=0;n<e.axes.length;n++){if(s=e.axes[n],s.props.id===t)return s;for(var p=0;p<s.elements.length;p++)if(o=s.elements[p],o.props.id===t)return o}}return null},mpld3.insert_css=function(t,e){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style"),o=t+" {";for(var r in e)o+=r+":"+e[r]+"; ";o+="}",s.type="text/css",s.styleSheet?s.styleSheet.cssText=o:s.appendChild(document.createTextNode(o)),i.appendChild(s)},mpld3.process_props=function(t,e,i,s){function o(t){mpld3_PlotElement.call(this,null,t)}console.warn("mpld3.process_props is deprecated. Plot elements should derive from mpld3.PlotElement"),o.prototype=Object.create(mpld3_PlotElement.prototype),o.prototype.constructor=o,o.prototype.requiredProps=s,o.prototype.defaultProps=i;var r=new o(e);return r.props},mpld3.interpolateDates=mpld3_interpolateDates,mpld3.path=function(){return mpld3_path()},mpld3.multiscale=mpld3_multiscale,mpld3.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"},mpld3.Grid=mpld3_Grid,mpld3_Grid.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Grid.prototype.constructor=mpld3_Grid,mpld3_Grid.prototype.requiredProps=["xy"],mpld3_Grid.prototype.defaultProps={color:"gray",dasharray:"2,2",alpha:"0.5",nticks:10,gridOn:!0,tickvalues:null,zorder:0},mpld3_Grid.prototype.draw=function(){var t={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.position];this.grid=d3[t](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),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .tick",{stroke:this.props.color,"stroke-dasharray":this.props.dasharray,"stroke-opacity":this.props.alpha}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" path",{"stroke-width":0}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .domain",{"pointer-events":"none"})},mpld3_Grid.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)},mpld3.Axis=mpld3_Axis,mpld3_Axis.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axis.prototype.constructor=mpld3_Axis,mpld3_Axis.prototype.requiredProps=["position"],mpld3_Axis.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},mpld3_Axis.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 e in this.props.grid)t[e]=this.props.grid[e];return new mpld3_Grid(this.ax,t)},mpld3_Axis.prototype.wrapTicks=function(){function t(t,e,i){i=i||1.2,t.each(function(){for(var t,s=d3.select(this),o=s.node().getBBox(),r=o.height,n=s.text().split(/\s+/).reverse(),p=[],a=0,l=s.attr("y"),h=r,d=s.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",h);t=n.pop();)p.push(t),d.text(p.join(" ")),d.node().getComputedTextLength()>e&&(p.pop(),d.text(p.join(" ")),p=[t],d=s.append("tspan").attr("x",0).attr("y",l).attr("dy",++a*(r*i)+h).text(t))})}var e=80;"x"==this.props.xy&&this.elem.selectAll("text").call(t,e)},mpld3_Axis.prototype.draw=function(){var t="x"===this.props.xy?this.parent.props.xscale:this.parent.props.yscale;if("date"===t&&this.props.tickvalues){var e="x"===this.props.xy?this.parent.x.domain():this.parent.y.domain(),i="x"===this.props.xy?this.parent.xdom.domain():this.parent.ydom.domain(),s=d3.scaleLinear().domain(e).range(i);this.props.tickvalues=this.props.tickvalues.map(function(t){return new Date(s(t))})}var o={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.props.position];this.axis=d3[o](this.scale);var r=this;this.filter_ticks(this.axis.scale().domain()),"index"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[t]}):"percent"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=t/r.props.tickformat.xmax*100,s=r.props.tickformat.decimals||0,o=d3.format("."+s+"f")(i);return o+r.props.tickformat.symbol}):"str_method"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=d3.format(r.props.tickformat.format_string)(t);return r.props.tickformat.prefix+i+r.props.tickformat.suffix}):"fixed"==this.props.tickformat_formatter||"func"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[e]}):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(),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" line, ."+this.cssclass+" path",{"shape-rendering":"crispEdges",stroke:this.props.axiscolor,fill:"none"}),mpld3.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"})},mpld3_Axis.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)},mpld3_Axis.prototype.setTicks=function(t,e){this.tickNr=t,this.tickFormat=e},mpld3_Axis.prototype.filter_ticks=function(t){if(this.props.tickvalues){const e=this,i=this.props.tickvalues.map(function(t,e){return e}).filter(function(i,s){const o=e.props.tickvalues[i];return o>=t[0]&&o<=t[1]});this.props.filtered_tickvalues=this.props.tickvalues.filter(function(t,e){return i.includes(e)}),this.props.tickformat?this.props.filtered_tickformat=this.props.tickformat.filter(function(t,e){return i.includes(e)}):this.props.filtered_tickformat=this.props.tickformat}else this.props.filtered_tickvalues=this.props.tickvalues,this.props.filtered_tickformat=this.props.tickformat},mpld3.Coordinates=mpld3_Coordinates,mpld3_Coordinates.prototype.xy=function(t,e,i){return e="undefined"==typeof e?0:e,i="undefined"==typeof i?1:i,[this.x(t[e]),this.y(t[i])]},mpld3_Coordinates.prototype.x_data=function(t){return this.ax.x(t)},mpld3_Coordinates.prototype.y_data=function(t){return this.ax.y(t)},mpld3_Coordinates.prototype.x_display=function(t){return t},mpld3_Coordinates.prototype.y_display=function(t){return t},mpld3_Coordinates.prototype.x_axes=function(t){return t*this.ax.width},mpld3_Coordinates.prototype.y_axes=function(t){return this.ax.height*(1-t)},mpld3_Coordinates.prototype.x_figure=function(t){return t*this.fig.width-this.ax.position[0]},mpld3_Coordinates.prototype.y_figure=function(t){return(1-t)*this.fig.height-this.ax.position[1]},mpld3.Path=mpld3_Path,mpld3_Path.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Path.prototype.constructor=mpld3_Path,mpld3_Path.prototype.requiredProps=["data"],mpld3_Path.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},mpld3_Path.prototype.finiteFilter=function(t,e){return isFinite(this.pathcoords.x(t[this.props.xindex]))&&isFinite(this.pathcoords.y(t[this.props.yindex]))},mpld3_Path.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+")")}},mpld3_Path.prototype.elements=function(t){return this.path},mpld3.PathCollection=mpld3_PathCollection,mpld3_PathCollection.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_PathCollection.prototype.constructor=mpld3_PathCollection,mpld3_PathCollection.prototype.requiredProps=["paths","offsets"],mpld3_PathCollection.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},mpld3_PathCollection.prototype.transformFunc=function(t,e){var i=this.props.pathtransforms,s=0==i.length?"":mpld3.getTransformation("matrix("+getMod(i,e)+")").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?s+o:o+s},mpld3_PathCollection.prototype.pathFunc=function(t,e){return mpld3_path().x(function(t){return this.pathcoords.x(t[0])}.bind(this)).y(function(t){return this.pathcoords.y(t[1])}.bind(this)).apply(this,getMod(this.props.paths,e))},mpld3_PathCollection.prototype.styleFunc=function(t,e){var i={stroke:getMod(this.props.edgecolors,e),"stroke-width":getMod(this.props.edgewidths,e),"stroke-opacity":getMod(this.props.alphas,e),fill:getMod(this.props.facecolors,e),"fill-opacity":getMod(this.props.alphas,e)},s="";for(var o in i)s+=o+":"+i[o]+";";return s},mpld3_PathCollection.prototype.allFinite=function(t){return t instanceof Array?t.length==t.filter(isFinite).length:!0},mpld3_PathCollection.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")},mpld3_PathCollection.prototype.elements=function(t){return this.group.selectAll("path")},mpld3.Line=mpld3_Line,mpld3_Line.prototype=Object.create(mpld3_Path.prototype),mpld3_Line.prototype.constructor=mpld3_Line,mpld3_Line.prototype.requiredProps=["data"],mpld3_Line.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",color:"salmon",linewidth:2,dasharray:"none",alpha:1,zorder:2,drawstyle:"none"},mpld3.Markers=mpld3_Markers,mpld3_Markers.prototype=Object.create(mpld3_PathCollection.prototype),mpld3_Markers.prototype.constructor=mpld3_Markers,mpld3_Markers.prototype.requiredProps=["data"],mpld3_Markers.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},mpld3_Markers.prototype.pathFunc=function(t,e){return this.marker},mpld3.Image=mpld3_Image,mpld3_Image.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Image.prototype.constructor=mpld3_Image,mpld3_Image.prototype.requiredProps=["data","extent"],mpld3_Image.prototype.defaultProps={alpha:1,coordinates:"data",drawstyle:"none",zorder:1},mpld3_Image.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()},mpld3_Image.prototype.elements=function(t){return d3.select(this.image)},mpld3_Image.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]))},mpld3.Text=mpld3_Text,mpld3_Text.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Text.prototype.constructor=mpld3_Text,mpld3_Text.prototype.requiredProps=["text","position"],mpld3_Text.prototype.defaultProps={coordinates:"data",h_anchor:"start",v_baseline:"auto",rotation:0,fontsize:11,drawstyle:"none",color:"black",alpha:1,zorder:3},mpld3_Text.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()},mpld3_Text.prototype.elements=function(t){return d3.select(this.obj)},mpld3_Text.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+")")},mpld3.Axes=mpld3_Axes,mpld3_Axes.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axes.prototype.constructor=mpld3_Axes,mpld3_Axes.prototype.requiredProps=["xlim","ylim"],mpld3_Axes.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:[]},mpld3_Axes.prototype.draw=function(){for(var t=0;t<this.props.sharex.length;t++)this.sharex.push(mpld3.get_element(this.props.sharex[t]));for(var t=0;t<this.props.sharey.length;t++)this.sharey.push(mpld3.get_element(this.props.sharey[t]));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=d3.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(){d3.select(window).on("keydown.brush keyup.brush",null)});for(var t=0;t<this.elements.length;t++)this.elements[t].draw()},mpld3_Axes.prototype.bindZoom=function(){this.zoom||(this.zoom=d3.zoom(),this.zoom.on("zoom",this.zoomed.bind(this)),this.axes.call(this.zoom))},mpld3_Axes.prototype.unbindZoom=function(){this.zoom&&(this.zoom.on("zoom",null),this.axes.on(".zoom",null),this.zoom=null)},mpld3_Axes.prototype.bindBrush=function(){this.brushG||(this.brushG=this.axes.append("g").attr("class","mpld3-brush").call(this.brush))},mpld3_Axes.prototype.unbindBrush=function(){this.brushG&&(this.brushG.remove(),this.brushG.on(".brush",null),this.brushG=null)},mpld3_Axes.prototype.reset=function(){this.zoom?this.doZoom(!1,d3.zoomIdentity,750):(this.bindZoom(),this.doZoom(!1,d3.zoomIdentity,750,function(){this.isSomeTypeOfZoomEnabled||this.unbindZoom()}.bind(this)))},mpld3_Axes.prototype.enableOrDisableBrushing=function(){this.isBoxzoomEnabled||this.isLinkedBrushEnabled?this.bindBrush():this.unbindBrush()},mpld3_Axes.prototype.isSomeTypeOfZoomEnabled=function(){return this.isZoomEnabled||this.isBoxzoomEnabled},mpld3_Axes.prototype.enableOrDisableZooming=function(){this.isSomeTypeOfZoomEnabled()?this.bindZoom():this.unbindZoom()},mpld3_Axes.prototype.enableLinkedBrush=function(){this.isLinkedBrushEnabled=!0,this.enableOrDisableBrushing()},mpld3_Axes.prototype.disableLinkedBrush=function(){this.isLinkedBrushEnabled=!1,this.enableOrDisableBrushing()},mpld3_Axes.prototype.enableBoxzoom=function(){
|
|
3
|
-
this.isBoxzoomEnabled=!0,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.disableBoxzoom=function(){this.isBoxzoomEnabled=!1,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.enableZoom=function(){this.isZoomEnabled=!0,this.enableOrDisableZooming(),this.axes.style("cursor","move")},mpld3_Axes.prototype.disableZoom=function(){this.isZoomEnabled=!1,this.enableOrDisableZooming(),this.axes.style("cursor",null)},mpld3_Axes.prototype.doZoom=function(t,e,i,s){if(this.props.zoomable&&this.zoom){if(i){var o=this.axes.transition().duration(i).call(this.zoom.transform,e);s&&o.on("end",s)}else this.axes.call(this.zoom.transform,e);t?(this.lastTransform=e,this.sharex.forEach(function(t){t.doZoom(!1,e,i)}),this.sharey.forEach(function(t){t.doZoom(!1,e,i)})):this.lastTransform=e}},mpld3_Axes.prototype.zoomed=function(){var t=d3.event.sourceEvent&&"zoom"!=d3.event.sourceEvent.type;if(t)this.doZoom(!0,d3.event.transform,!1);else{var e=d3.event.transform;this.paths.attr("transform",e),this.elements.forEach(function(t){t.zoomed&&t.zoomed(e)}.bind(this))}},mpld3_Axes.prototype.resetBrush=function(){this.brushG.call(this.brush.move,null)},mpld3_Axes.prototype.doBoxzoom=function(t){if(t&&this.brushG){var e=t.map(this.lastTransform.invert,this.lastTransform),i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=(e[0][0]+e[1][0])/2,r=(e[0][1]+e[1][1])/2,n=i>s?this.width/i:this.height/s,p=this.width/2-n*o,a=this.height/2-n*r,l=d3.zoomIdentity.translate(p,a).scale(n);this.doZoom(!0,l,750),this.resetBrush()}},mpld3_Axes.prototype.brushStart=function(){this.isLinkedBrushEnabled&&(this.isCurrentLinkedBrushTarget="MouseEvent"==d3.event.sourceEvent.constructor.name,this.isCurrentLinkedBrushTarget&&this.fig.resetBrushForOtherAxes(this.axid))},mpld3_Axes.prototype.brushMove=function(){var t=d3.event.selection;this.isLinkedBrushEnabled&&this.fig.updateLinkedBrush(t)},mpld3_Axes.prototype.brushEnd=function(){var t=d3.event.selection;this.isBoxzoomEnabled&&this.doBoxzoom(t),this.isLinkedBrushEnabled&&(t||this.fig.endLinkedBrush(),this.isCurrentLinkedBrushTarget=!1)},mpld3_Axes.prototype.setTicks=function(t,e,i){this.axisList.forEach(function(s){s.props.xy==t&&s.setTicks(e,i)})},mpld3.Toolbar=mpld3_Toolbar,mpld3_Toolbar.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Toolbar.prototype.constructor=mpld3_Toolbar,mpld3_Toolbar.prototype.defaultProps={buttons:["reset","move"]},mpld3_Toolbar.prototype.addButton=function(t){this.buttons.push(new t(this))},mpld3_Toolbar.prototype.draw=function(){function t(){this.buttonsobj.transition(750).attr("y",0)}function e(){this.buttonsobj.transition(750).delay(250).attr("y",16)}mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image",{cursor:"pointer",opacity:.2,display:"inline-block",margin:"0px"}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.active",{opacity:.4}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.pressed",{opacity:.6}),this.fig.canvas.on("mouseenter",t.bind(this)).on("mouseleave",e.bind(this)).on("touchenter",t.bind(this)).on("touchstart",t.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,e){return 16*e}).attr("y",16).on("click",function(t){t.click()}).on("mouseenter",function(){d3.select(this).classed("active",!0)}).on("mouseleave",function(){d3.select(this).classed("active",!1)});for(var i=0;i<this.buttons.length;i++)this.buttons[i].onDraw()},mpld3_Toolbar.prototype.deactivate_all=function(){this.buttons.forEach(function(t){t.deactivate()})},mpld3_Toolbar.prototype.deactivate_by_action=function(t){function e(e){return-1!==t.indexOf(e)}t.length>0&&this.buttons.forEach(function(t){t.actions.filter(e).length>0&&t.deactivate()})},mpld3.Button=mpld3_Button,mpld3_Button.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Button.prototype.constructor=mpld3_Button,mpld3_Button.prototype.setState=function(t){t?this.activate():this.deactivate()},mpld3_Button.prototype.click=function(){this.active?this.deactivate():this.activate()},mpld3_Button.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()},mpld3_Button.prototype.deactivate=function(){this.onDeactivate(),this.active=!1,this.toolbar.toolbar.select("."+this.cssclass).classed("pressed",!1)},mpld3_Button.prototype.sticky=!1,mpld3_Button.prototype.actions=[],mpld3_Button.prototype.icon=function(){return""},mpld3_Button.prototype.onActivate=function(){},mpld3_Button.prototype.onDeactivate=function(){},mpld3_Button.prototype.onDraw=function(){},mpld3.ButtonFactory=function(t){function e(t){mpld3_Button.call(this,t,this.buttonID)}if("string"!=typeof t.buttonID)throw"ButtonFactory: buttonID must be present and be a string";e.prototype=Object.create(mpld3_Button.prototype),e.prototype.constructor=e;for(var i in t)e.prototype[i]=t[i];return e},mpld3.Plugin=mpld3_Plugin,mpld3_Plugin.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Plugin.prototype.constructor=mpld3_Plugin,mpld3_Plugin.prototype.requiredProps=[],mpld3_Plugin.prototype.defaultProps={},mpld3_Plugin.prototype.draw=function(){},mpld3.ResetPlugin=mpld3_ResetPlugin,mpld3.register_plugin("reset",mpld3_ResetPlugin),mpld3_ResetPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ResetPlugin.prototype.constructor=mpld3_ResetPlugin,mpld3_ResetPlugin.prototype.requiredProps=[],mpld3_ResetPlugin.prototype.defaultProps={},mpld3.ZoomPlugin=mpld3_ZoomPlugin,mpld3.register_plugin("zoom",mpld3_ZoomPlugin),mpld3_ZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ZoomPlugin.prototype.constructor=mpld3_ZoomPlugin,mpld3_ZoomPlugin.prototype.requiredProps=[],mpld3_ZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_ZoomPlugin.prototype.activate=function(){this.fig.enableZoom()},mpld3_ZoomPlugin.prototype.deactivate=function(){this.fig.disableZoom()},mpld3_ZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.BoxZoomPlugin=mpld3_BoxZoomPlugin,mpld3.register_plugin("boxzoom",mpld3_BoxZoomPlugin),mpld3_BoxZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_BoxZoomPlugin.prototype.constructor=mpld3_BoxZoomPlugin,mpld3_BoxZoomPlugin.prototype.requiredProps=[],mpld3_BoxZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_BoxZoomPlugin.prototype.activate=function(){this.fig.enableBoxzoom()},mpld3_BoxZoomPlugin.prototype.deactivate=function(){this.fig.disableBoxzoom()},mpld3_BoxZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.TooltipPlugin=mpld3_TooltipPlugin,mpld3.register_plugin("tooltip",mpld3_TooltipPlugin),mpld3_TooltipPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_TooltipPlugin.prototype.constructor=mpld3_TooltipPlugin,mpld3_TooltipPlugin.prototype.requiredProps=["id"],mpld3_TooltipPlugin.prototype.defaultProps={labels:null,hoffset:0,voffset:10,location:"mouse"},mpld3_TooltipPlugin.prototype.draw=function(){function t(t,e){this.tooltip.style("visibility","visible").text(null===o?"("+t+")":getMod(o,e))}function e(t,e){if("mouse"===r){var i=d3.mouse(this.fig.canvas.node());this.x=i[0]+this.props.hoffset,this.y=i[1]-this.props.voffset}this.tooltip.attr("x",this.x).attr("y",this.y)}function i(t,e){this.tooltip.style("visibility","hidden")}var s=mpld3.get_element(this.props.id,this.fig),o=this.props.labels,r=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"==r||"top left"==r?(this.x=s.ax.position[0]+5+this.props.hoffset,this.tooltip.style("text-anchor","beginning")):"bottom right"==r||"top right"==r?(this.x=s.ax.position[0]+s.ax.width-5+this.props.hoffset,this.tooltip.style("text-anchor","end")):this.tooltip.style("text-anchor","middle"),"bottom left"==r||"bottom right"==r?this.y=s.ax.position[1]+s.ax.height-5+this.props.voffset:("top left"==r||"top right"==r)&&(this.y=s.ax.position[1]+5+this.props.voffset),s.elements().on("mouseover",t.bind(this)).on("mousemove",e.bind(this)).on("mouseout",i.bind(this))},mpld3.LinkedBrushPlugin=mpld3_LinkedBrushPlugin,mpld3.register_plugin("linkedbrush",mpld3_LinkedBrushPlugin),mpld3_LinkedBrushPlugin.prototype=Object.create(mpld3.Plugin.prototype),mpld3_LinkedBrushPlugin.prototype.constructor=mpld3_LinkedBrushPlugin,mpld3_LinkedBrushPlugin.prototype.requiredProps=["id"],mpld3_LinkedBrushPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_LinkedBrushPlugin.prototype.activate=function(){this.fig.enableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.deactivate=function(){this.fig.disableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.isPathInSelection=function(t,e,i,s){var o=s[0][0]<t[e]&&s[1][0]>t[e]&&s[0][1]<t[i]&&s[1][1]>t[i];return o},mpld3_LinkedBrushPlugin.prototype.invertSelection=function(t,e){var i=[e.x.invert(t[0][0]),e.x.invert(t[1][0])],s=[e.y.invert(t[1][1]),e.y.invert(t[0][1])];return[[Math.min.apply(Math,i),Math.min.apply(Math,s)],[Math.max.apply(Math,i),Math.max.apply(Math,s)]]},mpld3_LinkedBrushPlugin.prototype.update=function(t){t&&this.pathCollectionsByAxes.forEach(function(e,i){var s=e[0],o=this.objectsByAxes[i],r=this.invertSelection(t,this.fig.axes[i]),n=s.props.xindex,p=s.props.yindex;o.selectAll("path").classed("mpld3-hidden",function(t,e){return!this.isPathInSelection(t,n,p,r)}.bind(this))}.bind(this))},mpld3_LinkedBrushPlugin.prototype.end=function(){this.allObjects.selectAll("path").classed("mpld3-hidden",!1)},mpld3_LinkedBrushPlugin.prototype.draw=function(){mpld3.insert_css("#"+this.fig.figid+" path.mpld3-hidden",{stroke:"#ccc !important",fill:"#ccc !important"});var t=mpld3.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(e){return e.elements.map(function(e){return e.props[this.dataKey]==t.props[this.dataKey]?(e.group.classed(this.objectClass,!0),e):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)},mpld3.register_plugin("mouseposition",MousePositionPlugin),MousePositionPlugin.prototype=Object.create(mpld3.Plugin.prototype),MousePositionPlugin.prototype.constructor=MousePositionPlugin,MousePositionPlugin.prototype.requiredProps=[],MousePositionPlugin.prototype.defaultProps={fontsize:12,fmt:".3g"},MousePositionPlugin.prototype.draw=function(){for(var t=this.fig,e=d3.format(this.props.fmt),i=t.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),s=0;s<this.fig.axes.length;s++){var o=function(){var o=t.axes[s];return function(){var t=d3.mouse(this),s=o.x.invert(t[0]),r=o.y.invert(t[1]);i.text("("+e(s)+", "+e(r)+")")}}();t.axes[s].baseaxes.on("mousemove",o).on("mouseout",function(){i.text("")})}},mpld3.Figure=mpld3_Figure,mpld3_Figure.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Figure.prototype.constructor=mpld3_Figure,mpld3_Figure.prototype.requiredProps=["width","height"],mpld3_Figure.prototype.defaultProps={data:{},axes:[],plugins:[{type:"reset"},{type:"zoom"},{type:"boxzoom"}]},mpld3_Figure.prototype.addPlugin=function(t){if(!t.type)return console.warn("unspecified plugin type. Skipping this");var e;if(!(t.type in mpld3.plugin_map))return console.warn("Skipping unrecognized plugin: "+e);e=mpld3.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 i=mpld3_cloneObj(t);delete i.type;var s=new e(this,i);this.plugins.push(s),this.pluginsByType[t.type]=s},mpld3_Figure.prototype.draw=function(){mpld3.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()},mpld3_Figure.prototype.resetBrushForOtherAxes=function(t){this.axes.forEach(function(e){e.axid!=t&&e.resetBrush()})},mpld3_Figure.prototype.updateLinkedBrush=function(t){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.update(t)},mpld3_Figure.prototype.endLinkedBrush=function(){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.end()},mpld3_Figure.prototype.reset=function(t){this.axes.forEach(function(t){t.reset()})},mpld3_Figure.prototype.enableLinkedBrush=function(){this.axes.forEach(function(t){t.enableLinkedBrush()})},mpld3_Figure.prototype.disableLinkedBrush=function(){this.axes.forEach(function(t){t.disableLinkedBrush()})},mpld3_Figure.prototype.enableBoxzoom=function(){this.axes.forEach(function(t){t.enableBoxzoom()})},mpld3_Figure.prototype.disableBoxzoom=function(){this.axes.forEach(function(t){t.disableBoxzoom()})},mpld3_Figure.prototype.enableZoom=function(){this.axes.forEach(function(t){t.enableZoom()})},mpld3_Figure.prototype.disableZoom=function(){this.axes.forEach(function(t){t.disableZoom()})},mpld3_Figure.prototype.toggleZoom=function(){this.isZoomEnabled?this.disableZoom():this.enableZoom()},mpld3_Figure.prototype.setTicks=function(t,e,i){this.axes.forEach(function(s){s.setTicks(t,e,i)})},mpld3_Figure.prototype.setXTicks=function(t,e){this.setTicks("x",t,e)},mpld3_Figure.prototype.setYTicks=function(t,e){this.setTicks("y",t,e)},mpld3_Figure.prototype.removeNaN=function(t){output=output.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.parse_offsets=function(t){return t.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.get_data=function(t){var e=t;return null===t||"undefined"==typeof t?e=null:"string"==typeof t&&(e=this.data[t]),e},mpld3.PlotElement=mpld3_PlotElement,mpld3_PlotElement.prototype.requiredProps=[],mpld3_PlotElement.prototype.defaultProps={},mpld3_PlotElement.prototype.processProps=function(t){t=mpld3_cloneObj(t);var e={},i=this.name();this.requiredProps.forEach(function(s){if(!(s in t))throw"property '"+s+"' must be specified for "+i;e[s]=t[s],delete t[s]});for(var s in this.defaultProps)s in t?(e[s]=t[s],delete t[s]):e[s]=this.defaultProps[s];"id"in t?(e.id=t.id,delete t.id):"id"in e||(e.id=mpld3.generateId());for(var s in t)console.warn("Unrecognized property '"+s+"' for object "+this.name()+" (value = "+t[s]+").");return e},mpld3_PlotElement.prototype.name=function(){var t=/function (.{1,})\(/,e=t.exec(this.constructor.toString());return e&&e.length>1?e[1]:""},"object"==typeof module&&module.exports?module.exports=mpld3:this.mpld3=mpld3,console.log("Loaded mpld3 version "+mpld3.version);
|
|
2
|
+
function mpld3_cloneObj(t){var e={};for(var i in t)e[i]=t[i];return e}function mpld3_generateId(t,e){t="undefined"!=typeof t?t:10,e="undefined"!=typeof e?e:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var i=e.charAt(Math.round(Math.random()*(e.length-11))),s=1;t>s;s++)i+=e.charAt(Math.round(Math.random()*(e.length-1)));return i}function mpld3_interpolateDates(t,e){var i=d3.interpolate([t[0].valueOf(),t[1].valueOf()],[e[0].valueOf(),e[1].valueOf()]);return function(t){var e=i(t);return[new Date(e[0]),new Date(e[1])]}}function isUndefined(t){return"undefined"==typeof t}function isUndefinedOrNull(t){return null==t||isUndefined(t)}function getMod(t,e){return t.length>0?t[e%t.length]:null}function mpld3_path(t){function e(t,e){var n=function(t){return"function"==typeof t?t:function(){return t}},p=n(i),a=n(s),l=[],h=[],d=0,c=-1,u=0,m=!1;if(!e){e=["M"];for(var f=1;f<t.length;f++)e.push("L")}for(;++c<e.length;){for(u=d+r[e[c]],l=[];u>d;)o.call(this,t[d],d)?(l.push(p.call(this,t[d],d),a.call(this,t[d],d)),d++):(l=null,d=u);l?m&&l.length>0?(h.push("M",l[0],l[1]),m=!1):(h.push(e[c]),h=h.concat(l)):m=!0}return d!=t.length&&console.warn("Warning: not all vertices used in Path"),h.join(" ")}var i=function(t,e){return t[0]},s=function(t,e){return t[1]},o=function(t,e){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 e.x=function(t){return arguments.length?(i=t,e):i},e.y=function(t){return arguments.length?(s=t,e):s},e.defined=function(t){return arguments.length?(o=t,e):o},e.call=e,e}function mpld3_multiscale(t){function e(t){return i.forEach(function(e){t=e(t)}),t}var i=Array.prototype.slice.call(arguments,0),s=i.length;return e.domain=function(t){return arguments.length?(i[0].domain(t),e):i[0].domain()},e.range=function(t){return arguments.length?(i[s-1].range(t),e):i[s-1].range()},e.step=function(t){return i[t]},e}function mpld3_Grid(t,e){if(mpld3_PlotElement.call(this,t,e),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 mpld3_Axis(t,e){mpld3_PlotElement.call(this,t,e);var i={bottom:[0,this.ax.height],top:[0,0],left:[0,0],right:[this.ax.width,0]},s={bottom:"x",top:"x",left:"y",right:"y"};this.ax=t,this.transform="translate("+i[this.props.position]+")",this.props.xy=s[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 mpld3_Coordinates(t,e){if(this.trans=t,"undefined"==typeof e){if(this.ax=null,this.fig=null,"display"!==this.trans)throw"ax must be defined if transform != 'display'"}else this.ax=e,this.fig=e.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 mpld3_Path(t,e){mpld3_PlotElement.call(this,t,e),this.data=t.fig.get_data(this.props.data),this.pathcodes=this.props.pathcodes,this.pathcoords=new mpld3_Coordinates(this.props.coordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax),this.datafunc=mpld3_path()}function mpld3_PathCollection(t,e){mpld3_PlotElement.call(this,t,e),(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 s=Math.max(this.props.paths.length,i.length);if(i.length===s)this.offsets=i;else{this.offsets=[];for(var o=0;s>o;o++)this.offsets.push(getMod(i,o))}this.pathcoords=new mpld3_Coordinates(this.props.pathcoordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax)}function mpld3_Line(t,e){mpld3_PlotElement.call(this,t,e);var i=this.props;i.facecolor="none",i.edgecolor=i.color,delete i.color,i.edgewidth=i.linewidth,delete i.linewidth;const s=i.drawstyle;switch(delete i.drawstyle,this.defaultProps=mpld3_Path.prototype.defaultProps,mpld3_Path.call(this,t,i),s){case"steps":case"steps-pre":this.datafunc=d3.line().curve(d3.curveStepBefore);break;case"steps-post":this.datafunc=d3.line().curve(d3.curveStepAfter);break;case"steps-mid":this.datafunc=d3.line().curve(d3.curveStep);break;default:this.datafunc=d3.line().curve(d3.curveLinear)}}function mpld3_Markers(t,e){mpld3_PlotElement.call(this,t,e),null!==this.props.markerpath?this.marker=0==this.props.markerpath[0].length?null:mpld3.path().call(this.props.markerpath[0],this.props.markerpath[1]):this.marker=null===this.props.markername?null:d3.symbol(this.props.markername).size(Math.pow(this.props.markersize,2))();var i={paths:[this.props.markerpath],offsets:t.fig.parse_offsets(t.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=mpld3_PathCollection.prototype.requiredProps,this.defaultProps=mpld3_PathCollection.prototype.defaultProps,mpld3_PathCollection.call(this,t,i)}function mpld3_Image(t,e){mpld3_PlotElement.call(this,t,e),this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Text(t,e){mpld3_PlotElement.call(this,t,e),this.text=this.props.text,this.position=this.props.position,this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Axes(t,e){function i(t){return new Date(t[0],t[1],t[2],t[3],t[4],t[5])}function s(t,e){return"date"!==t?e:[i(e[0]),i(e[1])]}function o(t,e,i){var s="date"===t?d3.scaleTime():"log"===t?d3.scaleLog():d3.scaleLinear();return s.domain(e).range(i)}mpld3_PlotElement.call(this,t,e),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 r=this.props.bbox;this.position=[r[0]*this.fig.width,(1-r[1]-r[3])*this.fig.height],this.width=r[2]*this.fig.width,this.height=r[3]*this.fig.height,this.isZoomEnabled=null,this.zoom=null,this.lastTransform=d3.zoomIdentity,this.isBoxzoomEnabled=null,this.isLinkedBrushEnabled=null,this.isCurrentLinkedBrushTarget=!1,this.brushG=null,this.props.xdomain=s(this.props.xscale,this.props.xdomain),this.props.ydomain=s(this.props.yscale,this.props.ydomain),this.x=this.xdom=o(this.props.xscale,this.props.xdomain,[0,this.width]),this.y=this.ydom=o(this.props.yscale,this.props.ydomain,[this.height,0]),"date"===this.props.xscale&&(this.x=mpld3.multiscale(d3.scaleLinear().domain(this.props.xlim).range(this.props.xdomain.map(Number)),this.xdom)),"date"===this.props.yscale&&(this.y=mpld3.multiscale(d3.scaleLinear().domain(this.props.ylim).range(this.props.ydomain.map(Number)),this.ydom));for(var n=this.props.axes,p=0;p<n.length;p++){var a=new mpld3.Axis(this,n[p]);this.axisList.push(a),this.elements.push(a),(this.props.gridOn||a.props.grid.gridOn)&&this.elements.push(a.getGrid())}for(var l=this.props.paths,p=0;p<l.length;p++)this.elements.push(new mpld3.Path(this,l[p]));for(var h=this.props.lines,p=0;p<h.length;p++)this.elements.push(new mpld3.Line(this,h[p]));for(var d=this.props.markers,p=0;p<d.length;p++)this.elements.push(new mpld3.Markers(this,d[p]));for(var c=this.props.texts,p=0;p<c.length;p++)this.elements.push(new mpld3.Text(this,c[p]));for(var u=this.props.collections,p=0;p<u.length;p++)this.elements.push(new mpld3.PathCollection(this,u[p]));for(var m=this.props.images,p=0;p<m.length;p++)this.elements.push(new mpld3.Image(this,m[p]));this.elements.sort(function(t,e){return t.props.zorder-e.props.zorder})}function mpld3_Toolbar(t,e){mpld3_PlotElement.call(this,t,e),this.buttons=[],this.props.buttons.forEach(this.addButton.bind(this))}function mpld3_Button(t,e){mpld3_PlotElement.call(this,t),this.toolbar=t,this.fig=this.toolbar.fig,this.cssclass="mpld3-"+e+"button",this.active=!1}function mpld3_Plugin(t,e){mpld3_PlotElement.call(this,t,e)}function mpld3_ResetPlugin(t,e){mpld3_Plugin.call(this,t,e);var i=mpld3.ButtonFactory({buttonID:"reset",sticky:!1,onActivate:function(){this.toolbar.fig.reset()},icon:function(){return mpld3.icons.reset}});this.fig.buttons.push(i)}function mpld3_ZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.move}});this.fig.buttons.push(s)}}function mpld3_BoxZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.zoom}});this.fig.buttons.push(s)}this.extentClass="boxzoombrush"}function mpld3_TooltipPlugin(t,e){mpld3_Plugin.call(this,t,e)}function mpld3_LinkedBrushPlugin(t,e){mpld3.Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.brush}});this.fig.buttons.push(s)}this.pathCollectionsByAxes=[],this.objectsByAxes=[],this.allObjects=[],this.extentClass="linkedbrush",this.dataKey="offsets",this.objectClass=null}function MousePositionPlugin(t,e){mpld3.Plugin.call(this,t,e)}function mpld3_Figure(t,e){mpld3_PlotElement.call(this,null,e),this.figid=t,this.width=this.props.width,this.height=this.props.height,this.data=this.props.data,this.buttons=[],this.root=d3.select("#"+t).append("div").style("position","relative"),this.axes=[];for(var i=0;i<this.props.axes.length;i++)this.axes.push(new mpld3_Axes(this,this.props.axes[i]));this.plugins=[],this.pluginsByType={},this.props.plugins.forEach(function(t){this.addPlugin(t)}.bind(this)),this.toolbar=new mpld3.Toolbar(this,{buttons:this.buttons})}function mpld3_PlotElement(t,e){this.parent=isUndefinedOrNull(t)?null:t,this.props=isUndefinedOrNull(e)?{}:this.processProps(e),this.fig=t instanceof mpld3_Figure?t:t&&"fig"in t?t.fig:null,this.ax=t instanceof mpld3_Axes?t:t&&"ax"in t?t.ax:null}if(!d3)var d3=require("d3");var mpld3={_mpld3IsLoaded:!0,figures:[],plugin_map:{}};mpld3.version="0.5.12",mpld3.register_plugin=function(t,e){mpld3.plugin_map[t]=e},mpld3.remove_figure=function(t){var e=document.getElementById(t);null!==e&&(e.innerHTML="");for(var i=0;i<mpld3.figures.length;i++){var s=mpld3.figures[i];s.figid===t&&mpld3.figures.splice(i,1)}return!0},mpld3.draw_figure=function(t,e,i,s){var o=document.getElementById(t);if(s="undefined"!=typeof s?s:!1,s&&mpld3.remove_figure(t),null===o)throw t+" is not a valid id";var r=new mpld3.Figure(t,e);return i&&i(r,o),mpld3.figures.push(r),r.draw(),r},mpld3.cloneObj=mpld3_cloneObj,mpld3.boundsToTransform=function(t,e){var i=t.width,s=t.height,o=e[1][0]-e[0][0],r=e[1][1]-e[0][1],n=(e[0][0]+e[1][0])/2,p=(e[0][1]+e[1][1])/2,a=Math.max(1,Math.min(8,.9/Math.max(o/i,r/s))),l=[i/2-a*n,s/2-a*p];return{translate:l,scale:a}},mpld3.getTransformation=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","g");e.setAttributeNS(null,"transform",t);var i,s,o,r=e.transform.baseVal.consolidate().matrix,n=r.a,p=r.b,a=r.c,l=r.d,h=r.e,d=r.f;(i=Math.sqrt(n*n+p*p))&&(n/=i,p/=i),(o=n*a+p*l)&&(a-=n*o,l-=p*o),(s=Math.sqrt(a*a+l*l))&&(a/=s,l/=s,o/=s),p*a>n*l&&(n=-n,p=-p,o=-o,i=-i);var c={translateX:h,translateY:d,rotate:180*Math.atan2(p,n)/Math.PI,skewX:180*Math.atan(o)/Math.PI,scaleX:i,scaleY:s},u="translate("+c.translateX+","+c.translateY+")rotate("+c.rotate+")skewX("+c.skewX+")scale("+c.scaleX+","+c.scaleY+")";return u},mpld3.merge_objects=function(t){for(var e,i={},s=0;s<arguments.length;s++){e=arguments[s];for(var o in e)i[o]=e[o]}return i},mpld3.generate_id=function(t,e){return console.warn("mpld3.generate_id is deprecated. Use mpld3.generateId instead."),mpld3_generateId(t,e)},mpld3.generateId=mpld3_generateId,mpld3.get_element=function(t,e){var i,s,o;i="undefined"==typeof e?mpld3.figures:"undefined"==typeof e.length?[e]:e;for(var r=0;r<i.length;r++){if(e=i[r],e.props.id===t)return e;for(var n=0;n<e.axes.length;n++){if(s=e.axes[n],s.props.id===t)return s;for(var p=0;p<s.elements.length;p++)if(o=s.elements[p],o.props.id===t)return o}}return null},mpld3.insert_css=function(t,e){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style"),o=t+" {";for(var r in e)o+=r+":"+e[r]+"; ";o+="}",s.type="text/css",s.styleSheet?s.styleSheet.cssText=o:s.appendChild(document.createTextNode(o)),i.appendChild(s)},mpld3.process_props=function(t,e,i,s){function o(t){mpld3_PlotElement.call(this,null,t)}console.warn("mpld3.process_props is deprecated. Plot elements should derive from mpld3.PlotElement"),o.prototype=Object.create(mpld3_PlotElement.prototype),o.prototype.constructor=o,o.prototype.requiredProps=s,o.prototype.defaultProps=i;var r=new o(e);return r.props},mpld3.interpolateDates=mpld3_interpolateDates,mpld3.path=function(){return mpld3_path()},mpld3.multiscale=mpld3_multiscale,mpld3.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"},mpld3.Grid=mpld3_Grid,mpld3_Grid.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Grid.prototype.constructor=mpld3_Grid,mpld3_Grid.prototype.requiredProps=["xy"],mpld3_Grid.prototype.defaultProps={color:"gray",dasharray:"2,2",alpha:"0.5",nticks:10,gridOn:!0,tickvalues:null,zorder:0},mpld3_Grid.prototype.draw=function(){var t={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.position];this.grid=d3[t](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),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .tick",{stroke:this.props.color,"stroke-dasharray":this.props.dasharray,"stroke-opacity":this.props.alpha}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" path",{"stroke-width":0}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .domain",{"pointer-events":"none"})},mpld3_Grid.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)},mpld3.Axis=mpld3_Axis,mpld3_Axis.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axis.prototype.constructor=mpld3_Axis,mpld3_Axis.prototype.requiredProps=["position"],mpld3_Axis.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},mpld3_Axis.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 e in this.props.grid)t[e]=this.props.grid[e];return new mpld3_Grid(this.ax,t)},mpld3_Axis.prototype.wrapTicks=function(){function t(t,e,i){i=i||1.2,t.each(function(){for(var t,s=d3.select(this),o=s.node().getBBox(),r=o.height,n=s.text().split(/\s+/).reverse(),p=[],a=0,l=s.attr("y"),h=r,d=s.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",h);t=n.pop();)p.push(t),d.text(p.join(" ")),d.node().getComputedTextLength()>e&&(p.pop(),d.text(p.join(" ")),p=[t],d=s.append("tspan").attr("x",0).attr("y",l).attr("dy",++a*(r*i)+h).text(t))})}var e=80;"x"==this.props.xy&&this.elem.selectAll("text").call(t,e)},mpld3_Axis.prototype.draw=function(){var t="x"===this.props.xy?this.parent.props.xscale:this.parent.props.yscale;if("date"===t&&this.props.tickvalues){var e="x"===this.props.xy?this.parent.x.domain():this.parent.y.domain(),i="x"===this.props.xy?this.parent.xdom.domain():this.parent.ydom.domain(),s=d3.scaleLinear().domain(e).range(i);this.props.tickvalues=this.props.tickvalues.map(function(t){return new Date(s(t))})}var o={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.props.position];this.axis=d3[o](this.scale);var r=this;this.filter_ticks(this.axis.scale().domain()),"index"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[t]}):"percent"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=t/r.props.tickformat.xmax*100,s=r.props.tickformat.decimals||0,o=d3.format("."+s+"f")(i);return o+r.props.tickformat.symbol}):"str_method"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=d3.format(r.props.tickformat.format_string)(t);return r.props.tickformat.prefix+i+r.props.tickformat.suffix}):"fixed"==this.props.tickformat_formatter||"func"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[e]}):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(),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" line, ."+this.cssclass+" path",{"shape-rendering":"crispEdges",stroke:this.props.axiscolor,fill:"none"}),mpld3.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"})},mpld3_Axis.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)},mpld3_Axis.prototype.setTicks=function(t,e){this.tickNr=t,this.tickFormat=e},mpld3_Axis.prototype.filter_ticks=function(t){if(this.props.tickvalues){const e=this,i=this.props.tickvalues.map(function(t,e){return e}).filter(function(i,s){const o=e.props.tickvalues[i];return o>=t[0]&&o<=t[1]});this.props.filtered_tickvalues=this.props.tickvalues.filter(function(t,e){return i.includes(e)}),this.props.tickformat?this.props.filtered_tickformat=this.props.tickformat.filter(function(t,e){return i.includes(e)}):this.props.filtered_tickformat=this.props.tickformat}else this.props.filtered_tickvalues=this.props.tickvalues,this.props.filtered_tickformat=this.props.tickformat},mpld3.Coordinates=mpld3_Coordinates,mpld3_Coordinates.prototype.xy=function(t,e,i){return e="undefined"==typeof e?0:e,i="undefined"==typeof i?1:i,[this.x(t[e]),this.y(t[i])]},mpld3_Coordinates.prototype.x_data=function(t){return this.ax.x(t)},mpld3_Coordinates.prototype.y_data=function(t){return this.ax.y(t)},mpld3_Coordinates.prototype.x_display=function(t){return t},mpld3_Coordinates.prototype.y_display=function(t){return t},mpld3_Coordinates.prototype.x_axes=function(t){return t*this.ax.width},mpld3_Coordinates.prototype.y_axes=function(t){return this.ax.height*(1-t)},mpld3_Coordinates.prototype.x_figure=function(t){return t*this.fig.width-this.ax.position[0]},mpld3_Coordinates.prototype.y_figure=function(t){return(1-t)*this.fig.height-this.ax.position[1]},mpld3.Path=mpld3_Path,mpld3_Path.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Path.prototype.constructor=mpld3_Path,mpld3_Path.prototype.requiredProps=["data"],mpld3_Path.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},mpld3_Path.prototype.finiteFilter=function(t,e){return isFinite(this.pathcoords.x(t[this.props.xindex]))&&isFinite(this.pathcoords.y(t[this.props.yindex]))},mpld3_Path.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("fill",this.props.facecolor).attr("vector-effect","non-scaling-stroke"),"rgba("!=this.props.edgecolor.slice(0,5)&&(this.path=this.path.style("stroke-opacity",this.props.alpha)),"rgba("!=this.props.facecolor.slice(0,5)&&(this.path=this.path.style("fill-opacity",this.props.alpha)),null!==this.props.offset){var t=this.offsetcoords.xy(this.props.offset);this.path.attr("transform","translate("+t+")")}},mpld3_Path.prototype.elements=function(t){return this.path},mpld3.PathCollection=mpld3_PathCollection,mpld3_PathCollection.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_PathCollection.prototype.constructor=mpld3_PathCollection,mpld3_PathCollection.prototype.requiredProps=["paths","offsets"],mpld3_PathCollection.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},mpld3_PathCollection.prototype.transformFunc=function(t,e){var i=this.props.pathtransforms,s=0==i.length?"":mpld3.getTransformation("matrix("+getMod(i,e)+")").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?s+o:o+s},mpld3_PathCollection.prototype.pathFunc=function(t,e){return mpld3_path().x(function(t){return this.pathcoords.x(t[0])}.bind(this)).y(function(t){return this.pathcoords.y(t[1])}.bind(this)).apply(this,getMod(this.props.paths,e))},mpld3_PathCollection.prototype.styleFunc=function(t,e){var i=getMod(this.props.edgecolors,e),s=getMod(this.props.facecolors,e),o=getMod(this.props.alphas,e),r={stroke:i,"stroke-width":getMod(this.props.edgewidths,e),fill:s};"rgba("!=i.slice(0,5)&&(r["stroke-opacity"]=o),"rgba("!=s.slice(0,5)&&(r["fill-opacity"]=o);var n="";for(var p in r)n+=p+":"+r[p]+";";return n},mpld3_PathCollection.prototype.allFinite=function(t){return t instanceof Array?t.length==t.filter(isFinite).length:!0},mpld3_PathCollection.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")},mpld3_PathCollection.prototype.elements=function(t){return this.group.selectAll("path")},mpld3.Line=mpld3_Line,mpld3_Line.prototype=Object.create(mpld3_Path.prototype),mpld3_Line.prototype.constructor=mpld3_Line,mpld3_Line.prototype.requiredProps=["data"],mpld3_Line.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",color:"salmon",linewidth:2,dasharray:"none",alpha:1,zorder:2,drawstyle:"none"},mpld3.Markers=mpld3_Markers,mpld3_Markers.prototype=Object.create(mpld3_PathCollection.prototype),mpld3_Markers.prototype.constructor=mpld3_Markers,mpld3_Markers.prototype.requiredProps=["data"],mpld3_Markers.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},mpld3_Markers.prototype.pathFunc=function(t,e){return this.marker},mpld3.Image=mpld3_Image,mpld3_Image.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Image.prototype.constructor=mpld3_Image,mpld3_Image.prototype.requiredProps=["data","extent"],mpld3_Image.prototype.defaultProps={alpha:1,coordinates:"data",drawstyle:"none",zorder:1},mpld3_Image.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()},mpld3_Image.prototype.elements=function(t){return d3.select(this.image)},mpld3_Image.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]))},mpld3.Text=mpld3_Text,mpld3_Text.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Text.prototype.constructor=mpld3_Text,mpld3_Text.prototype.requiredProps=["text","position"],mpld3_Text.prototype.defaultProps={coordinates:"data",h_anchor:"start",v_baseline:"auto",rotation:0,fontsize:11,drawstyle:"none",color:"black",alpha:1,zorder:3},mpld3_Text.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()},mpld3_Text.prototype.elements=function(t){return d3.select(this.obj)},mpld3_Text.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+")")},mpld3.Axes=mpld3_Axes,mpld3_Axes.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axes.prototype.constructor=mpld3_Axes,mpld3_Axes.prototype.requiredProps=["xlim","ylim"],mpld3_Axes.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:[]},mpld3_Axes.prototype.draw=function(){for(var t=0;t<this.props.sharex.length;t++)this.sharex.push(mpld3.get_element(this.props.sharex[t]));for(var t=0;t<this.props.sharey.length;t++)this.sharey.push(mpld3.get_element(this.props.sharey[t]));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=d3.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(){d3.select(window).on("keydown.brush keyup.brush",null)});for(var t=0;t<this.elements.length;t++)this.elements[t].draw()},mpld3_Axes.prototype.bindZoom=function(){this.zoom||(this.zoom=d3.zoom(),this.zoom.on("zoom",this.zoomed.bind(this)),this.axes.call(this.zoom))},mpld3_Axes.prototype.unbindZoom=function(){this.zoom&&(this.zoom.on("zoom",null),this.axes.on(".zoom",null),this.zoom=null)},mpld3_Axes.prototype.bindBrush=function(){this.brushG||(this.brushG=this.axes.append("g").attr("class","mpld3-brush").call(this.brush))},mpld3_Axes.prototype.unbindBrush=function(){this.brushG&&(this.brushG.remove(),this.brushG.on(".brush",null),this.brushG=null)},mpld3_Axes.prototype.reset=function(){this.zoom?this.doZoom(!1,d3.zoomIdentity,750):(this.bindZoom(),this.doZoom(!1,d3.zoomIdentity,750,function(){this.isSomeTypeOfZoomEnabled||this.unbindZoom()}.bind(this)))},mpld3_Axes.prototype.enableOrDisableBrushing=function(){this.isBoxzoomEnabled||this.isLinkedBrushEnabled?this.bindBrush():this.unbindBrush()},mpld3_Axes.prototype.isSomeTypeOfZoomEnabled=function(){return this.isZoomEnabled||this.isBoxzoomEnabled},mpld3_Axes.prototype.enableOrDisableZooming=function(){this.isSomeTypeOfZoomEnabled()?this.bindZoom():this.unbindZoom()},mpld3_Axes.prototype.enableLinkedBrush=function(){this.isLinkedBrushEnabled=!0,
|
|
3
|
+
this.enableOrDisableBrushing()},mpld3_Axes.prototype.disableLinkedBrush=function(){this.isLinkedBrushEnabled=!1,this.enableOrDisableBrushing()},mpld3_Axes.prototype.enableBoxzoom=function(){this.isBoxzoomEnabled=!0,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.disableBoxzoom=function(){this.isBoxzoomEnabled=!1,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.enableZoom=function(){this.isZoomEnabled=!0,this.enableOrDisableZooming(),this.axes.style("cursor","move")},mpld3_Axes.prototype.disableZoom=function(){this.isZoomEnabled=!1,this.enableOrDisableZooming(),this.axes.style("cursor",null)},mpld3_Axes.prototype.doZoom=function(t,e,i,s){if(this.props.zoomable&&this.zoom){if(i){var o=this.axes.transition().duration(i).call(this.zoom.transform,e);s&&o.on("end",s)}else this.axes.call(this.zoom.transform,e);t?(this.lastTransform=e,this.sharex.forEach(function(t){t.doZoom(!1,e,i)}),this.sharey.forEach(function(t){t.doZoom(!1,e,i)})):this.lastTransform=e}},mpld3_Axes.prototype.zoomed=function(){var t=d3.event.sourceEvent&&"zoom"!=d3.event.sourceEvent.type;if(t)this.doZoom(!0,d3.event.transform,!1);else{var e=d3.event.transform;this.paths.attr("transform",e),this.elements.forEach(function(t){t.zoomed&&t.zoomed(e)}.bind(this))}},mpld3_Axes.prototype.resetBrush=function(){this.brushG.call(this.brush.move,null)},mpld3_Axes.prototype.doBoxzoom=function(t){if(t&&this.brushG){var e=t.map(this.lastTransform.invert,this.lastTransform),i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=(e[0][0]+e[1][0])/2,r=(e[0][1]+e[1][1])/2,n=i>s?this.width/i:this.height/s,p=this.width/2-n*o,a=this.height/2-n*r,l=d3.zoomIdentity.translate(p,a).scale(n);this.doZoom(!0,l,750),this.resetBrush()}},mpld3_Axes.prototype.brushStart=function(){this.isLinkedBrushEnabled&&(this.isCurrentLinkedBrushTarget="MouseEvent"==d3.event.sourceEvent.constructor.name,this.isCurrentLinkedBrushTarget&&this.fig.resetBrushForOtherAxes(this.axid))},mpld3_Axes.prototype.brushMove=function(){var t=d3.event.selection;this.isLinkedBrushEnabled&&this.fig.updateLinkedBrush(t)},mpld3_Axes.prototype.brushEnd=function(){var t=d3.event.selection;this.isBoxzoomEnabled&&this.doBoxzoom(t),this.isLinkedBrushEnabled&&(t||this.fig.endLinkedBrush(),this.isCurrentLinkedBrushTarget=!1)},mpld3_Axes.prototype.setTicks=function(t,e,i){this.axisList.forEach(function(s){s.props.xy==t&&s.setTicks(e,i)})},mpld3.Toolbar=mpld3_Toolbar,mpld3_Toolbar.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Toolbar.prototype.constructor=mpld3_Toolbar,mpld3_Toolbar.prototype.defaultProps={buttons:["reset","move"]},mpld3_Toolbar.prototype.addButton=function(t){this.buttons.push(new t(this))},mpld3_Toolbar.prototype.draw=function(){function t(){this.buttonsobj.transition(750).attr("y",0)}function e(){this.buttonsobj.transition(750).delay(250).attr("y",16)}mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image",{cursor:"pointer",opacity:.2,display:"inline-block",margin:"0px"}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.active",{opacity:.4}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.pressed",{opacity:.6}),this.fig.canvas.on("mouseenter",t.bind(this)).on("mouseleave",e.bind(this)).on("touchenter",t.bind(this)).on("touchstart",t.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,e){return 16*e}).attr("y",16).on("click",function(t){t.click()}).on("mouseenter",function(){d3.select(this).classed("active",!0)}).on("mouseleave",function(){d3.select(this).classed("active",!1)});for(var i=0;i<this.buttons.length;i++)this.buttons[i].onDraw()},mpld3_Toolbar.prototype.deactivate_all=function(){this.buttons.forEach(function(t){t.deactivate()})},mpld3_Toolbar.prototype.deactivate_by_action=function(t){function e(e){return-1!==t.indexOf(e)}t.length>0&&this.buttons.forEach(function(t){t.actions.filter(e).length>0&&t.deactivate()})},mpld3.Button=mpld3_Button,mpld3_Button.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Button.prototype.constructor=mpld3_Button,mpld3_Button.prototype.setState=function(t){t?this.activate():this.deactivate()},mpld3_Button.prototype.click=function(){this.active?this.deactivate():this.activate()},mpld3_Button.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()},mpld3_Button.prototype.deactivate=function(){this.onDeactivate(),this.active=!1,this.toolbar.toolbar.select("."+this.cssclass).classed("pressed",!1)},mpld3_Button.prototype.sticky=!1,mpld3_Button.prototype.actions=[],mpld3_Button.prototype.icon=function(){return""},mpld3_Button.prototype.onActivate=function(){},mpld3_Button.prototype.onDeactivate=function(){},mpld3_Button.prototype.onDraw=function(){},mpld3.ButtonFactory=function(t){function e(t){mpld3_Button.call(this,t,this.buttonID)}if("string"!=typeof t.buttonID)throw"ButtonFactory: buttonID must be present and be a string";e.prototype=Object.create(mpld3_Button.prototype),e.prototype.constructor=e;for(var i in t)e.prototype[i]=t[i];return e},mpld3.Plugin=mpld3_Plugin,mpld3_Plugin.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Plugin.prototype.constructor=mpld3_Plugin,mpld3_Plugin.prototype.requiredProps=[],mpld3_Plugin.prototype.defaultProps={},mpld3_Plugin.prototype.draw=function(){},mpld3.ResetPlugin=mpld3_ResetPlugin,mpld3.register_plugin("reset",mpld3_ResetPlugin),mpld3_ResetPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ResetPlugin.prototype.constructor=mpld3_ResetPlugin,mpld3_ResetPlugin.prototype.requiredProps=[],mpld3_ResetPlugin.prototype.defaultProps={},mpld3.ZoomPlugin=mpld3_ZoomPlugin,mpld3.register_plugin("zoom",mpld3_ZoomPlugin),mpld3_ZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ZoomPlugin.prototype.constructor=mpld3_ZoomPlugin,mpld3_ZoomPlugin.prototype.requiredProps=[],mpld3_ZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_ZoomPlugin.prototype.activate=function(){this.fig.enableZoom()},mpld3_ZoomPlugin.prototype.deactivate=function(){this.fig.disableZoom()},mpld3_ZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.BoxZoomPlugin=mpld3_BoxZoomPlugin,mpld3.register_plugin("boxzoom",mpld3_BoxZoomPlugin),mpld3_BoxZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_BoxZoomPlugin.prototype.constructor=mpld3_BoxZoomPlugin,mpld3_BoxZoomPlugin.prototype.requiredProps=[],mpld3_BoxZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_BoxZoomPlugin.prototype.activate=function(){this.fig.enableBoxzoom()},mpld3_BoxZoomPlugin.prototype.deactivate=function(){this.fig.disableBoxzoom()},mpld3_BoxZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.TooltipPlugin=mpld3_TooltipPlugin,mpld3.register_plugin("tooltip",mpld3_TooltipPlugin),mpld3_TooltipPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_TooltipPlugin.prototype.constructor=mpld3_TooltipPlugin,mpld3_TooltipPlugin.prototype.requiredProps=["id"],mpld3_TooltipPlugin.prototype.defaultProps={labels:null,hoffset:0,voffset:10,location:"mouse"},mpld3_TooltipPlugin.prototype.draw=function(){function t(t,e){this.tooltip.style("visibility","visible").text(null===o?"("+t+")":getMod(o,e))}function e(t,e){if("mouse"===r){var i=d3.mouse(this.fig.canvas.node());this.x=i[0]+this.props.hoffset,this.y=i[1]-this.props.voffset}this.tooltip.attr("x",this.x).attr("y",this.y)}function i(t,e){this.tooltip.style("visibility","hidden")}var s=mpld3.get_element(this.props.id,this.fig),o=this.props.labels,r=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"==r||"top left"==r?(this.x=s.ax.position[0]+5+this.props.hoffset,this.tooltip.style("text-anchor","beginning")):"bottom right"==r||"top right"==r?(this.x=s.ax.position[0]+s.ax.width-5+this.props.hoffset,this.tooltip.style("text-anchor","end")):this.tooltip.style("text-anchor","middle"),"bottom left"==r||"bottom right"==r?this.y=s.ax.position[1]+s.ax.height-5+this.props.voffset:("top left"==r||"top right"==r)&&(this.y=s.ax.position[1]+5+this.props.voffset),s.elements().on("mouseover",t.bind(this)).on("mousemove",e.bind(this)).on("mouseout",i.bind(this))},mpld3.LinkedBrushPlugin=mpld3_LinkedBrushPlugin,mpld3.register_plugin("linkedbrush",mpld3_LinkedBrushPlugin),mpld3_LinkedBrushPlugin.prototype=Object.create(mpld3.Plugin.prototype),mpld3_LinkedBrushPlugin.prototype.constructor=mpld3_LinkedBrushPlugin,mpld3_LinkedBrushPlugin.prototype.requiredProps=["id"],mpld3_LinkedBrushPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_LinkedBrushPlugin.prototype.activate=function(){this.fig.enableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.deactivate=function(){this.fig.disableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.isPathInSelection=function(t,e,i,s){var o=s[0][0]<t[e]&&s[1][0]>t[e]&&s[0][1]<t[i]&&s[1][1]>t[i];return o},mpld3_LinkedBrushPlugin.prototype.invertSelection=function(t,e){var i=[e.x.invert(t[0][0]),e.x.invert(t[1][0])],s=[e.y.invert(t[1][1]),e.y.invert(t[0][1])];return[[Math.min.apply(Math,i),Math.min.apply(Math,s)],[Math.max.apply(Math,i),Math.max.apply(Math,s)]]},mpld3_LinkedBrushPlugin.prototype.update=function(t){t&&this.pathCollectionsByAxes.forEach(function(e,i){var s=e[0],o=this.objectsByAxes[i],r=this.invertSelection(t,this.fig.axes[i]),n=s.props.xindex,p=s.props.yindex;o.selectAll("path").classed("mpld3-hidden",function(t,e){return!this.isPathInSelection(t,n,p,r)}.bind(this))}.bind(this))},mpld3_LinkedBrushPlugin.prototype.end=function(){this.allObjects.selectAll("path").classed("mpld3-hidden",!1)},mpld3_LinkedBrushPlugin.prototype.draw=function(){mpld3.insert_css("#"+this.fig.figid+" path.mpld3-hidden",{stroke:"#ccc !important",fill:"#ccc !important"});var t=mpld3.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(e){return e.elements.map(function(e){return e.props[this.dataKey]==t.props[this.dataKey]?(e.group.classed(this.objectClass,!0),e):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)},mpld3.register_plugin("mouseposition",MousePositionPlugin),MousePositionPlugin.prototype=Object.create(mpld3.Plugin.prototype),MousePositionPlugin.prototype.constructor=MousePositionPlugin,MousePositionPlugin.prototype.requiredProps=[],MousePositionPlugin.prototype.defaultProps={fontsize:12,fmt:".3g"},MousePositionPlugin.prototype.draw=function(){for(var t=this.fig,e=d3.format(this.props.fmt),i=t.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),s=0;s<this.fig.axes.length;s++){var o=function(){var o=t.axes[s];return function(){var t=d3.mouse(this),s=o.x.invert(t[0]),r=o.y.invert(t[1]);i.text("("+e(s)+", "+e(r)+")")}}();t.axes[s].baseaxes.on("mousemove",o).on("mouseout",function(){i.text("")})}},mpld3.Figure=mpld3_Figure,mpld3_Figure.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Figure.prototype.constructor=mpld3_Figure,mpld3_Figure.prototype.requiredProps=["width","height"],mpld3_Figure.prototype.defaultProps={data:{},axes:[],plugins:[{type:"reset"},{type:"zoom"},{type:"boxzoom"}]},mpld3_Figure.prototype.addPlugin=function(t){if(!t.type)return console.warn("unspecified plugin type. Skipping this");var e;if(!(t.type in mpld3.plugin_map))return console.warn("Skipping unrecognized plugin: "+e);e=mpld3.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 i=mpld3_cloneObj(t);delete i.type;var s=new e(this,i);this.plugins.push(s),this.pluginsByType[t.type]=s},mpld3_Figure.prototype.draw=function(){mpld3.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()},mpld3_Figure.prototype.resetBrushForOtherAxes=function(t){this.axes.forEach(function(e){e.axid!=t&&e.resetBrush()})},mpld3_Figure.prototype.updateLinkedBrush=function(t){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.update(t)},mpld3_Figure.prototype.endLinkedBrush=function(){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.end()},mpld3_Figure.prototype.reset=function(t){this.axes.forEach(function(t){t.reset()})},mpld3_Figure.prototype.enableLinkedBrush=function(){this.axes.forEach(function(t){t.enableLinkedBrush()})},mpld3_Figure.prototype.disableLinkedBrush=function(){this.axes.forEach(function(t){t.disableLinkedBrush()})},mpld3_Figure.prototype.enableBoxzoom=function(){this.axes.forEach(function(t){t.enableBoxzoom()})},mpld3_Figure.prototype.disableBoxzoom=function(){this.axes.forEach(function(t){t.disableBoxzoom()})},mpld3_Figure.prototype.enableZoom=function(){this.axes.forEach(function(t){t.enableZoom()})},mpld3_Figure.prototype.disableZoom=function(){this.axes.forEach(function(t){t.disableZoom()})},mpld3_Figure.prototype.toggleZoom=function(){this.isZoomEnabled?this.disableZoom():this.enableZoom()},mpld3_Figure.prototype.setTicks=function(t,e,i){this.axes.forEach(function(s){s.setTicks(t,e,i)})},mpld3_Figure.prototype.setXTicks=function(t,e){this.setTicks("x",t,e)},mpld3_Figure.prototype.setYTicks=function(t,e){this.setTicks("y",t,e)},mpld3_Figure.prototype.removeNaN=function(t){output=output.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.parse_offsets=function(t){return t.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.get_data=function(t){var e=t;return null===t||"undefined"==typeof t?e=null:"string"==typeof t&&(e=this.data[t]),e},mpld3.PlotElement=mpld3_PlotElement,mpld3_PlotElement.prototype.requiredProps=[],mpld3_PlotElement.prototype.defaultProps={},mpld3_PlotElement.prototype.processProps=function(t){t=mpld3_cloneObj(t);var e={},i=this.name();this.requiredProps.forEach(function(s){if(!(s in t))throw"property '"+s+"' must be specified for "+i;e[s]=t[s],delete t[s]});for(var s in this.defaultProps)s in t?(e[s]=t[s],delete t[s]):e[s]=this.defaultProps[s];"id"in t?(e.id=t.id,delete t.id):"id"in e||(e.id=mpld3.generateId());for(var s in t)console.warn("Unrecognized property '"+s+"' for object "+this.name()+" (value = "+t[s]+").");return e},mpld3_PlotElement.prototype.name=function(){var t=/function (.{1,})\(/,e=t.exec(this.constructor.toString());return e&&e.length>1?e[1]:""},"object"==typeof module&&module.exports?module.exports=mpld3:this.mpld3=mpld3,console.log("Loaded mpld3 version "+mpld3.version);
|
|
4
4
|
|
|
5
5
|
},{"d3":33}],2:[function(require,module,exports){
|
|
6
6
|
// https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock
|
|
@@ -8,7 +8,7 @@ var mpld3 = {
|
|
|
8
8
|
plugin_map: {}
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
mpld3.version = "0.5.
|
|
11
|
+
mpld3.version = "0.5.12";
|
|
12
12
|
|
|
13
13
|
mpld3.register_plugin = function(name, obj) {
|
|
14
14
|
mpld3.plugin_map[name] = obj;
|
|
@@ -699,7 +699,13 @@ mpld3_Path.prototype.draw = function() {
|
|
|
699
699
|
} else {
|
|
700
700
|
this.path = this.ax.staticPaths.append("svg:path");
|
|
701
701
|
}
|
|
702
|
-
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("
|
|
702
|
+
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("fill", this.props.facecolor).attr("vector-effect", "non-scaling-stroke");
|
|
703
|
+
if (this.props.edgecolor.slice(0, 5) != "rgba(") {
|
|
704
|
+
this.path = this.path.style("stroke-opacity", this.props.alpha);
|
|
705
|
+
}
|
|
706
|
+
if (this.props.facecolor.slice(0, 5) != "rgba(") {
|
|
707
|
+
this.path = this.path.style("fill-opacity", this.props.alpha);
|
|
708
|
+
}
|
|
703
709
|
if (this.props.offset !== null) {
|
|
704
710
|
var offset = this.offsetcoords.xy(this.props.offset);
|
|
705
711
|
this.path.attr("transform", "translate(" + offset + ")");
|
|
@@ -770,13 +776,20 @@ mpld3_PathCollection.prototype.pathFunc = function(d, i) {
|
|
|
770
776
|
};
|
|
771
777
|
|
|
772
778
|
mpld3_PathCollection.prototype.styleFunc = function(d, i) {
|
|
779
|
+
var stroke = getMod(this.props.edgecolors, i);
|
|
780
|
+
var fill = getMod(this.props.facecolors, i);
|
|
781
|
+
var alpha = getMod(this.props.alphas, i);
|
|
773
782
|
var styles = {
|
|
774
|
-
stroke:
|
|
783
|
+
stroke: stroke,
|
|
775
784
|
"stroke-width": getMod(this.props.edgewidths, i),
|
|
776
|
-
|
|
777
|
-
fill: getMod(this.props.facecolors, i),
|
|
778
|
-
"fill-opacity": getMod(this.props.alphas, i)
|
|
785
|
+
fill: fill
|
|
779
786
|
};
|
|
787
|
+
if (stroke.slice(0, 5) != "rgba(") {
|
|
788
|
+
styles["stroke-opacity"] = alpha;
|
|
789
|
+
}
|
|
790
|
+
if (fill.slice(0, 5) != "rgba(") {
|
|
791
|
+
styles["fill-opacity"] = alpha;
|
|
792
|
+
}
|
|
780
793
|
var ret = "";
|
|
781
794
|
for (var key in styles) {
|
|
782
795
|
ret += key + ":" + styles[key] + ";";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function mpld3_cloneObj(t){var e={};for(var i in t)e[i]=t[i];return e}function mpld3_generateId(t,e){t="undefined"!=typeof t?t:10,e="undefined"!=typeof e?e:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var i=e.charAt(Math.round(Math.random()*(e.length-11))),s=1;t>s;s++)i+=e.charAt(Math.round(Math.random()*(e.length-1)));return i}function mpld3_interpolateDates(t,e){var i=d3.interpolate([t[0].valueOf(),t[1].valueOf()],[e[0].valueOf(),e[1].valueOf()]);return function(t){var e=i(t);return[new Date(e[0]),new Date(e[1])]}}function isUndefined(t){return"undefined"==typeof t}function isUndefinedOrNull(t){return null==t||isUndefined(t)}function getMod(t,e){return t.length>0?t[e%t.length]:null}function mpld3_path(t){function e(t,e){var n=function(t){return"function"==typeof t?t:function(){return t}},p=n(i),a=n(s),l=[],h=[],d=0,c=-1,u=0,m=!1;if(!e){e=["M"];for(var f=1;f<t.length;f++)e.push("L")}for(;++c<e.length;){for(u=d+r[e[c]],l=[];u>d;)o.call(this,t[d],d)?(l.push(p.call(this,t[d],d),a.call(this,t[d],d)),d++):(l=null,d=u);l?m&&l.length>0?(h.push("M",l[0],l[1]),m=!1):(h.push(e[c]),h=h.concat(l)):m=!0}return d!=t.length&&console.warn("Warning: not all vertices used in Path"),h.join(" ")}var i=function(t,e){return t[0]},s=function(t,e){return t[1]},o=function(t,e){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 e.x=function(t){return arguments.length?(i=t,e):i},e.y=function(t){return arguments.length?(s=t,e):s},e.defined=function(t){return arguments.length?(o=t,e):o},e.call=e,e}function mpld3_multiscale(t){function e(t){return i.forEach(function(e){t=e(t)}),t}var i=Array.prototype.slice.call(arguments,0),s=i.length;return e.domain=function(t){return arguments.length?(i[0].domain(t),e):i[0].domain()},e.range=function(t){return arguments.length?(i[s-1].range(t),e):i[s-1].range()},e.step=function(t){return i[t]},e}function mpld3_Grid(t,e){if(mpld3_PlotElement.call(this,t,e),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 mpld3_Axis(t,e){mpld3_PlotElement.call(this,t,e);var i={bottom:[0,this.ax.height],top:[0,0],left:[0,0],right:[this.ax.width,0]},s={bottom:"x",top:"x",left:"y",right:"y"};this.ax=t,this.transform="translate("+i[this.props.position]+")",this.props.xy=s[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 mpld3_Coordinates(t,e){if(this.trans=t,"undefined"==typeof e){if(this.ax=null,this.fig=null,"display"!==this.trans)throw"ax must be defined if transform != 'display'"}else this.ax=e,this.fig=e.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 mpld3_Path(t,e){mpld3_PlotElement.call(this,t,e),this.data=t.fig.get_data(this.props.data),this.pathcodes=this.props.pathcodes,this.pathcoords=new mpld3_Coordinates(this.props.coordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax),this.datafunc=mpld3_path()}function mpld3_PathCollection(t,e){mpld3_PlotElement.call(this,t,e),(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 s=Math.max(this.props.paths.length,i.length);if(i.length===s)this.offsets=i;else{this.offsets=[];for(var o=0;s>o;o++)this.offsets.push(getMod(i,o))}this.pathcoords=new mpld3_Coordinates(this.props.pathcoordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax)}function mpld3_Line(t,e){mpld3_PlotElement.call(this,t,e);var i=this.props;i.facecolor="none",i.edgecolor=i.color,delete i.color,i.edgewidth=i.linewidth,delete i.linewidth;const s=i.drawstyle;switch(delete i.drawstyle,this.defaultProps=mpld3_Path.prototype.defaultProps,mpld3_Path.call(this,t,i),s){case"steps":case"steps-pre":this.datafunc=d3.line().curve(d3.curveStepBefore);break;case"steps-post":this.datafunc=d3.line().curve(d3.curveStepAfter);break;case"steps-mid":this.datafunc=d3.line().curve(d3.curveStep);break;default:this.datafunc=d3.line().curve(d3.curveLinear)}}function mpld3_Markers(t,e){mpld3_PlotElement.call(this,t,e),null!==this.props.markerpath?this.marker=0==this.props.markerpath[0].length?null:mpld3.path().call(this.props.markerpath[0],this.props.markerpath[1]):this.marker=null===this.props.markername?null:d3.symbol(this.props.markername).size(Math.pow(this.props.markersize,2))();var i={paths:[this.props.markerpath],offsets:t.fig.parse_offsets(t.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=mpld3_PathCollection.prototype.requiredProps,this.defaultProps=mpld3_PathCollection.prototype.defaultProps,mpld3_PathCollection.call(this,t,i)}function mpld3_Image(t,e){mpld3_PlotElement.call(this,t,e),this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Text(t,e){mpld3_PlotElement.call(this,t,e),this.text=this.props.text,this.position=this.props.position,this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Axes(t,e){function i(t){return new Date(t[0],t[1],t[2],t[3],t[4],t[5])}function s(t,e){return"date"!==t?e:[i(e[0]),i(e[1])]}function o(t,e,i){var s="date"===t?d3.scaleTime():"log"===t?d3.scaleLog():d3.scaleLinear();return s.domain(e).range(i)}mpld3_PlotElement.call(this,t,e),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 r=this.props.bbox;this.position=[r[0]*this.fig.width,(1-r[1]-r[3])*this.fig.height],this.width=r[2]*this.fig.width,this.height=r[3]*this.fig.height,this.isZoomEnabled=null,this.zoom=null,this.lastTransform=d3.zoomIdentity,this.isBoxzoomEnabled=null,this.isLinkedBrushEnabled=null,this.isCurrentLinkedBrushTarget=!1,this.brushG=null,this.props.xdomain=s(this.props.xscale,this.props.xdomain),this.props.ydomain=s(this.props.yscale,this.props.ydomain),this.x=this.xdom=o(this.props.xscale,this.props.xdomain,[0,this.width]),this.y=this.ydom=o(this.props.yscale,this.props.ydomain,[this.height,0]),"date"===this.props.xscale&&(this.x=mpld3.multiscale(d3.scaleLinear().domain(this.props.xlim).range(this.props.xdomain.map(Number)),this.xdom)),"date"===this.props.yscale&&(this.y=mpld3.multiscale(d3.scaleLinear().domain(this.props.ylim).range(this.props.ydomain.map(Number)),this.ydom));for(var n=this.props.axes,p=0;p<n.length;p++){var a=new mpld3.Axis(this,n[p]);this.axisList.push(a),this.elements.push(a),(this.props.gridOn||a.props.grid.gridOn)&&this.elements.push(a.getGrid())}for(var l=this.props.paths,p=0;p<l.length;p++)this.elements.push(new mpld3.Path(this,l[p]));for(var h=this.props.lines,p=0;p<h.length;p++)this.elements.push(new mpld3.Line(this,h[p]));for(var d=this.props.markers,p=0;p<d.length;p++)this.elements.push(new mpld3.Markers(this,d[p]));for(var c=this.props.texts,p=0;p<c.length;p++)this.elements.push(new mpld3.Text(this,c[p]));for(var u=this.props.collections,p=0;p<u.length;p++)this.elements.push(new mpld3.PathCollection(this,u[p]));for(var m=this.props.images,p=0;p<m.length;p++)this.elements.push(new mpld3.Image(this,m[p]));this.elements.sort(function(t,e){return t.props.zorder-e.props.zorder})}function mpld3_Toolbar(t,e){mpld3_PlotElement.call(this,t,e),this.buttons=[],this.props.buttons.forEach(this.addButton.bind(this))}function mpld3_Button(t,e){mpld3_PlotElement.call(this,t),this.toolbar=t,this.fig=this.toolbar.fig,this.cssclass="mpld3-"+e+"button",this.active=!1}function mpld3_Plugin(t,e){mpld3_PlotElement.call(this,t,e)}function mpld3_ResetPlugin(t,e){mpld3_Plugin.call(this,t,e);var i=mpld3.ButtonFactory({buttonID:"reset",sticky:!1,onActivate:function(){this.toolbar.fig.reset()},icon:function(){return mpld3.icons.reset}});this.fig.buttons.push(i)}function mpld3_ZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.move}});this.fig.buttons.push(s)}}function mpld3_BoxZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.zoom}});this.fig.buttons.push(s)}this.extentClass="boxzoombrush"}function mpld3_TooltipPlugin(t,e){mpld3_Plugin.call(this,t,e)}function mpld3_LinkedBrushPlugin(t,e){mpld3.Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.brush}});this.fig.buttons.push(s)}this.pathCollectionsByAxes=[],this.objectsByAxes=[],this.allObjects=[],this.extentClass="linkedbrush",this.dataKey="offsets",this.objectClass=null}function MousePositionPlugin(t,e){mpld3.Plugin.call(this,t,e)}function mpld3_Figure(t,e){mpld3_PlotElement.call(this,null,e),this.figid=t,this.width=this.props.width,this.height=this.props.height,this.data=this.props.data,this.buttons=[],this.root=d3.select("#"+t).append("div").style("position","relative"),this.axes=[];for(var i=0;i<this.props.axes.length;i++)this.axes.push(new mpld3_Axes(this,this.props.axes[i]));this.plugins=[],this.pluginsByType={},this.props.plugins.forEach(function(t){this.addPlugin(t)}.bind(this)),this.toolbar=new mpld3.Toolbar(this,{buttons:this.buttons})}function mpld3_PlotElement(t,e){this.parent=isUndefinedOrNull(t)?null:t,this.props=isUndefinedOrNull(e)?{}:this.processProps(e),this.fig=t instanceof mpld3_Figure?t:t&&"fig"in t?t.fig:null,this.ax=t instanceof mpld3_Axes?t:t&&"ax"in t?t.ax:null}if(!d3)var d3=require("d3");var mpld3={_mpld3IsLoaded:!0,figures:[],plugin_map:{}};mpld3.version="0.5.11",mpld3.register_plugin=function(t,e){mpld3.plugin_map[t]=e},mpld3.remove_figure=function(t){var e=document.getElementById(t);null!==e&&(e.innerHTML="");for(var i=0;i<mpld3.figures.length;i++){var s=mpld3.figures[i];s.figid===t&&mpld3.figures.splice(i,1)}return!0},mpld3.draw_figure=function(t,e,i,s){var o=document.getElementById(t);if(s="undefined"!=typeof s?s:!1,s&&mpld3.remove_figure(t),null===o)throw t+" is not a valid id";var r=new mpld3.Figure(t,e);return i&&i(r,o),mpld3.figures.push(r),r.draw(),r},mpld3.cloneObj=mpld3_cloneObj,mpld3.boundsToTransform=function(t,e){var i=t.width,s=t.height,o=e[1][0]-e[0][0],r=e[1][1]-e[0][1],n=(e[0][0]+e[1][0])/2,p=(e[0][1]+e[1][1])/2,a=Math.max(1,Math.min(8,.9/Math.max(o/i,r/s))),l=[i/2-a*n,s/2-a*p];return{translate:l,scale:a}},mpld3.getTransformation=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","g");e.setAttributeNS(null,"transform",t);var i,s,o,r=e.transform.baseVal.consolidate().matrix,n=r.a,p=r.b,a=r.c,l=r.d,h=r.e,d=r.f;(i=Math.sqrt(n*n+p*p))&&(n/=i,p/=i),(o=n*a+p*l)&&(a-=n*o,l-=p*o),(s=Math.sqrt(a*a+l*l))&&(a/=s,l/=s,o/=s),p*a>n*l&&(n=-n,p=-p,o=-o,i=-i);var c={translateX:h,translateY:d,rotate:180*Math.atan2(p,n)/Math.PI,skewX:180*Math.atan(o)/Math.PI,scaleX:i,scaleY:s},u="translate("+c.translateX+","+c.translateY+")rotate("+c.rotate+")skewX("+c.skewX+")scale("+c.scaleX+","+c.scaleY+")";return u},mpld3.merge_objects=function(t){for(var e,i={},s=0;s<arguments.length;s++){e=arguments[s];for(var o in e)i[o]=e[o]}return i},mpld3.generate_id=function(t,e){return console.warn("mpld3.generate_id is deprecated. Use mpld3.generateId instead."),mpld3_generateId(t,e)},mpld3.generateId=mpld3_generateId,mpld3.get_element=function(t,e){var i,s,o;i="undefined"==typeof e?mpld3.figures:"undefined"==typeof e.length?[e]:e;for(var r=0;r<i.length;r++){if(e=i[r],e.props.id===t)return e;for(var n=0;n<e.axes.length;n++){if(s=e.axes[n],s.props.id===t)return s;for(var p=0;p<s.elements.length;p++)if(o=s.elements[p],o.props.id===t)return o}}return null},mpld3.insert_css=function(t,e){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style"),o=t+" {";for(var r in e)o+=r+":"+e[r]+"; ";o+="}",s.type="text/css",s.styleSheet?s.styleSheet.cssText=o:s.appendChild(document.createTextNode(o)),i.appendChild(s)},mpld3.process_props=function(t,e,i,s){function o(t){mpld3_PlotElement.call(this,null,t)}console.warn("mpld3.process_props is deprecated. Plot elements should derive from mpld3.PlotElement"),o.prototype=Object.create(mpld3_PlotElement.prototype),o.prototype.constructor=o,o.prototype.requiredProps=s,o.prototype.defaultProps=i;var r=new o(e);return r.props},mpld3.interpolateDates=mpld3_interpolateDates,mpld3.path=function(){return mpld3_path()},mpld3.multiscale=mpld3_multiscale,mpld3.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"},mpld3.Grid=mpld3_Grid,mpld3_Grid.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Grid.prototype.constructor=mpld3_Grid,mpld3_Grid.prototype.requiredProps=["xy"],mpld3_Grid.prototype.defaultProps={color:"gray",dasharray:"2,2",alpha:"0.5",nticks:10,gridOn:!0,tickvalues:null,zorder:0},mpld3_Grid.prototype.draw=function(){var t={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.position];this.grid=d3[t](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),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .tick",{stroke:this.props.color,"stroke-dasharray":this.props.dasharray,"stroke-opacity":this.props.alpha}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" path",{"stroke-width":0}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .domain",{"pointer-events":"none"})},mpld3_Grid.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)},mpld3.Axis=mpld3_Axis,mpld3_Axis.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axis.prototype.constructor=mpld3_Axis,mpld3_Axis.prototype.requiredProps=["position"],mpld3_Axis.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},mpld3_Axis.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 e in this.props.grid)t[e]=this.props.grid[e];return new mpld3_Grid(this.ax,t)},mpld3_Axis.prototype.wrapTicks=function(){function t(t,e,i){i=i||1.2,t.each(function(){for(var t,s=d3.select(this),o=s.node().getBBox(),r=o.height,n=s.text().split(/\s+/).reverse(),p=[],a=0,l=s.attr("y"),h=r,d=s.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",h);t=n.pop();)p.push(t),d.text(p.join(" ")),d.node().getComputedTextLength()>e&&(p.pop(),d.text(p.join(" ")),p=[t],d=s.append("tspan").attr("x",0).attr("y",l).attr("dy",++a*(r*i)+h).text(t))})}var e=80;"x"==this.props.xy&&this.elem.selectAll("text").call(t,e)},mpld3_Axis.prototype.draw=function(){var t="x"===this.props.xy?this.parent.props.xscale:this.parent.props.yscale;if("date"===t&&this.props.tickvalues){var e="x"===this.props.xy?this.parent.x.domain():this.parent.y.domain(),i="x"===this.props.xy?this.parent.xdom.domain():this.parent.ydom.domain(),s=d3.scaleLinear().domain(e).range(i);this.props.tickvalues=this.props.tickvalues.map(function(t){return new Date(s(t))})}var o={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.props.position];this.axis=d3[o](this.scale);var r=this;this.filter_ticks(this.axis.scale().domain()),"index"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[t]}):"percent"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=t/r.props.tickformat.xmax*100,s=r.props.tickformat.decimals||0,o=d3.format("."+s+"f")(i);return o+r.props.tickformat.symbol}):"str_method"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=d3.format(r.props.tickformat.format_string)(t);return r.props.tickformat.prefix+i+r.props.tickformat.suffix}):"fixed"==this.props.tickformat_formatter||"func"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[e]}):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(),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" line, ."+this.cssclass+" path",{"shape-rendering":"crispEdges",stroke:this.props.axiscolor,fill:"none"}),mpld3.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"})},mpld3_Axis.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)},mpld3_Axis.prototype.setTicks=function(t,e){this.tickNr=t,this.tickFormat=e},mpld3_Axis.prototype.filter_ticks=function(t){if(this.props.tickvalues){const e=this,i=this.props.tickvalues.map(function(t,e){return e}).filter(function(i,s){const o=e.props.tickvalues[i];return o>=t[0]&&o<=t[1]});this.props.filtered_tickvalues=this.props.tickvalues.filter(function(t,e){return i.includes(e)}),this.props.tickformat?this.props.filtered_tickformat=this.props.tickformat.filter(function(t,e){return i.includes(e)}):this.props.filtered_tickformat=this.props.tickformat}else this.props.filtered_tickvalues=this.props.tickvalues,this.props.filtered_tickformat=this.props.tickformat},mpld3.Coordinates=mpld3_Coordinates,mpld3_Coordinates.prototype.xy=function(t,e,i){return e="undefined"==typeof e?0:e,i="undefined"==typeof i?1:i,[this.x(t[e]),this.y(t[i])]},mpld3_Coordinates.prototype.x_data=function(t){return this.ax.x(t)},mpld3_Coordinates.prototype.y_data=function(t){return this.ax.y(t)},mpld3_Coordinates.prototype.x_display=function(t){return t},mpld3_Coordinates.prototype.y_display=function(t){return t},mpld3_Coordinates.prototype.x_axes=function(t){return t*this.ax.width},mpld3_Coordinates.prototype.y_axes=function(t){return this.ax.height*(1-t)},mpld3_Coordinates.prototype.x_figure=function(t){return t*this.fig.width-this.ax.position[0]},mpld3_Coordinates.prototype.y_figure=function(t){return(1-t)*this.fig.height-this.ax.position[1]},mpld3.Path=mpld3_Path,mpld3_Path.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Path.prototype.constructor=mpld3_Path,mpld3_Path.prototype.requiredProps=["data"],mpld3_Path.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},mpld3_Path.prototype.finiteFilter=function(t,e){return isFinite(this.pathcoords.x(t[this.props.xindex]))&&isFinite(this.pathcoords.y(t[this.props.yindex]))},mpld3_Path.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+")")}},mpld3_Path.prototype.elements=function(t){return this.path},mpld3.PathCollection=mpld3_PathCollection,mpld3_PathCollection.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_PathCollection.prototype.constructor=mpld3_PathCollection,mpld3_PathCollection.prototype.requiredProps=["paths","offsets"],mpld3_PathCollection.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},mpld3_PathCollection.prototype.transformFunc=function(t,e){var i=this.props.pathtransforms,s=0==i.length?"":mpld3.getTransformation("matrix("+getMod(i,e)+")").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?s+o:o+s},mpld3_PathCollection.prototype.pathFunc=function(t,e){return mpld3_path().x(function(t){return this.pathcoords.x(t[0])}.bind(this)).y(function(t){return this.pathcoords.y(t[1])}.bind(this)).apply(this,getMod(this.props.paths,e))},mpld3_PathCollection.prototype.styleFunc=function(t,e){var i={stroke:getMod(this.props.edgecolors,e),"stroke-width":getMod(this.props.edgewidths,e),"stroke-opacity":getMod(this.props.alphas,e),fill:getMod(this.props.facecolors,e),"fill-opacity":getMod(this.props.alphas,e)},s="";for(var o in i)s+=o+":"+i[o]+";";return s},mpld3_PathCollection.prototype.allFinite=function(t){return t instanceof Array?t.length==t.filter(isFinite).length:!0},mpld3_PathCollection.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")},mpld3_PathCollection.prototype.elements=function(t){return this.group.selectAll("path")},mpld3.Line=mpld3_Line,mpld3_Line.prototype=Object.create(mpld3_Path.prototype),mpld3_Line.prototype.constructor=mpld3_Line,mpld3_Line.prototype.requiredProps=["data"],mpld3_Line.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",color:"salmon",linewidth:2,dasharray:"none",alpha:1,zorder:2,drawstyle:"none"},mpld3.Markers=mpld3_Markers,mpld3_Markers.prototype=Object.create(mpld3_PathCollection.prototype),mpld3_Markers.prototype.constructor=mpld3_Markers,mpld3_Markers.prototype.requiredProps=["data"],mpld3_Markers.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},mpld3_Markers.prototype.pathFunc=function(t,e){return this.marker},mpld3.Image=mpld3_Image,mpld3_Image.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Image.prototype.constructor=mpld3_Image,mpld3_Image.prototype.requiredProps=["data","extent"],mpld3_Image.prototype.defaultProps={alpha:1,coordinates:"data",drawstyle:"none",zorder:1},mpld3_Image.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()},mpld3_Image.prototype.elements=function(t){return d3.select(this.image)},mpld3_Image.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]))},mpld3.Text=mpld3_Text,mpld3_Text.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Text.prototype.constructor=mpld3_Text,mpld3_Text.prototype.requiredProps=["text","position"],mpld3_Text.prototype.defaultProps={coordinates:"data",h_anchor:"start",v_baseline:"auto",rotation:0,fontsize:11,drawstyle:"none",color:"black",alpha:1,zorder:3},mpld3_Text.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()},mpld3_Text.prototype.elements=function(t){return d3.select(this.obj)},mpld3_Text.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+")")},mpld3.Axes=mpld3_Axes,mpld3_Axes.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axes.prototype.constructor=mpld3_Axes,mpld3_Axes.prototype.requiredProps=["xlim","ylim"],mpld3_Axes.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:[]},mpld3_Axes.prototype.draw=function(){for(var t=0;t<this.props.sharex.length;t++)this.sharex.push(mpld3.get_element(this.props.sharex[t]));for(var t=0;t<this.props.sharey.length;t++)this.sharey.push(mpld3.get_element(this.props.sharey[t]));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=d3.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(){d3.select(window).on("keydown.brush keyup.brush",null)});for(var t=0;t<this.elements.length;t++)this.elements[t].draw()},mpld3_Axes.prototype.bindZoom=function(){this.zoom||(this.zoom=d3.zoom(),this.zoom.on("zoom",this.zoomed.bind(this)),this.axes.call(this.zoom))},mpld3_Axes.prototype.unbindZoom=function(){this.zoom&&(this.zoom.on("zoom",null),this.axes.on(".zoom",null),this.zoom=null)},mpld3_Axes.prototype.bindBrush=function(){this.brushG||(this.brushG=this.axes.append("g").attr("class","mpld3-brush").call(this.brush))},mpld3_Axes.prototype.unbindBrush=function(){this.brushG&&(this.brushG.remove(),this.brushG.on(".brush",null),this.brushG=null)},mpld3_Axes.prototype.reset=function(){this.zoom?this.doZoom(!1,d3.zoomIdentity,750):(this.bindZoom(),this.doZoom(!1,d3.zoomIdentity,750,function(){this.isSomeTypeOfZoomEnabled||this.unbindZoom()}.bind(this)))},mpld3_Axes.prototype.enableOrDisableBrushing=function(){this.isBoxzoomEnabled||this.isLinkedBrushEnabled?this.bindBrush():this.unbindBrush()},mpld3_Axes.prototype.isSomeTypeOfZoomEnabled=function(){return this.isZoomEnabled||this.isBoxzoomEnabled},mpld3_Axes.prototype.enableOrDisableZooming=function(){this.isSomeTypeOfZoomEnabled()?this.bindZoom():this.unbindZoom()},mpld3_Axes.prototype.enableLinkedBrush=function(){this.isLinkedBrushEnabled=!0,this.enableOrDisableBrushing()},mpld3_Axes.prototype.disableLinkedBrush=function(){this.isLinkedBrushEnabled=!1,this.enableOrDisableBrushing()},mpld3_Axes.prototype.enableBoxzoom=function(){
|
|
2
|
-
this.isBoxzoomEnabled=!0,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.disableBoxzoom=function(){this.isBoxzoomEnabled=!1,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.enableZoom=function(){this.isZoomEnabled=!0,this.enableOrDisableZooming(),this.axes.style("cursor","move")},mpld3_Axes.prototype.disableZoom=function(){this.isZoomEnabled=!1,this.enableOrDisableZooming(),this.axes.style("cursor",null)},mpld3_Axes.prototype.doZoom=function(t,e,i,s){if(this.props.zoomable&&this.zoom){if(i){var o=this.axes.transition().duration(i).call(this.zoom.transform,e);s&&o.on("end",s)}else this.axes.call(this.zoom.transform,e);t?(this.lastTransform=e,this.sharex.forEach(function(t){t.doZoom(!1,e,i)}),this.sharey.forEach(function(t){t.doZoom(!1,e,i)})):this.lastTransform=e}},mpld3_Axes.prototype.zoomed=function(){var t=d3.event.sourceEvent&&"zoom"!=d3.event.sourceEvent.type;if(t)this.doZoom(!0,d3.event.transform,!1);else{var e=d3.event.transform;this.paths.attr("transform",e),this.elements.forEach(function(t){t.zoomed&&t.zoomed(e)}.bind(this))}},mpld3_Axes.prototype.resetBrush=function(){this.brushG.call(this.brush.move,null)},mpld3_Axes.prototype.doBoxzoom=function(t){if(t&&this.brushG){var e=t.map(this.lastTransform.invert,this.lastTransform),i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=(e[0][0]+e[1][0])/2,r=(e[0][1]+e[1][1])/2,n=i>s?this.width/i:this.height/s,p=this.width/2-n*o,a=this.height/2-n*r,l=d3.zoomIdentity.translate(p,a).scale(n);this.doZoom(!0,l,750),this.resetBrush()}},mpld3_Axes.prototype.brushStart=function(){this.isLinkedBrushEnabled&&(this.isCurrentLinkedBrushTarget="MouseEvent"==d3.event.sourceEvent.constructor.name,this.isCurrentLinkedBrushTarget&&this.fig.resetBrushForOtherAxes(this.axid))},mpld3_Axes.prototype.brushMove=function(){var t=d3.event.selection;this.isLinkedBrushEnabled&&this.fig.updateLinkedBrush(t)},mpld3_Axes.prototype.brushEnd=function(){var t=d3.event.selection;this.isBoxzoomEnabled&&this.doBoxzoom(t),this.isLinkedBrushEnabled&&(t||this.fig.endLinkedBrush(),this.isCurrentLinkedBrushTarget=!1)},mpld3_Axes.prototype.setTicks=function(t,e,i){this.axisList.forEach(function(s){s.props.xy==t&&s.setTicks(e,i)})},mpld3.Toolbar=mpld3_Toolbar,mpld3_Toolbar.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Toolbar.prototype.constructor=mpld3_Toolbar,mpld3_Toolbar.prototype.defaultProps={buttons:["reset","move"]},mpld3_Toolbar.prototype.addButton=function(t){this.buttons.push(new t(this))},mpld3_Toolbar.prototype.draw=function(){function t(){this.buttonsobj.transition(750).attr("y",0)}function e(){this.buttonsobj.transition(750).delay(250).attr("y",16)}mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image",{cursor:"pointer",opacity:.2,display:"inline-block",margin:"0px"}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.active",{opacity:.4}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.pressed",{opacity:.6}),this.fig.canvas.on("mouseenter",t.bind(this)).on("mouseleave",e.bind(this)).on("touchenter",t.bind(this)).on("touchstart",t.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,e){return 16*e}).attr("y",16).on("click",function(t){t.click()}).on("mouseenter",function(){d3.select(this).classed("active",!0)}).on("mouseleave",function(){d3.select(this).classed("active",!1)});for(var i=0;i<this.buttons.length;i++)this.buttons[i].onDraw()},mpld3_Toolbar.prototype.deactivate_all=function(){this.buttons.forEach(function(t){t.deactivate()})},mpld3_Toolbar.prototype.deactivate_by_action=function(t){function e(e){return-1!==t.indexOf(e)}t.length>0&&this.buttons.forEach(function(t){t.actions.filter(e).length>0&&t.deactivate()})},mpld3.Button=mpld3_Button,mpld3_Button.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Button.prototype.constructor=mpld3_Button,mpld3_Button.prototype.setState=function(t){t?this.activate():this.deactivate()},mpld3_Button.prototype.click=function(){this.active?this.deactivate():this.activate()},mpld3_Button.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()},mpld3_Button.prototype.deactivate=function(){this.onDeactivate(),this.active=!1,this.toolbar.toolbar.select("."+this.cssclass).classed("pressed",!1)},mpld3_Button.prototype.sticky=!1,mpld3_Button.prototype.actions=[],mpld3_Button.prototype.icon=function(){return""},mpld3_Button.prototype.onActivate=function(){},mpld3_Button.prototype.onDeactivate=function(){},mpld3_Button.prototype.onDraw=function(){},mpld3.ButtonFactory=function(t){function e(t){mpld3_Button.call(this,t,this.buttonID)}if("string"!=typeof t.buttonID)throw"ButtonFactory: buttonID must be present and be a string";e.prototype=Object.create(mpld3_Button.prototype),e.prototype.constructor=e;for(var i in t)e.prototype[i]=t[i];return e},mpld3.Plugin=mpld3_Plugin,mpld3_Plugin.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Plugin.prototype.constructor=mpld3_Plugin,mpld3_Plugin.prototype.requiredProps=[],mpld3_Plugin.prototype.defaultProps={},mpld3_Plugin.prototype.draw=function(){},mpld3.ResetPlugin=mpld3_ResetPlugin,mpld3.register_plugin("reset",mpld3_ResetPlugin),mpld3_ResetPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ResetPlugin.prototype.constructor=mpld3_ResetPlugin,mpld3_ResetPlugin.prototype.requiredProps=[],mpld3_ResetPlugin.prototype.defaultProps={},mpld3.ZoomPlugin=mpld3_ZoomPlugin,mpld3.register_plugin("zoom",mpld3_ZoomPlugin),mpld3_ZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ZoomPlugin.prototype.constructor=mpld3_ZoomPlugin,mpld3_ZoomPlugin.prototype.requiredProps=[],mpld3_ZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_ZoomPlugin.prototype.activate=function(){this.fig.enableZoom()},mpld3_ZoomPlugin.prototype.deactivate=function(){this.fig.disableZoom()},mpld3_ZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.BoxZoomPlugin=mpld3_BoxZoomPlugin,mpld3.register_plugin("boxzoom",mpld3_BoxZoomPlugin),mpld3_BoxZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_BoxZoomPlugin.prototype.constructor=mpld3_BoxZoomPlugin,mpld3_BoxZoomPlugin.prototype.requiredProps=[],mpld3_BoxZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_BoxZoomPlugin.prototype.activate=function(){this.fig.enableBoxzoom()},mpld3_BoxZoomPlugin.prototype.deactivate=function(){this.fig.disableBoxzoom()},mpld3_BoxZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.TooltipPlugin=mpld3_TooltipPlugin,mpld3.register_plugin("tooltip",mpld3_TooltipPlugin),mpld3_TooltipPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_TooltipPlugin.prototype.constructor=mpld3_TooltipPlugin,mpld3_TooltipPlugin.prototype.requiredProps=["id"],mpld3_TooltipPlugin.prototype.defaultProps={labels:null,hoffset:0,voffset:10,location:"mouse"},mpld3_TooltipPlugin.prototype.draw=function(){function t(t,e){this.tooltip.style("visibility","visible").text(null===o?"("+t+")":getMod(o,e))}function e(t,e){if("mouse"===r){var i=d3.mouse(this.fig.canvas.node());this.x=i[0]+this.props.hoffset,this.y=i[1]-this.props.voffset}this.tooltip.attr("x",this.x).attr("y",this.y)}function i(t,e){this.tooltip.style("visibility","hidden")}var s=mpld3.get_element(this.props.id,this.fig),o=this.props.labels,r=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"==r||"top left"==r?(this.x=s.ax.position[0]+5+this.props.hoffset,this.tooltip.style("text-anchor","beginning")):"bottom right"==r||"top right"==r?(this.x=s.ax.position[0]+s.ax.width-5+this.props.hoffset,this.tooltip.style("text-anchor","end")):this.tooltip.style("text-anchor","middle"),"bottom left"==r||"bottom right"==r?this.y=s.ax.position[1]+s.ax.height-5+this.props.voffset:("top left"==r||"top right"==r)&&(this.y=s.ax.position[1]+5+this.props.voffset),s.elements().on("mouseover",t.bind(this)).on("mousemove",e.bind(this)).on("mouseout",i.bind(this))},mpld3.LinkedBrushPlugin=mpld3_LinkedBrushPlugin,mpld3.register_plugin("linkedbrush",mpld3_LinkedBrushPlugin),mpld3_LinkedBrushPlugin.prototype=Object.create(mpld3.Plugin.prototype),mpld3_LinkedBrushPlugin.prototype.constructor=mpld3_LinkedBrushPlugin,mpld3_LinkedBrushPlugin.prototype.requiredProps=["id"],mpld3_LinkedBrushPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_LinkedBrushPlugin.prototype.activate=function(){this.fig.enableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.deactivate=function(){this.fig.disableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.isPathInSelection=function(t,e,i,s){var o=s[0][0]<t[e]&&s[1][0]>t[e]&&s[0][1]<t[i]&&s[1][1]>t[i];return o},mpld3_LinkedBrushPlugin.prototype.invertSelection=function(t,e){var i=[e.x.invert(t[0][0]),e.x.invert(t[1][0])],s=[e.y.invert(t[1][1]),e.y.invert(t[0][1])];return[[Math.min.apply(Math,i),Math.min.apply(Math,s)],[Math.max.apply(Math,i),Math.max.apply(Math,s)]]},mpld3_LinkedBrushPlugin.prototype.update=function(t){t&&this.pathCollectionsByAxes.forEach(function(e,i){var s=e[0],o=this.objectsByAxes[i],r=this.invertSelection(t,this.fig.axes[i]),n=s.props.xindex,p=s.props.yindex;o.selectAll("path").classed("mpld3-hidden",function(t,e){return!this.isPathInSelection(t,n,p,r)}.bind(this))}.bind(this))},mpld3_LinkedBrushPlugin.prototype.end=function(){this.allObjects.selectAll("path").classed("mpld3-hidden",!1)},mpld3_LinkedBrushPlugin.prototype.draw=function(){mpld3.insert_css("#"+this.fig.figid+" path.mpld3-hidden",{stroke:"#ccc !important",fill:"#ccc !important"});var t=mpld3.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(e){return e.elements.map(function(e){return e.props[this.dataKey]==t.props[this.dataKey]?(e.group.classed(this.objectClass,!0),e):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)},mpld3.register_plugin("mouseposition",MousePositionPlugin),MousePositionPlugin.prototype=Object.create(mpld3.Plugin.prototype),MousePositionPlugin.prototype.constructor=MousePositionPlugin,MousePositionPlugin.prototype.requiredProps=[],MousePositionPlugin.prototype.defaultProps={fontsize:12,fmt:".3g"},MousePositionPlugin.prototype.draw=function(){for(var t=this.fig,e=d3.format(this.props.fmt),i=t.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),s=0;s<this.fig.axes.length;s++){var o=function(){var o=t.axes[s];return function(){var t=d3.mouse(this),s=o.x.invert(t[0]),r=o.y.invert(t[1]);i.text("("+e(s)+", "+e(r)+")")}}();t.axes[s].baseaxes.on("mousemove",o).on("mouseout",function(){i.text("")})}},mpld3.Figure=mpld3_Figure,mpld3_Figure.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Figure.prototype.constructor=mpld3_Figure,mpld3_Figure.prototype.requiredProps=["width","height"],mpld3_Figure.prototype.defaultProps={data:{},axes:[],plugins:[{type:"reset"},{type:"zoom"},{type:"boxzoom"}]},mpld3_Figure.prototype.addPlugin=function(t){if(!t.type)return console.warn("unspecified plugin type. Skipping this");var e;if(!(t.type in mpld3.plugin_map))return console.warn("Skipping unrecognized plugin: "+e);e=mpld3.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 i=mpld3_cloneObj(t);delete i.type;var s=new e(this,i);this.plugins.push(s),this.pluginsByType[t.type]=s},mpld3_Figure.prototype.draw=function(){mpld3.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()},mpld3_Figure.prototype.resetBrushForOtherAxes=function(t){this.axes.forEach(function(e){e.axid!=t&&e.resetBrush()})},mpld3_Figure.prototype.updateLinkedBrush=function(t){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.update(t)},mpld3_Figure.prototype.endLinkedBrush=function(){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.end()},mpld3_Figure.prototype.reset=function(t){this.axes.forEach(function(t){t.reset()})},mpld3_Figure.prototype.enableLinkedBrush=function(){this.axes.forEach(function(t){t.enableLinkedBrush()})},mpld3_Figure.prototype.disableLinkedBrush=function(){this.axes.forEach(function(t){t.disableLinkedBrush()})},mpld3_Figure.prototype.enableBoxzoom=function(){this.axes.forEach(function(t){t.enableBoxzoom()})},mpld3_Figure.prototype.disableBoxzoom=function(){this.axes.forEach(function(t){t.disableBoxzoom()})},mpld3_Figure.prototype.enableZoom=function(){this.axes.forEach(function(t){t.enableZoom()})},mpld3_Figure.prototype.disableZoom=function(){this.axes.forEach(function(t){t.disableZoom()})},mpld3_Figure.prototype.toggleZoom=function(){this.isZoomEnabled?this.disableZoom():this.enableZoom()},mpld3_Figure.prototype.setTicks=function(t,e,i){this.axes.forEach(function(s){s.setTicks(t,e,i)})},mpld3_Figure.prototype.setXTicks=function(t,e){this.setTicks("x",t,e)},mpld3_Figure.prototype.setYTicks=function(t,e){this.setTicks("y",t,e)},mpld3_Figure.prototype.removeNaN=function(t){output=output.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.parse_offsets=function(t){return t.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.get_data=function(t){var e=t;return null===t||"undefined"==typeof t?e=null:"string"==typeof t&&(e=this.data[t]),e},mpld3.PlotElement=mpld3_PlotElement,mpld3_PlotElement.prototype.requiredProps=[],mpld3_PlotElement.prototype.defaultProps={},mpld3_PlotElement.prototype.processProps=function(t){t=mpld3_cloneObj(t);var e={},i=this.name();this.requiredProps.forEach(function(s){if(!(s in t))throw"property '"+s+"' must be specified for "+i;e[s]=t[s],delete t[s]});for(var s in this.defaultProps)s in t?(e[s]=t[s],delete t[s]):e[s]=this.defaultProps[s];"id"in t?(e.id=t.id,delete t.id):"id"in e||(e.id=mpld3.generateId());for(var s in t)console.warn("Unrecognized property '"+s+"' for object "+this.name()+" (value = "+t[s]+").");return e},mpld3_PlotElement.prototype.name=function(){var t=/function (.{1,})\(/,e=t.exec(this.constructor.toString());return e&&e.length>1?e[1]:""},"object"==typeof module&&module.exports?module.exports=mpld3:this.mpld3=mpld3,console.log("Loaded mpld3 version "+mpld3.version);
|
|
1
|
+
function mpld3_cloneObj(t){var e={};for(var i in t)e[i]=t[i];return e}function mpld3_generateId(t,e){t="undefined"!=typeof t?t:10,e="undefined"!=typeof e?e:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var i=e.charAt(Math.round(Math.random()*(e.length-11))),s=1;t>s;s++)i+=e.charAt(Math.round(Math.random()*(e.length-1)));return i}function mpld3_interpolateDates(t,e){var i=d3.interpolate([t[0].valueOf(),t[1].valueOf()],[e[0].valueOf(),e[1].valueOf()]);return function(t){var e=i(t);return[new Date(e[0]),new Date(e[1])]}}function isUndefined(t){return"undefined"==typeof t}function isUndefinedOrNull(t){return null==t||isUndefined(t)}function getMod(t,e){return t.length>0?t[e%t.length]:null}function mpld3_path(t){function e(t,e){var n=function(t){return"function"==typeof t?t:function(){return t}},p=n(i),a=n(s),l=[],h=[],d=0,c=-1,u=0,m=!1;if(!e){e=["M"];for(var f=1;f<t.length;f++)e.push("L")}for(;++c<e.length;){for(u=d+r[e[c]],l=[];u>d;)o.call(this,t[d],d)?(l.push(p.call(this,t[d],d),a.call(this,t[d],d)),d++):(l=null,d=u);l?m&&l.length>0?(h.push("M",l[0],l[1]),m=!1):(h.push(e[c]),h=h.concat(l)):m=!0}return d!=t.length&&console.warn("Warning: not all vertices used in Path"),h.join(" ")}var i=function(t,e){return t[0]},s=function(t,e){return t[1]},o=function(t,e){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 e.x=function(t){return arguments.length?(i=t,e):i},e.y=function(t){return arguments.length?(s=t,e):s},e.defined=function(t){return arguments.length?(o=t,e):o},e.call=e,e}function mpld3_multiscale(t){function e(t){return i.forEach(function(e){t=e(t)}),t}var i=Array.prototype.slice.call(arguments,0),s=i.length;return e.domain=function(t){return arguments.length?(i[0].domain(t),e):i[0].domain()},e.range=function(t){return arguments.length?(i[s-1].range(t),e):i[s-1].range()},e.step=function(t){return i[t]},e}function mpld3_Grid(t,e){if(mpld3_PlotElement.call(this,t,e),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 mpld3_Axis(t,e){mpld3_PlotElement.call(this,t,e);var i={bottom:[0,this.ax.height],top:[0,0],left:[0,0],right:[this.ax.width,0]},s={bottom:"x",top:"x",left:"y",right:"y"};this.ax=t,this.transform="translate("+i[this.props.position]+")",this.props.xy=s[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 mpld3_Coordinates(t,e){if(this.trans=t,"undefined"==typeof e){if(this.ax=null,this.fig=null,"display"!==this.trans)throw"ax must be defined if transform != 'display'"}else this.ax=e,this.fig=e.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 mpld3_Path(t,e){mpld3_PlotElement.call(this,t,e),this.data=t.fig.get_data(this.props.data),this.pathcodes=this.props.pathcodes,this.pathcoords=new mpld3_Coordinates(this.props.coordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax),this.datafunc=mpld3_path()}function mpld3_PathCollection(t,e){mpld3_PlotElement.call(this,t,e),(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 s=Math.max(this.props.paths.length,i.length);if(i.length===s)this.offsets=i;else{this.offsets=[];for(var o=0;s>o;o++)this.offsets.push(getMod(i,o))}this.pathcoords=new mpld3_Coordinates(this.props.pathcoordinates,this.ax),this.offsetcoords=new mpld3_Coordinates(this.props.offsetcoordinates,this.ax)}function mpld3_Line(t,e){mpld3_PlotElement.call(this,t,e);var i=this.props;i.facecolor="none",i.edgecolor=i.color,delete i.color,i.edgewidth=i.linewidth,delete i.linewidth;const s=i.drawstyle;switch(delete i.drawstyle,this.defaultProps=mpld3_Path.prototype.defaultProps,mpld3_Path.call(this,t,i),s){case"steps":case"steps-pre":this.datafunc=d3.line().curve(d3.curveStepBefore);break;case"steps-post":this.datafunc=d3.line().curve(d3.curveStepAfter);break;case"steps-mid":this.datafunc=d3.line().curve(d3.curveStep);break;default:this.datafunc=d3.line().curve(d3.curveLinear)}}function mpld3_Markers(t,e){mpld3_PlotElement.call(this,t,e),null!==this.props.markerpath?this.marker=0==this.props.markerpath[0].length?null:mpld3.path().call(this.props.markerpath[0],this.props.markerpath[1]):this.marker=null===this.props.markername?null:d3.symbol(this.props.markername).size(Math.pow(this.props.markersize,2))();var i={paths:[this.props.markerpath],offsets:t.fig.parse_offsets(t.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=mpld3_PathCollection.prototype.requiredProps,this.defaultProps=mpld3_PathCollection.prototype.defaultProps,mpld3_PathCollection.call(this,t,i)}function mpld3_Image(t,e){mpld3_PlotElement.call(this,t,e),this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Text(t,e){mpld3_PlotElement.call(this,t,e),this.text=this.props.text,this.position=this.props.position,this.coords=new mpld3_Coordinates(this.props.coordinates,this.ax)}function mpld3_Axes(t,e){function i(t){return new Date(t[0],t[1],t[2],t[3],t[4],t[5])}function s(t,e){return"date"!==t?e:[i(e[0]),i(e[1])]}function o(t,e,i){var s="date"===t?d3.scaleTime():"log"===t?d3.scaleLog():d3.scaleLinear();return s.domain(e).range(i)}mpld3_PlotElement.call(this,t,e),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 r=this.props.bbox;this.position=[r[0]*this.fig.width,(1-r[1]-r[3])*this.fig.height],this.width=r[2]*this.fig.width,this.height=r[3]*this.fig.height,this.isZoomEnabled=null,this.zoom=null,this.lastTransform=d3.zoomIdentity,this.isBoxzoomEnabled=null,this.isLinkedBrushEnabled=null,this.isCurrentLinkedBrushTarget=!1,this.brushG=null,this.props.xdomain=s(this.props.xscale,this.props.xdomain),this.props.ydomain=s(this.props.yscale,this.props.ydomain),this.x=this.xdom=o(this.props.xscale,this.props.xdomain,[0,this.width]),this.y=this.ydom=o(this.props.yscale,this.props.ydomain,[this.height,0]),"date"===this.props.xscale&&(this.x=mpld3.multiscale(d3.scaleLinear().domain(this.props.xlim).range(this.props.xdomain.map(Number)),this.xdom)),"date"===this.props.yscale&&(this.y=mpld3.multiscale(d3.scaleLinear().domain(this.props.ylim).range(this.props.ydomain.map(Number)),this.ydom));for(var n=this.props.axes,p=0;p<n.length;p++){var a=new mpld3.Axis(this,n[p]);this.axisList.push(a),this.elements.push(a),(this.props.gridOn||a.props.grid.gridOn)&&this.elements.push(a.getGrid())}for(var l=this.props.paths,p=0;p<l.length;p++)this.elements.push(new mpld3.Path(this,l[p]));for(var h=this.props.lines,p=0;p<h.length;p++)this.elements.push(new mpld3.Line(this,h[p]));for(var d=this.props.markers,p=0;p<d.length;p++)this.elements.push(new mpld3.Markers(this,d[p]));for(var c=this.props.texts,p=0;p<c.length;p++)this.elements.push(new mpld3.Text(this,c[p]));for(var u=this.props.collections,p=0;p<u.length;p++)this.elements.push(new mpld3.PathCollection(this,u[p]));for(var m=this.props.images,p=0;p<m.length;p++)this.elements.push(new mpld3.Image(this,m[p]));this.elements.sort(function(t,e){return t.props.zorder-e.props.zorder})}function mpld3_Toolbar(t,e){mpld3_PlotElement.call(this,t,e),this.buttons=[],this.props.buttons.forEach(this.addButton.bind(this))}function mpld3_Button(t,e){mpld3_PlotElement.call(this,t),this.toolbar=t,this.fig=this.toolbar.fig,this.cssclass="mpld3-"+e+"button",this.active=!1}function mpld3_Plugin(t,e){mpld3_PlotElement.call(this,t,e)}function mpld3_ResetPlugin(t,e){mpld3_Plugin.call(this,t,e);var i=mpld3.ButtonFactory({buttonID:"reset",sticky:!1,onActivate:function(){this.toolbar.fig.reset()},icon:function(){return mpld3.icons.reset}});this.fig.buttons.push(i)}function mpld3_ZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.move}});this.fig.buttons.push(s)}}function mpld3_BoxZoomPlugin(t,e){mpld3_Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.zoom}});this.fig.buttons.push(s)}this.extentClass="boxzoombrush"}function mpld3_TooltipPlugin(t,e){mpld3_Plugin.call(this,t,e)}function mpld3_LinkedBrushPlugin(t,e){mpld3.Plugin.call(this,t,e),null===this.props.enabled&&(this.props.enabled=!this.props.button);var i=this.props.enabled;if(this.props.button){var s=mpld3.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 mpld3.icons.brush}});this.fig.buttons.push(s)}this.pathCollectionsByAxes=[],this.objectsByAxes=[],this.allObjects=[],this.extentClass="linkedbrush",this.dataKey="offsets",this.objectClass=null}function MousePositionPlugin(t,e){mpld3.Plugin.call(this,t,e)}function mpld3_Figure(t,e){mpld3_PlotElement.call(this,null,e),this.figid=t,this.width=this.props.width,this.height=this.props.height,this.data=this.props.data,this.buttons=[],this.root=d3.select("#"+t).append("div").style("position","relative"),this.axes=[];for(var i=0;i<this.props.axes.length;i++)this.axes.push(new mpld3_Axes(this,this.props.axes[i]));this.plugins=[],this.pluginsByType={},this.props.plugins.forEach(function(t){this.addPlugin(t)}.bind(this)),this.toolbar=new mpld3.Toolbar(this,{buttons:this.buttons})}function mpld3_PlotElement(t,e){this.parent=isUndefinedOrNull(t)?null:t,this.props=isUndefinedOrNull(e)?{}:this.processProps(e),this.fig=t instanceof mpld3_Figure?t:t&&"fig"in t?t.fig:null,this.ax=t instanceof mpld3_Axes?t:t&&"ax"in t?t.ax:null}if(!d3)var d3=require("d3");var mpld3={_mpld3IsLoaded:!0,figures:[],plugin_map:{}};mpld3.version="0.5.12",mpld3.register_plugin=function(t,e){mpld3.plugin_map[t]=e},mpld3.remove_figure=function(t){var e=document.getElementById(t);null!==e&&(e.innerHTML="");for(var i=0;i<mpld3.figures.length;i++){var s=mpld3.figures[i];s.figid===t&&mpld3.figures.splice(i,1)}return!0},mpld3.draw_figure=function(t,e,i,s){var o=document.getElementById(t);if(s="undefined"!=typeof s?s:!1,s&&mpld3.remove_figure(t),null===o)throw t+" is not a valid id";var r=new mpld3.Figure(t,e);return i&&i(r,o),mpld3.figures.push(r),r.draw(),r},mpld3.cloneObj=mpld3_cloneObj,mpld3.boundsToTransform=function(t,e){var i=t.width,s=t.height,o=e[1][0]-e[0][0],r=e[1][1]-e[0][1],n=(e[0][0]+e[1][0])/2,p=(e[0][1]+e[1][1])/2,a=Math.max(1,Math.min(8,.9/Math.max(o/i,r/s))),l=[i/2-a*n,s/2-a*p];return{translate:l,scale:a}},mpld3.getTransformation=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","g");e.setAttributeNS(null,"transform",t);var i,s,o,r=e.transform.baseVal.consolidate().matrix,n=r.a,p=r.b,a=r.c,l=r.d,h=r.e,d=r.f;(i=Math.sqrt(n*n+p*p))&&(n/=i,p/=i),(o=n*a+p*l)&&(a-=n*o,l-=p*o),(s=Math.sqrt(a*a+l*l))&&(a/=s,l/=s,o/=s),p*a>n*l&&(n=-n,p=-p,o=-o,i=-i);var c={translateX:h,translateY:d,rotate:180*Math.atan2(p,n)/Math.PI,skewX:180*Math.atan(o)/Math.PI,scaleX:i,scaleY:s},u="translate("+c.translateX+","+c.translateY+")rotate("+c.rotate+")skewX("+c.skewX+")scale("+c.scaleX+","+c.scaleY+")";return u},mpld3.merge_objects=function(t){for(var e,i={},s=0;s<arguments.length;s++){e=arguments[s];for(var o in e)i[o]=e[o]}return i},mpld3.generate_id=function(t,e){return console.warn("mpld3.generate_id is deprecated. Use mpld3.generateId instead."),mpld3_generateId(t,e)},mpld3.generateId=mpld3_generateId,mpld3.get_element=function(t,e){var i,s,o;i="undefined"==typeof e?mpld3.figures:"undefined"==typeof e.length?[e]:e;for(var r=0;r<i.length;r++){if(e=i[r],e.props.id===t)return e;for(var n=0;n<e.axes.length;n++){if(s=e.axes[n],s.props.id===t)return s;for(var p=0;p<s.elements.length;p++)if(o=s.elements[p],o.props.id===t)return o}}return null},mpld3.insert_css=function(t,e){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style"),o=t+" {";for(var r in e)o+=r+":"+e[r]+"; ";o+="}",s.type="text/css",s.styleSheet?s.styleSheet.cssText=o:s.appendChild(document.createTextNode(o)),i.appendChild(s)},mpld3.process_props=function(t,e,i,s){function o(t){mpld3_PlotElement.call(this,null,t)}console.warn("mpld3.process_props is deprecated. Plot elements should derive from mpld3.PlotElement"),o.prototype=Object.create(mpld3_PlotElement.prototype),o.prototype.constructor=o,o.prototype.requiredProps=s,o.prototype.defaultProps=i;var r=new o(e);return r.props},mpld3.interpolateDates=mpld3_interpolateDates,mpld3.path=function(){return mpld3_path()},mpld3.multiscale=mpld3_multiscale,mpld3.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"},mpld3.Grid=mpld3_Grid,mpld3_Grid.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Grid.prototype.constructor=mpld3_Grid,mpld3_Grid.prototype.requiredProps=["xy"],mpld3_Grid.prototype.defaultProps={color:"gray",dasharray:"2,2",alpha:"0.5",nticks:10,gridOn:!0,tickvalues:null,zorder:0},mpld3_Grid.prototype.draw=function(){var t={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.position];this.grid=d3[t](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),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .tick",{stroke:this.props.color,"stroke-dasharray":this.props.dasharray,"stroke-opacity":this.props.alpha}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" path",{"stroke-width":0}),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" .domain",{"pointer-events":"none"})},mpld3_Grid.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)},mpld3.Axis=mpld3_Axis,mpld3_Axis.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axis.prototype.constructor=mpld3_Axis,mpld3_Axis.prototype.requiredProps=["position"],mpld3_Axis.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},mpld3_Axis.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 e in this.props.grid)t[e]=this.props.grid[e];return new mpld3_Grid(this.ax,t)},mpld3_Axis.prototype.wrapTicks=function(){function t(t,e,i){i=i||1.2,t.each(function(){for(var t,s=d3.select(this),o=s.node().getBBox(),r=o.height,n=s.text().split(/\s+/).reverse(),p=[],a=0,l=s.attr("y"),h=r,d=s.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",h);t=n.pop();)p.push(t),d.text(p.join(" ")),d.node().getComputedTextLength()>e&&(p.pop(),d.text(p.join(" ")),p=[t],d=s.append("tspan").attr("x",0).attr("y",l).attr("dy",++a*(r*i)+h).text(t))})}var e=80;"x"==this.props.xy&&this.elem.selectAll("text").call(t,e)},mpld3_Axis.prototype.draw=function(){var t="x"===this.props.xy?this.parent.props.xscale:this.parent.props.yscale;if("date"===t&&this.props.tickvalues){var e="x"===this.props.xy?this.parent.x.domain():this.parent.y.domain(),i="x"===this.props.xy?this.parent.xdom.domain():this.parent.ydom.domain(),s=d3.scaleLinear().domain(e).range(i);this.props.tickvalues=this.props.tickvalues.map(function(t){return new Date(s(t))})}var o={left:"axisLeft",right:"axisRight",top:"axisTop",bottom:"axisBottom"}[this.props.position];this.axis=d3[o](this.scale);var r=this;this.filter_ticks(this.axis.scale().domain()),"index"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[t]}):"percent"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=t/r.props.tickformat.xmax*100,s=r.props.tickformat.decimals||0,o=d3.format("."+s+"f")(i);return o+r.props.tickformat.symbol}):"str_method"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){var i=d3.format(r.props.tickformat.format_string)(t);return r.props.tickformat.prefix+i+r.props.tickformat.suffix}):"fixed"==this.props.tickformat_formatter||"func"==this.props.tickformat_formatter?this.axis=this.axis.tickFormat(function(t,e){return r.props.filtered_tickformat[e]}):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(),mpld3.insert_css("div#"+this.ax.fig.figid+" ."+this.cssclass+" line, ."+this.cssclass+" path",{"shape-rendering":"crispEdges",stroke:this.props.axiscolor,fill:"none"}),mpld3.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"})},mpld3_Axis.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)},mpld3_Axis.prototype.setTicks=function(t,e){this.tickNr=t,this.tickFormat=e},mpld3_Axis.prototype.filter_ticks=function(t){if(this.props.tickvalues){const e=this,i=this.props.tickvalues.map(function(t,e){return e}).filter(function(i,s){const o=e.props.tickvalues[i];return o>=t[0]&&o<=t[1]});this.props.filtered_tickvalues=this.props.tickvalues.filter(function(t,e){return i.includes(e)}),this.props.tickformat?this.props.filtered_tickformat=this.props.tickformat.filter(function(t,e){return i.includes(e)}):this.props.filtered_tickformat=this.props.tickformat}else this.props.filtered_tickvalues=this.props.tickvalues,this.props.filtered_tickformat=this.props.tickformat},mpld3.Coordinates=mpld3_Coordinates,mpld3_Coordinates.prototype.xy=function(t,e,i){return e="undefined"==typeof e?0:e,i="undefined"==typeof i?1:i,[this.x(t[e]),this.y(t[i])]},mpld3_Coordinates.prototype.x_data=function(t){return this.ax.x(t)},mpld3_Coordinates.prototype.y_data=function(t){return this.ax.y(t)},mpld3_Coordinates.prototype.x_display=function(t){return t},mpld3_Coordinates.prototype.y_display=function(t){return t},mpld3_Coordinates.prototype.x_axes=function(t){return t*this.ax.width},mpld3_Coordinates.prototype.y_axes=function(t){return this.ax.height*(1-t)},mpld3_Coordinates.prototype.x_figure=function(t){return t*this.fig.width-this.ax.position[0]},mpld3_Coordinates.prototype.y_figure=function(t){return(1-t)*this.fig.height-this.ax.position[1]},mpld3.Path=mpld3_Path,mpld3_Path.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Path.prototype.constructor=mpld3_Path,mpld3_Path.prototype.requiredProps=["data"],mpld3_Path.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},mpld3_Path.prototype.finiteFilter=function(t,e){return isFinite(this.pathcoords.x(t[this.props.xindex]))&&isFinite(this.pathcoords.y(t[this.props.yindex]))},mpld3_Path.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("fill",this.props.facecolor).attr("vector-effect","non-scaling-stroke"),"rgba("!=this.props.edgecolor.slice(0,5)&&(this.path=this.path.style("stroke-opacity",this.props.alpha)),"rgba("!=this.props.facecolor.slice(0,5)&&(this.path=this.path.style("fill-opacity",this.props.alpha)),null!==this.props.offset){var t=this.offsetcoords.xy(this.props.offset);this.path.attr("transform","translate("+t+")")}},mpld3_Path.prototype.elements=function(t){return this.path},mpld3.PathCollection=mpld3_PathCollection,mpld3_PathCollection.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_PathCollection.prototype.constructor=mpld3_PathCollection,mpld3_PathCollection.prototype.requiredProps=["paths","offsets"],mpld3_PathCollection.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},mpld3_PathCollection.prototype.transformFunc=function(t,e){var i=this.props.pathtransforms,s=0==i.length?"":mpld3.getTransformation("matrix("+getMod(i,e)+")").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?s+o:o+s},mpld3_PathCollection.prototype.pathFunc=function(t,e){return mpld3_path().x(function(t){return this.pathcoords.x(t[0])}.bind(this)).y(function(t){return this.pathcoords.y(t[1])}.bind(this)).apply(this,getMod(this.props.paths,e))},mpld3_PathCollection.prototype.styleFunc=function(t,e){var i=getMod(this.props.edgecolors,e),s=getMod(this.props.facecolors,e),o=getMod(this.props.alphas,e),r={stroke:i,"stroke-width":getMod(this.props.edgewidths,e),fill:s};"rgba("!=i.slice(0,5)&&(r["stroke-opacity"]=o),"rgba("!=s.slice(0,5)&&(r["fill-opacity"]=o);var n="";for(var p in r)n+=p+":"+r[p]+";";return n},mpld3_PathCollection.prototype.allFinite=function(t){return t instanceof Array?t.length==t.filter(isFinite).length:!0},mpld3_PathCollection.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")},mpld3_PathCollection.prototype.elements=function(t){return this.group.selectAll("path")},mpld3.Line=mpld3_Line,mpld3_Line.prototype=Object.create(mpld3_Path.prototype),mpld3_Line.prototype.constructor=mpld3_Line,mpld3_Line.prototype.requiredProps=["data"],mpld3_Line.prototype.defaultProps={xindex:0,yindex:1,coordinates:"data",color:"salmon",linewidth:2,dasharray:"none",alpha:1,zorder:2,drawstyle:"none"},mpld3.Markers=mpld3_Markers,mpld3_Markers.prototype=Object.create(mpld3_PathCollection.prototype),mpld3_Markers.prototype.constructor=mpld3_Markers,mpld3_Markers.prototype.requiredProps=["data"],mpld3_Markers.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},mpld3_Markers.prototype.pathFunc=function(t,e){return this.marker},mpld3.Image=mpld3_Image,mpld3_Image.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Image.prototype.constructor=mpld3_Image,mpld3_Image.prototype.requiredProps=["data","extent"],mpld3_Image.prototype.defaultProps={alpha:1,coordinates:"data",drawstyle:"none",zorder:1},mpld3_Image.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()},mpld3_Image.prototype.elements=function(t){return d3.select(this.image)},mpld3_Image.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]))},mpld3.Text=mpld3_Text,mpld3_Text.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Text.prototype.constructor=mpld3_Text,mpld3_Text.prototype.requiredProps=["text","position"],mpld3_Text.prototype.defaultProps={coordinates:"data",h_anchor:"start",v_baseline:"auto",rotation:0,fontsize:11,drawstyle:"none",color:"black",alpha:1,zorder:3},mpld3_Text.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()},mpld3_Text.prototype.elements=function(t){return d3.select(this.obj)},mpld3_Text.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+")")},mpld3.Axes=mpld3_Axes,mpld3_Axes.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Axes.prototype.constructor=mpld3_Axes,mpld3_Axes.prototype.requiredProps=["xlim","ylim"],mpld3_Axes.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:[]},mpld3_Axes.prototype.draw=function(){for(var t=0;t<this.props.sharex.length;t++)this.sharex.push(mpld3.get_element(this.props.sharex[t]));for(var t=0;t<this.props.sharey.length;t++)this.sharey.push(mpld3.get_element(this.props.sharey[t]));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=d3.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(){d3.select(window).on("keydown.brush keyup.brush",null)});for(var t=0;t<this.elements.length;t++)this.elements[t].draw()},mpld3_Axes.prototype.bindZoom=function(){this.zoom||(this.zoom=d3.zoom(),this.zoom.on("zoom",this.zoomed.bind(this)),this.axes.call(this.zoom))},mpld3_Axes.prototype.unbindZoom=function(){this.zoom&&(this.zoom.on("zoom",null),this.axes.on(".zoom",null),this.zoom=null)},mpld3_Axes.prototype.bindBrush=function(){this.brushG||(this.brushG=this.axes.append("g").attr("class","mpld3-brush").call(this.brush))},mpld3_Axes.prototype.unbindBrush=function(){this.brushG&&(this.brushG.remove(),this.brushG.on(".brush",null),this.brushG=null)},mpld3_Axes.prototype.reset=function(){this.zoom?this.doZoom(!1,d3.zoomIdentity,750):(this.bindZoom(),this.doZoom(!1,d3.zoomIdentity,750,function(){this.isSomeTypeOfZoomEnabled||this.unbindZoom()}.bind(this)))},mpld3_Axes.prototype.enableOrDisableBrushing=function(){this.isBoxzoomEnabled||this.isLinkedBrushEnabled?this.bindBrush():this.unbindBrush()},mpld3_Axes.prototype.isSomeTypeOfZoomEnabled=function(){return this.isZoomEnabled||this.isBoxzoomEnabled},mpld3_Axes.prototype.enableOrDisableZooming=function(){this.isSomeTypeOfZoomEnabled()?this.bindZoom():this.unbindZoom()},mpld3_Axes.prototype.enableLinkedBrush=function(){this.isLinkedBrushEnabled=!0,
|
|
2
|
+
this.enableOrDisableBrushing()},mpld3_Axes.prototype.disableLinkedBrush=function(){this.isLinkedBrushEnabled=!1,this.enableOrDisableBrushing()},mpld3_Axes.prototype.enableBoxzoom=function(){this.isBoxzoomEnabled=!0,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.disableBoxzoom=function(){this.isBoxzoomEnabled=!1,this.enableOrDisableBrushing(),this.enableOrDisableZooming()},mpld3_Axes.prototype.enableZoom=function(){this.isZoomEnabled=!0,this.enableOrDisableZooming(),this.axes.style("cursor","move")},mpld3_Axes.prototype.disableZoom=function(){this.isZoomEnabled=!1,this.enableOrDisableZooming(),this.axes.style("cursor",null)},mpld3_Axes.prototype.doZoom=function(t,e,i,s){if(this.props.zoomable&&this.zoom){if(i){var o=this.axes.transition().duration(i).call(this.zoom.transform,e);s&&o.on("end",s)}else this.axes.call(this.zoom.transform,e);t?(this.lastTransform=e,this.sharex.forEach(function(t){t.doZoom(!1,e,i)}),this.sharey.forEach(function(t){t.doZoom(!1,e,i)})):this.lastTransform=e}},mpld3_Axes.prototype.zoomed=function(){var t=d3.event.sourceEvent&&"zoom"!=d3.event.sourceEvent.type;if(t)this.doZoom(!0,d3.event.transform,!1);else{var e=d3.event.transform;this.paths.attr("transform",e),this.elements.forEach(function(t){t.zoomed&&t.zoomed(e)}.bind(this))}},mpld3_Axes.prototype.resetBrush=function(){this.brushG.call(this.brush.move,null)},mpld3_Axes.prototype.doBoxzoom=function(t){if(t&&this.brushG){var e=t.map(this.lastTransform.invert,this.lastTransform),i=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=(e[0][0]+e[1][0])/2,r=(e[0][1]+e[1][1])/2,n=i>s?this.width/i:this.height/s,p=this.width/2-n*o,a=this.height/2-n*r,l=d3.zoomIdentity.translate(p,a).scale(n);this.doZoom(!0,l,750),this.resetBrush()}},mpld3_Axes.prototype.brushStart=function(){this.isLinkedBrushEnabled&&(this.isCurrentLinkedBrushTarget="MouseEvent"==d3.event.sourceEvent.constructor.name,this.isCurrentLinkedBrushTarget&&this.fig.resetBrushForOtherAxes(this.axid))},mpld3_Axes.prototype.brushMove=function(){var t=d3.event.selection;this.isLinkedBrushEnabled&&this.fig.updateLinkedBrush(t)},mpld3_Axes.prototype.brushEnd=function(){var t=d3.event.selection;this.isBoxzoomEnabled&&this.doBoxzoom(t),this.isLinkedBrushEnabled&&(t||this.fig.endLinkedBrush(),this.isCurrentLinkedBrushTarget=!1)},mpld3_Axes.prototype.setTicks=function(t,e,i){this.axisList.forEach(function(s){s.props.xy==t&&s.setTicks(e,i)})},mpld3.Toolbar=mpld3_Toolbar,mpld3_Toolbar.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Toolbar.prototype.constructor=mpld3_Toolbar,mpld3_Toolbar.prototype.defaultProps={buttons:["reset","move"]},mpld3_Toolbar.prototype.addButton=function(t){this.buttons.push(new t(this))},mpld3_Toolbar.prototype.draw=function(){function t(){this.buttonsobj.transition(750).attr("y",0)}function e(){this.buttonsobj.transition(750).delay(250).attr("y",16)}mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image",{cursor:"pointer",opacity:.2,display:"inline-block",margin:"0px"}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.active",{opacity:.4}),mpld3.insert_css("div#"+this.fig.figid+" .mpld3-toolbar image.pressed",{opacity:.6}),this.fig.canvas.on("mouseenter",t.bind(this)).on("mouseleave",e.bind(this)).on("touchenter",t.bind(this)).on("touchstart",t.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,e){return 16*e}).attr("y",16).on("click",function(t){t.click()}).on("mouseenter",function(){d3.select(this).classed("active",!0)}).on("mouseleave",function(){d3.select(this).classed("active",!1)});for(var i=0;i<this.buttons.length;i++)this.buttons[i].onDraw()},mpld3_Toolbar.prototype.deactivate_all=function(){this.buttons.forEach(function(t){t.deactivate()})},mpld3_Toolbar.prototype.deactivate_by_action=function(t){function e(e){return-1!==t.indexOf(e)}t.length>0&&this.buttons.forEach(function(t){t.actions.filter(e).length>0&&t.deactivate()})},mpld3.Button=mpld3_Button,mpld3_Button.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Button.prototype.constructor=mpld3_Button,mpld3_Button.prototype.setState=function(t){t?this.activate():this.deactivate()},mpld3_Button.prototype.click=function(){this.active?this.deactivate():this.activate()},mpld3_Button.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()},mpld3_Button.prototype.deactivate=function(){this.onDeactivate(),this.active=!1,this.toolbar.toolbar.select("."+this.cssclass).classed("pressed",!1)},mpld3_Button.prototype.sticky=!1,mpld3_Button.prototype.actions=[],mpld3_Button.prototype.icon=function(){return""},mpld3_Button.prototype.onActivate=function(){},mpld3_Button.prototype.onDeactivate=function(){},mpld3_Button.prototype.onDraw=function(){},mpld3.ButtonFactory=function(t){function e(t){mpld3_Button.call(this,t,this.buttonID)}if("string"!=typeof t.buttonID)throw"ButtonFactory: buttonID must be present and be a string";e.prototype=Object.create(mpld3_Button.prototype),e.prototype.constructor=e;for(var i in t)e.prototype[i]=t[i];return e},mpld3.Plugin=mpld3_Plugin,mpld3_Plugin.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Plugin.prototype.constructor=mpld3_Plugin,mpld3_Plugin.prototype.requiredProps=[],mpld3_Plugin.prototype.defaultProps={},mpld3_Plugin.prototype.draw=function(){},mpld3.ResetPlugin=mpld3_ResetPlugin,mpld3.register_plugin("reset",mpld3_ResetPlugin),mpld3_ResetPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ResetPlugin.prototype.constructor=mpld3_ResetPlugin,mpld3_ResetPlugin.prototype.requiredProps=[],mpld3_ResetPlugin.prototype.defaultProps={},mpld3.ZoomPlugin=mpld3_ZoomPlugin,mpld3.register_plugin("zoom",mpld3_ZoomPlugin),mpld3_ZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_ZoomPlugin.prototype.constructor=mpld3_ZoomPlugin,mpld3_ZoomPlugin.prototype.requiredProps=[],mpld3_ZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_ZoomPlugin.prototype.activate=function(){this.fig.enableZoom()},mpld3_ZoomPlugin.prototype.deactivate=function(){this.fig.disableZoom()},mpld3_ZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.BoxZoomPlugin=mpld3_BoxZoomPlugin,mpld3.register_plugin("boxzoom",mpld3_BoxZoomPlugin),mpld3_BoxZoomPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_BoxZoomPlugin.prototype.constructor=mpld3_BoxZoomPlugin,mpld3_BoxZoomPlugin.prototype.requiredProps=[],mpld3_BoxZoomPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_BoxZoomPlugin.prototype.activate=function(){this.fig.enableBoxzoom()},mpld3_BoxZoomPlugin.prototype.deactivate=function(){this.fig.disableBoxzoom()},mpld3_BoxZoomPlugin.prototype.draw=function(){this.props.enabled?this.activate():this.deactivate()},mpld3.TooltipPlugin=mpld3_TooltipPlugin,mpld3.register_plugin("tooltip",mpld3_TooltipPlugin),mpld3_TooltipPlugin.prototype=Object.create(mpld3_Plugin.prototype),mpld3_TooltipPlugin.prototype.constructor=mpld3_TooltipPlugin,mpld3_TooltipPlugin.prototype.requiredProps=["id"],mpld3_TooltipPlugin.prototype.defaultProps={labels:null,hoffset:0,voffset:10,location:"mouse"},mpld3_TooltipPlugin.prototype.draw=function(){function t(t,e){this.tooltip.style("visibility","visible").text(null===o?"("+t+")":getMod(o,e))}function e(t,e){if("mouse"===r){var i=d3.mouse(this.fig.canvas.node());this.x=i[0]+this.props.hoffset,this.y=i[1]-this.props.voffset}this.tooltip.attr("x",this.x).attr("y",this.y)}function i(t,e){this.tooltip.style("visibility","hidden")}var s=mpld3.get_element(this.props.id,this.fig),o=this.props.labels,r=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"==r||"top left"==r?(this.x=s.ax.position[0]+5+this.props.hoffset,this.tooltip.style("text-anchor","beginning")):"bottom right"==r||"top right"==r?(this.x=s.ax.position[0]+s.ax.width-5+this.props.hoffset,this.tooltip.style("text-anchor","end")):this.tooltip.style("text-anchor","middle"),"bottom left"==r||"bottom right"==r?this.y=s.ax.position[1]+s.ax.height-5+this.props.voffset:("top left"==r||"top right"==r)&&(this.y=s.ax.position[1]+5+this.props.voffset),s.elements().on("mouseover",t.bind(this)).on("mousemove",e.bind(this)).on("mouseout",i.bind(this))},mpld3.LinkedBrushPlugin=mpld3_LinkedBrushPlugin,mpld3.register_plugin("linkedbrush",mpld3_LinkedBrushPlugin),mpld3_LinkedBrushPlugin.prototype=Object.create(mpld3.Plugin.prototype),mpld3_LinkedBrushPlugin.prototype.constructor=mpld3_LinkedBrushPlugin,mpld3_LinkedBrushPlugin.prototype.requiredProps=["id"],mpld3_LinkedBrushPlugin.prototype.defaultProps={button:!0,enabled:null},mpld3_LinkedBrushPlugin.prototype.activate=function(){this.fig.enableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.deactivate=function(){this.fig.disableLinkedBrush()},mpld3_LinkedBrushPlugin.prototype.isPathInSelection=function(t,e,i,s){var o=s[0][0]<t[e]&&s[1][0]>t[e]&&s[0][1]<t[i]&&s[1][1]>t[i];return o},mpld3_LinkedBrushPlugin.prototype.invertSelection=function(t,e){var i=[e.x.invert(t[0][0]),e.x.invert(t[1][0])],s=[e.y.invert(t[1][1]),e.y.invert(t[0][1])];return[[Math.min.apply(Math,i),Math.min.apply(Math,s)],[Math.max.apply(Math,i),Math.max.apply(Math,s)]]},mpld3_LinkedBrushPlugin.prototype.update=function(t){t&&this.pathCollectionsByAxes.forEach(function(e,i){var s=e[0],o=this.objectsByAxes[i],r=this.invertSelection(t,this.fig.axes[i]),n=s.props.xindex,p=s.props.yindex;o.selectAll("path").classed("mpld3-hidden",function(t,e){return!this.isPathInSelection(t,n,p,r)}.bind(this))}.bind(this))},mpld3_LinkedBrushPlugin.prototype.end=function(){this.allObjects.selectAll("path").classed("mpld3-hidden",!1)},mpld3_LinkedBrushPlugin.prototype.draw=function(){mpld3.insert_css("#"+this.fig.figid+" path.mpld3-hidden",{stroke:"#ccc !important",fill:"#ccc !important"});var t=mpld3.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(e){return e.elements.map(function(e){return e.props[this.dataKey]==t.props[this.dataKey]?(e.group.classed(this.objectClass,!0),e):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)},mpld3.register_plugin("mouseposition",MousePositionPlugin),MousePositionPlugin.prototype=Object.create(mpld3.Plugin.prototype),MousePositionPlugin.prototype.constructor=MousePositionPlugin,MousePositionPlugin.prototype.requiredProps=[],MousePositionPlugin.prototype.defaultProps={fontsize:12,fmt:".3g"},MousePositionPlugin.prototype.draw=function(){for(var t=this.fig,e=d3.format(this.props.fmt),i=t.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),s=0;s<this.fig.axes.length;s++){var o=function(){var o=t.axes[s];return function(){var t=d3.mouse(this),s=o.x.invert(t[0]),r=o.y.invert(t[1]);i.text("("+e(s)+", "+e(r)+")")}}();t.axes[s].baseaxes.on("mousemove",o).on("mouseout",function(){i.text("")})}},mpld3.Figure=mpld3_Figure,mpld3_Figure.prototype=Object.create(mpld3_PlotElement.prototype),mpld3_Figure.prototype.constructor=mpld3_Figure,mpld3_Figure.prototype.requiredProps=["width","height"],mpld3_Figure.prototype.defaultProps={data:{},axes:[],plugins:[{type:"reset"},{type:"zoom"},{type:"boxzoom"}]},mpld3_Figure.prototype.addPlugin=function(t){if(!t.type)return console.warn("unspecified plugin type. Skipping this");var e;if(!(t.type in mpld3.plugin_map))return console.warn("Skipping unrecognized plugin: "+e);e=mpld3.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 i=mpld3_cloneObj(t);delete i.type;var s=new e(this,i);this.plugins.push(s),this.pluginsByType[t.type]=s},mpld3_Figure.prototype.draw=function(){mpld3.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()},mpld3_Figure.prototype.resetBrushForOtherAxes=function(t){this.axes.forEach(function(e){e.axid!=t&&e.resetBrush()})},mpld3_Figure.prototype.updateLinkedBrush=function(t){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.update(t)},mpld3_Figure.prototype.endLinkedBrush=function(){this.pluginsByType.linkedbrush&&this.pluginsByType.linkedbrush.end()},mpld3_Figure.prototype.reset=function(t){this.axes.forEach(function(t){t.reset()})},mpld3_Figure.prototype.enableLinkedBrush=function(){this.axes.forEach(function(t){t.enableLinkedBrush()})},mpld3_Figure.prototype.disableLinkedBrush=function(){this.axes.forEach(function(t){t.disableLinkedBrush()})},mpld3_Figure.prototype.enableBoxzoom=function(){this.axes.forEach(function(t){t.enableBoxzoom()})},mpld3_Figure.prototype.disableBoxzoom=function(){this.axes.forEach(function(t){t.disableBoxzoom()})},mpld3_Figure.prototype.enableZoom=function(){this.axes.forEach(function(t){t.enableZoom()})},mpld3_Figure.prototype.disableZoom=function(){this.axes.forEach(function(t){t.disableZoom()})},mpld3_Figure.prototype.toggleZoom=function(){this.isZoomEnabled?this.disableZoom():this.enableZoom()},mpld3_Figure.prototype.setTicks=function(t,e,i){this.axes.forEach(function(s){s.setTicks(t,e,i)})},mpld3_Figure.prototype.setXTicks=function(t,e){this.setTicks("x",t,e)},mpld3_Figure.prototype.setYTicks=function(t,e){this.setTicks("y",t,e)},mpld3_Figure.prototype.removeNaN=function(t){output=output.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.parse_offsets=function(t){return t.map(function(t){return t.map(function(t){return"number"==typeof t&&isNaN(t)?0:t})})},mpld3_Figure.prototype.get_data=function(t){var e=t;return null===t||"undefined"==typeof t?e=null:"string"==typeof t&&(e=this.data[t]),e},mpld3.PlotElement=mpld3_PlotElement,mpld3_PlotElement.prototype.requiredProps=[],mpld3_PlotElement.prototype.defaultProps={},mpld3_PlotElement.prototype.processProps=function(t){t=mpld3_cloneObj(t);var e={},i=this.name();this.requiredProps.forEach(function(s){if(!(s in t))throw"property '"+s+"' must be specified for "+i;e[s]=t[s],delete t[s]});for(var s in this.defaultProps)s in t?(e[s]=t[s],delete t[s]):e[s]=this.defaultProps[s];"id"in t?(e.id=t.id,delete t.id):"id"in e||(e.id=mpld3.generateId());for(var s in t)console.warn("Unrecognized property '"+s+"' for object "+this.name()+" (value = "+t[s]+").");return e},mpld3_PlotElement.prototype.name=function(){var t=/function (.{1,})\(/,e=t.exec(this.constructor.toString());return e&&e.length>1?e[1]:""},"object"==typeof module&&module.exports?module.exports=mpld3:this.mpld3=mpld3,console.log("Loaded mpld3 version "+mpld3.version);
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mpld3",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "http://github.com/mpld3/mpld3"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "npx browserify mpld3.v0.5.
|
|
10
|
+
"build": "npx browserify mpld3.v0.5.12.min.js --standalone mpld3 -o dist/mpld3.v0.5.12.min.js"
|
|
11
11
|
},
|
|
12
|
-
"main": "dist/mpld3.v0.5.
|
|
12
|
+
"main": "dist/mpld3.v0.5.12.min.js",
|
|
13
13
|
"bundleDependencies": false,
|
|
14
14
|
"dependencies": {},
|
|
15
15
|
"devDependencies": {
|