diff --git a/Examples/AutoViz_Bokeh_Interactive_Demo.ipynb b/Examples/AutoViz_Bokeh_Interactive_Demo.ipynb index 61d967e..8fe0456 100644 --- a/Examples/AutoViz_Bokeh_Interactive_Demo.ipynb +++ b/Examples/AutoViz_Bokeh_Interactive_Demo.ipynb @@ -5,23 +5,185 @@ "execution_count": 1, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Imported v0.1.903. Please call AutoViz in this sequence:\n", + " AV = AutoViz_Class()\n", + " %matplotlib inline\n", + " dfte = AV.AutoViz(filename, sep=',', depVar='', dfte=None, header=0, verbose=1, lowess=False,\n", + " chart_format='svg',max_rows_analyzed=150000,max_cols_analyzed=30, save_plot_dir=None)\n" + ] + } + ], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "from autoviz import AutoViz_Class" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "AV = AutoViz_Class()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#datapath = 'C:/Users/Ram/Documents/Ram/Data_Sets/'\n", + "datapath = ''\n", + "filename = 'https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/MASS/Boston.csv'\n", + "sep = ','\n", + "target = 'chas'" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(506, 15)\n" + ] + }, { "data": { - "application/javascript": [ + "text/html": [ + "
\n", + " | rownames | \n", + "crim | \n", + "zn | \n", + "indus | \n", + "chas | \n", + "nox | \n", + "rm | \n", + "age | \n", + "dis | \n", + "rad | \n", + "tax | \n", + "ptratio | \n", + "black | \n", + "lstat | \n", + "medv | \n", + "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "1 | \n", + "0.00632 | \n", + "18.0 | \n", + "2.31 | \n", + "0 | \n", + "0.538 | \n", + "6.575 | \n", + "65.2 | \n", + "4.09 | \n", + "1 | \n", + "296 | \n", + "15.3 | \n", + "396.9 | \n", + "4.98 | \n", + "24.0 | \n", + "
({min_distance:[e,5]})))}filter(e,n,s){const{min_distance:t}=this;let i=null;for(const n of e)null!=i&&s(i,n) 0&&me(a,!u&&ye(e,\"script\")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return $(this,(function(e){return void 0===e?w.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Me(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)}))},prepend:function(){return Me(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Me(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Me(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent=\"\");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return w.clone(this,e,t)}))},html:function(e){return $(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if(\"string\"==typeof e&&!De.test(e)&&!ve[(he.exec(e)||[\"\",\"\"])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n ({min_distance:[e,5]})))}filter(e,n,s){const{min_distance:t}=this;let i=null;for(const n of e)null!=i&&s(i,n)new m.DatetimeTicker,formatter:()=>new r.DatetimeTickFormatter})}}i.DatetimeAxis=c,c.__name__=\"DatetimeAxis\",c.init_DatetimeAxis()},\n",
- " function _(i,e,s,n,t){n();const r=i(173),a=i(176),o=i(177);class c extends r.ContinuousAxisView{}s.LinearAxisView=c,c.__name__=\"LinearAxisView\";class _ extends r.ContinuousAxis{constructor(i){super(i)}static init_LinearAxis(){this.prototype.default_view=c,this.override({ticker:()=>new o.BasicTicker,formatter:()=>new a.BasicTickFormatter})}}s.LinearAxis=_,_.__name__=\"LinearAxis\",_.init_LinearAxis()},\n",
- " function _(i,t,e,n,o){n();const s=i(166),r=i(34);function c(i){let t=\"\";for(const e of i)t+=\"-\"==e?\"−\":e;return t}e.unicode_replace=c;class _ extends s.TickFormatter{constructor(i){super(i),this.last_precision=3}static init_BasicTickFormatter(){this.define((({Boolean:i,Int:t,Auto:e,Or:n})=>({precision:[n(t,e),\"auto\"],use_scientific:[i,!0],power_limit_high:[t,5],power_limit_low:[t,-3]})))}get scientific_limit_low(){return 10**this.power_limit_low}get scientific_limit_high(){return 10**this.power_limit_high}_need_sci(i){if(!this.use_scientific)return!1;const{scientific_limit_high:t}=this,{scientific_limit_low:e}=this,n=i.length<2?0:Math.abs(i[1]-i[0])/1e4;for(const o of i){const i=Math.abs(o);if(!(i<=n)&&(i>=t||i<=e))return!0}return!1}_format_with_precision(i,t,e){return t?i.map((i=>c(i.toExponential(e)))):i.map((i=>c(r.to_fixed(i,e))))}_auto_precision(i,t){const e=new Array(i.length),n=this.last_precision<=15;i:for(let o=this.last_precision;n?o<=15:o>=1;n?o++:o--){if(t){e[0]=i[0].toExponential(o);for(let t=1;t{const{r0:e,c0:f,r1:d,c1:u}=i,w=(d-e)*r,m=(u-f)*h;let y=0;for(let i=e;i<=d;i++)y+=t(i,f).height;y+=w;let x=0;for(let i=f;i<=u;i++)x+=t(e,i).width;x+=m;const b=s.measure({width:x,height:y});_.add(i,{layout:s,size_hint:b});const z=new n.Sizeable(b).grow_by(s.sizing.margin);z.height-=w,z.width-=m;const v=[];for(let t=e;t<=d;t++){const i=o[t];\"fixed\"==i.policy?z.height-=i.height:v.push(t)}if(z.height>0){const t=g(z.height/v.length);for(const i of v)c[i]=a(c[i],t)}const j=[];for(let t=f;t<=u;t++){const i=l[t];\"fixed\"==i.policy?z.width-=i.width:j.push(t)}if(z.width>0){const t=g(z.width/j.length);for(const i of j)p[i]=a(p[i],t)}}));return{size:this._measure_totals(c,p),row_heights:c,col_widths:p,size_hints:_}}_measure_grid(t){const{nrows:i,ncols:s,rows:e,cols:o,rspacing:n,cspacing:l}=this._state,r=this._measure_cells(((t,i)=>{const s=e[t],n=o[i];return{width:\"fixed\"==n.policy?n.width:1/0,height:\"fixed\"==s.policy?s.height:1/0}}));let h;h=\"fixed\"==this.sizing.height_policy&&null!=this.sizing.height?this.sizing.height:t.height!=1/0&&this.is_height_expanding()?t.height:r.size.height;let c,p=0;for(let t=0;t0)for(let t=0;ti?i:e,t--}}}c=\"fixed\"==this.sizing.width_policy&&null!=this.sizing.width?this.sizing.width:t.width!=1/0&&this.is_width_expanding()?t.width:r.size.width;let f=0;for(let t=0;t0)for(let t=0;ts?s:o,t--}}}const{row_heights:_,col_widths:d,size_hints:u}=this._measure_cells(((t,i)=>({width:r.col_widths[i],height:r.row_heights[t]})));return{size:this._measure_totals(_,d),row_heights:_,col_widths:d,size_hints:u}}_measure(t){const{size:i}=this._measure_grid(t);return i}_set_geometry(t,i){super._set_geometry(t,i);const{nrows:s,ncols:e,rspacing:o,cspacing:n}=this._state,{row_heights:l,col_widths:r,size_hints:c}=this._measure_grid(t),f=this._state.rows.map(((t,i)=>Object.assign(Object.assign({},t),{top:0,height:l[i],get bottom(){return this.top+this.height}}))),_=this._state.cols.map(((t,i)=>Object.assign(Object.assign({},t),{left:0,width:r[i],get right(){return this.left+this.width}}))),d=c.map(((t,i)=>Object.assign(Object.assign({},i),{outer:new h.BBox,inner:new h.BBox})));for(let i=0,e=this.absolute?t.top:0;i{const{layout:r,size_hint:c}=l,{sizing:a}=r,{width:p,height:d}=c,u=function(t,i){let s=(i-t)*n;for(let e=t;e<=i;e++)s+=_[e].width;return s}(i,e),w=function(t,i){let s=(i-t)*o;for(let e=t;e<=i;e++)s+=f[e].height;return s}(t,s),m=i==e&&\"auto\"!=_[i].align?_[i].align:a.halign,y=t==s&&\"auto\"!=f[t].align?f[t].align:a.valign;let x=_[i].left;\"start\"==m?x+=a.margin.left:\"center\"==m?x+=g((u-p)/2):\"end\"==m&&(x+=u-a.margin.right-p);let b=f[t].top;\"start\"==y?b+=a.margin.top:\"center\"==y?b+=g((w-d)/2):\"end\"==y&&(b+=w-a.margin.bottom-d),l.outer=new h.BBox({left:x,top:b,width:p,height:d})}));const u=f.map((()=>({start:new p((()=>0)),end:new p((()=>0))}))),w=_.map((()=>({start:new p((()=>0)),end:new p((()=>0))})));d.foreach((({r0:t,c0:i,r1:s,c1:e},{size_hint:o,outer:n})=>{const{inner:l}=o;null!=l&&(u[t].start.apply(n.top,(t=>a(t,l.top))),u[s].end.apply(f[s].bottom-n.bottom,(t=>a(t,l.bottom))),w[i].start.apply(n.left,(t=>a(t,l.left))),w[e].end.apply(_[e].right-n.right,(t=>a(t,l.right))))})),d.foreach((({r0:t,c0:i,r1:s,c1:e},o)=>{const{size_hint:n,outer:l}=o,r=t=>{const i=this.absolute?l:l.relative(),s=i.left+t.left,e=i.top+t.top,o=i.right-t.right,n=i.bottom-t.bottom;return new h.BBox({left:s,top:e,right:o,bottom:n})};if(null!=n.inner){let h=r(n.inner);if(!1!==n.align){const o=u[t].start.get(l.top),n=u[s].end.get(f[s].bottom-l.bottom),c=w[i].start.get(l.left),a=w[e].end.get(_[e].right-l.right);try{h=r({top:o,bottom:n,left:c,right:a})}catch(t){}}o.inner=h}else o.inner=l})),d.foreach(((t,{layout:i,outer:s,inner:e})=>{i.set_geometry(s,e)}))}}s.Grid=_,_.__name__=\"Grid\";class d extends _{constructor(t){super(),this.items=t.map(((t,i)=>({layout:t,row:0,col:i}))),this.rows=\"fit\"}}s.Row=d,d.__name__=\"Row\";class u extends _{constructor(t){super(),this.items=t.map(((t,i)=>({layout:t,row:i,col:0}))),this.cols=\"fit\"}}s.Column=u,u.__name__=\"Column\"},\n",
- " function _(e,t,s,n,i){n();const a=e(142),c=e(141),o=e(43);class r extends a.ContentLayoutable{constructor(e){super(),this.content_size=o.unsized(e,(()=>new c.Sizeable(o.size(e))))}_content_size(){return this.content_size}}s.ContentBox=r,r.__name__=\"ContentBox\";class _ extends a.Layoutable{constructor(e){super(),this.el=e}_measure(e){const t=new c.Sizeable(e).bounded_to(this.sizing.size);return o.sized(this.el,t,(()=>{const e=new c.Sizeable(o.content_size(this.el)),{border:t,padding:s}=o.extents(this.el);return e.grow_by(t).grow_by(s).map(Math.ceil)}))}}s.VariadicBox=_,_.__name__=\"VariadicBox\";class h extends _{constructor(e){super(e),this._cache=new Map}_measure(e){const{width:t,height:s}=e,n=`${t},${s}`;let i=this._cache.get(n);return null==i&&(i=super._measure(e),this._cache.set(n,i)),i}invalidate_cache(){this._cache.clear()}}s.CachedVariadicBox=h,h.__name__=\"CachedVariadicBox\"},\n",
- " function _(t,e,i,h,o){h();const s=t(141),r=t(142),n=t(99);class g extends r.Layoutable{constructor(){super(...arguments),this.min_border={left:0,top:0,right:0,bottom:0},this.padding={left:0,top:0,right:0,bottom:0}}*[Symbol.iterator](){yield this.top_panel,yield this.bottom_panel,yield this.left_panel,yield this.right_panel,yield this.center_panel}_measure(t){t=new s.Sizeable({width:\"fixed\"==this.sizing.width_policy||t.width==1/0?this.sizing.width:t.width,height:\"fixed\"==this.sizing.height_policy||t.height==1/0?this.sizing.height:t.height});const e=this.left_panel.measure({width:0,height:t.height}),i=Math.max(e.width,this.min_border.left)+this.padding.left,h=this.right_panel.measure({width:0,height:t.height}),o=Math.max(h.width,this.min_border.right)+this.padding.right,r=this.top_panel.measure({width:t.width,height:0}),n=Math.max(r.height,this.min_border.top)+this.padding.top,g=this.bottom_panel.measure({width:t.width,height:0}),a=Math.max(g.height,this.min_border.bottom)+this.padding.bottom,d=new s.Sizeable(t).shrink_by({left:i,right:o,top:n,bottom:a}),l=this.center_panel.measure(d);return{width:i+l.width+o,height:n+l.height+a,inner:{left:i,right:o,top:n,bottom:a},align:(()=>{const{width_policy:t,height_policy:e}=this.center_panel.sizing;return\"fixed\"!=t&&\"fixed\"!=e})()}}_set_geometry(t,e){super._set_geometry(t,e),this.center_panel.set_geometry(e);const i=this.left_panel.measure({width:0,height:t.height}),h=this.right_panel.measure({width:0,height:t.height}),o=this.top_panel.measure({width:t.width,height:0}),s=this.bottom_panel.measure({width:t.width,height:0}),{left:r,top:g,right:a,bottom:d}=e;this.top_panel.set_geometry(new n.BBox({left:r,right:a,bottom:g,height:o.height})),this.bottom_panel.set_geometry(new n.BBox({left:r,right:a,top:d,height:s.height})),this.left_panel.set_geometry(new n.BBox({top:g,bottom:d,right:r,width:i.width})),this.right_panel.set_geometry(new n.BBox({top:g,bottom:d,left:a,width:h.width}))}}i.BorderLayout=g,g.__name__=\"BorderLayout\"},\n",
- " function _(t,e,i,s,n){s();const o=t(1),l=t(139),a=t(10),_=t(143),d=t(20),h=o.__importStar(t(48));class r extends l.TextAnnotationView{_get_size(){const{ctx:t}=this.layer;this.visuals.text.set_value(t);const{width:e}=t.measureText(this.model.text),{height:i}=_.font_metrics(t.font);return{width:e,height:i}}_render(){const{angle:t,angle_units:e}=this.model,i=a.resolve_angle(t,e),s=null!=this.layout?this.layout:this.plot_view.frame,n=this.coordinates.x_scale,o=this.coordinates.y_scale;let l=\"data\"==this.model.x_units?n.compute(this.model.x):s.bbox.xview.compute(this.model.x),_=\"data\"==this.model.y_units?o.compute(this.model.y):s.bbox.yview.compute(this.model.y);l+=this.model.x_offset,_-=this.model.y_offset;(\"canvas\"==this.model.render_mode?this._canvas_text.bind(this):this._css_text.bind(this))(this.layer.ctx,this.model.text,l,_,i)}}i.LabelView=r,r.__name__=\"LabelView\";class c extends l.TextAnnotation{constructor(t){super(t)}static init_Label(){this.prototype.default_view=r,this.mixins([h.Text,[\"border_\",h.Line],[\"background_\",h.Fill]]),this.define((({Number:t,String:e,Angle:i})=>({x:[t],x_units:[d.SpatialUnits,\"data\"],y:[t],y_units:[d.SpatialUnits,\"data\"],text:[e,\"\"],angle:[i,0],angle_units:[d.AngleUnits,\"rad\"],x_offset:[t,0],y_offset:[t,0]}))),this.override({background_fill_color:null,border_line_color:null})}}i.Label=c,c.__name__=\"Label\",c.init_Label()},\n",
- " function _(t,e,s,i,o){i();const l=t(1),n=t(139),a=t(56),r=t(130),_=l.__importStar(t(48)),c=t(20),h=t(43),d=l.__importStar(t(18)),u=t(143);class x extends n.TextAnnotationView{set_data(t){a.DataAnnotationView.prototype.set_data.call(this,t)}initialize(){if(super.initialize(),this.set_data(this.model.source),\"css\"==this.model.render_mode)for(let t=0,e=this.text.length;t({xs:[i(t),[]],xs_units:[c.SpatialUnits,\"data\"],ys:[i(t),[]],ys_units:[c.SpatialUnits,\"data\"]}))),this.internal((({Boolean:t})=>({screen:[t,!1]}))),this.override({fill_color:\"#fff9ba\",fill_alpha:.4,line_color:\"#cccccc\",line_alpha:.3})}update({xs:t,ys:i}){this.setv({xs:t,ys:i,screen:!0},{check_eq:!1})}}s.PolyAnnotation=r,r.__name__=\"PolyAnnotation\",r.init_PolyAnnotation()},\n",
- " function _(e,t,i,n,o){n();const s=e(1),l=e(40),r=s.__importStar(e(48));class c extends l.AnnotationView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.request_render()))}_render(){const{gradient:e,y_intercept:t}=this.model;if(null==e||null==t)return;const{frame:i}=this.plot_view,n=this.coordinates.x_scale,o=this.coordinates.y_scale;let s,l,r,c;if(0==e)s=o.compute(t),l=s,r=i.bbox.left,c=r+i.bbox.width;else{s=i.bbox.top,l=s+i.bbox.height;const a=(o.invert(s)-t)/e,_=(o.invert(l)-t)/e;r=n.compute(a),c=n.compute(_)}const{ctx:a}=this.layer;a.save(),a.beginPath(),this.visuals.line.set_value(a),a.moveTo(r,s),a.lineTo(c,l),a.stroke(),a.restore()}}i.SlopeView=c,c.__name__=\"SlopeView\";class a extends l.Annotation{constructor(e){super(e)}static init_Slope(){this.prototype.default_view=c,this.mixins(r.Line),this.define((({Number:e,Nullable:t})=>({gradient:[t(e),null],y_intercept:[t(e),null]}))),this.override({line_color:\"black\"})}}i.Slope=a,a.__name__=\"Slope\",a.init_Slope()},\n",
- " function _(e,i,t,n,o){n();const s=e(1),a=e(40),l=s.__importStar(e(48)),h=e(20);class c extends a.AnnotationView{connect_signals(){super.connect_signals(),this.connect(this.model.change,(()=>this.plot_view.request_paint(this)))}_render(){const{location:e}=this.model;if(null==e)return;const{frame:i}=this.plot_view,t=this.coordinates.x_scale,n=this.coordinates.y_scale,o=(i,t)=>\"data\"==this.model.location_units?i.compute(e):this.model.for_hover?e:t.compute(e);let s,a,l,h;\"width\"==this.model.dimension?(l=o(n,i.bbox.yview),a=i.bbox.left,h=i.bbox.width,s=this.model.line_width):(l=i.bbox.top,a=o(t,i.bbox.xview),h=this.model.line_width,s=i.bbox.height);const{ctx:c}=this.layer;c.save(),c.beginPath(),this.visuals.line.set_value(c),c.moveTo(a,l),\"width\"==this.model.dimension?c.lineTo(a+h,l):c.lineTo(a,l+s),c.stroke(),c.restore()}}t.SpanView=c,c.__name__=\"SpanView\";class d extends a.Annotation{constructor(e){super(e)}static init_Span(){this.prototype.default_view=c,this.mixins(l.Line),this.define((({Number:e,Nullable:i})=>({render_mode:[h.RenderMode,\"canvas\"],location:[i(e),null],location_units:[h.SpatialUnits,\"data\"],dimension:[h.Dimension,\"width\"]}))),this.internal((({Boolean:e})=>({for_hover:[e,!1]}))),this.override({line_color:\"black\"})}}t.Span=d,d.__name__=\"Span\",d.init_Span()},\n",
- " function _(i,e,t,o,l){o();const s=i(40),a=i(235),n=i(122),r=i(43),_=i(140),h=i(99);class b extends s.AnnotationView{constructor(){super(...arguments),this._invalidate_toolbar=!0,this._previous_bbox=new h.BBox}update_layout(){this.layout=new _.SideLayout(this.panel,(()=>this.get_size()),!0)}initialize(){super.initialize(),this.el=r.div(),this.plot_view.canvas_view.add_event(this.el)}async lazy_initialize(){await super.lazy_initialize(),this._toolbar_view=await n.build_view(this.model.toolbar,{parent:this}),this.plot_view.visibility_callbacks.push((i=>this._toolbar_view.set_visibility(i)))}remove(){this._toolbar_view.remove(),r.remove(this.el),super.remove()}render(){this.model.visible||r.undisplay(this.el),super.render()}_render(){const{bbox:i}=this.layout;this._previous_bbox.equals(i)||(r.position(this.el,i),this._previous_bbox=i),this._invalidate_toolbar&&(this.el.style.position=\"absolute\",this.el.style.overflow=\"hidden\",this._toolbar_view.render(),r.empty(this.el),this.el.appendChild(this._toolbar_view.el),this._invalidate_toolbar=!1),r.display(this.el)}_get_size(){const{tools:i,logo:e}=this.model.toolbar;return{width:30*i.length+(null!=e?25:0),height:30}}}t.ToolbarPanelView=b,b.__name__=\"ToolbarPanelView\";class d extends s.Annotation{constructor(i){super(i)}static init_ToolbarPanel(){this.prototype.default_view=b,this.define((({Ref:i})=>({toolbar:[i(a.Toolbar)]})))}}t.ToolbarPanel=d,d.__name__=\"ToolbarPanel\",d.init_ToolbarPanel()},\n",
- " function _(t,s,e,i,o){i();const c=t(8),n=t(9),a=t(13),l=t(236),r=t(237),_=t(247),p=t(248);e.Drag=l.Tool,e.Inspection=l.Tool,e.Scroll=l.Tool,e.Tap=l.Tool;const u=t=>{switch(t){case\"tap\":return\"active_tap\";case\"pan\":return\"active_drag\";case\"pinch\":case\"scroll\":return\"active_scroll\";case\"multi\":return\"active_multi\"}return null},h=t=>\"tap\"==t||\"pan\"==t;class v extends p.ToolbarBase{constructor(t){super(t)}static init_Toolbar(){this.prototype.default_view=p.ToolbarBaseView,this.define((({Or:t,Ref:s,Auto:i,Null:o,Nullable:c})=>({active_drag:[t(s(e.Drag),i,o),\"auto\"],active_inspect:[t(s(e.Inspection),i,o),\"auto\"],active_scroll:[t(s(e.Scroll),i,o),\"auto\"],active_tap:[t(s(e.Tap),i,o),\"auto\"],active_multi:[c(s(r.GestureTool)),null]})))}connect_signals(){super.connect_signals();const{tools:t,active_drag:s,active_inspect:e,active_scroll:i,active_tap:o,active_multi:c}=this.properties;this.on_change([t,s,e,i,o,c],(()=>this._init_tools()))}_init_tools(){if(super._init_tools(),\"auto\"==this.active_inspect);else if(this.active_inspect instanceof _.InspectTool){let t=!1;for(const s of this.inspectors)s!=this.active_inspect?s.active=!1:t=!0;t||(this.active_inspect=null)}else if(c.isArray(this.active_inspect)){const t=n.intersection(this.active_inspect,this.inspectors);t.length!=this.active_inspect.length&&(this.active_inspect=t);for(const t of this.inspectors)n.includes(this.active_inspect,t)||(t.active=!1)}else if(null==this.active_inspect)for(const t of this.inspectors)t.active=!1;const t=t=>{t.active?this._active_change(t):t.active=!0};for(const t of a.values(this.gestures)){t.tools=n.sort_by(t.tools,(t=>t.default_order));for(const s of t.tools)this.connect(s.properties.active.change,(()=>this._active_change(s)))}for(const[s,e]of a.entries(this.gestures)){const i=u(s);if(i){const o=this[i];\"auto\"==o?0!=e.tools.length&&h(s)&&t(e.tools[0]):null!=o&&(n.includes(this.tools,o)?t(o):this[i]=null)}}}}e.Toolbar=v,v.__name__=\"Toolbar\",v.init_Toolbar()},\n",
- " function _(t,e,n,i,o){i();const s=t(42),a=t(9),r=t(53);class l extends s.View{get plot_view(){return this.parent}get plot_model(){return this.parent.model}connect_signals(){super.connect_signals(),this.connect(this.model.properties.active.change,(()=>{this.model.active?this.activate():this.deactivate()}))}activate(){}deactivate(){}}n.ToolView=l,l.__name__=\"ToolView\";class _ extends r.Model{constructor(t){super(t)}static init_Tool(){this.prototype._known_aliases=new Map,this.define((({String:t,Nullable:e})=>({description:[e(t),null]}))),this.internal((({Boolean:t})=>({active:[t,!1]})))}get synthetic_renderers(){return[]}_get_dim_limits([t,e],[n,i],o,s){const r=o.bbox.h_range;let l;\"width\"==s||\"both\"==s?(l=[a.min([t,n]),a.max([t,n])],l=[a.max([l[0],r.start]),a.min([l[1],r.end])]):l=[r.start,r.end];const _=o.bbox.v_range;let c;return\"height\"==s||\"both\"==s?(c=[a.min([e,i]),a.max([e,i])],c=[a.max([c[0],_.start]),a.min([c[1],_.end])]):c=[_.start,_.end],[l,c]}static register_alias(t,e){this.prototype._known_aliases.set(t,e)}static from_string(t){const e=this.prototype._known_aliases.get(t);if(null!=e)return e();{const e=[...this.prototype._known_aliases.keys()];throw new Error(`unexpected tool name '${t}', possible tools are ${e.join(\", \")}`)}}}n.Tool=_,_.__name__=\"Tool\",_.init_Tool()},\n",
- " function _(e,o,t,s,n){s();const u=e(238),_=e(246);class l extends u.ButtonToolView{}t.GestureToolView=l,l.__name__=\"GestureToolView\";class i extends u.ButtonTool{constructor(e){super(e),this.button_view=_.OnOffButtonView}}t.GestureTool=i,i.__name__=\"GestureTool\"},\n",
- " function _(t,e,o,i,s){i();const n=t(1),l=n.__importDefault(t(239)),r=t(240),a=t(236),u=t(43),h=t(34),_=t(8),c=t(9),d=n.__importStar(t(241)),m=d,p=n.__importDefault(t(242)),g=n.__importDefault(t(243)),v=t(244);class f extends r.DOMView{initialize(){super.initialize();const t=this.model.menu;if(null!=t){const e=this.parent.model.toolbar_location,o=\"left\"==e||\"above\"==e,i=this.parent.model.horizontal?\"vertical\":\"horizontal\";this._menu=new v.ContextMenu(o?c.reversed(t):t,{orientation:i,prevent_hide:t=>t.target==this.el})}this._hammer=new l.default(this.el,{touchAction:\"auto\",inputClass:l.default.TouchMouseInput}),this.connect(this.model.change,(()=>this.render())),this._hammer.on(\"tap\",(t=>{var e;(null===(e=this._menu)||void 0===e?void 0:e.is_open)?this._menu.hide():t.target==this.el&&this._clicked()})),this._hammer.on(\"press\",(()=>this._pressed()))}remove(){var t;this._hammer.destroy(),null===(t=this._menu)||void 0===t||t.remove(),super.remove()}styles(){return[...super.styles(),d.default,p.default,g.default]}css_classes(){return super.css_classes().concat(m.toolbar_button)}render(){u.empty(this.el);const t=this.model.computed_icon;_.isString(t)&&(h.startsWith(t,\"data:image\")?this.el.style.backgroundImage=\"url('\"+t+\"')\":this.el.classList.add(t)),this.el.title=this.model.tooltip,null!=this._menu&&this.root.el.appendChild(this._menu.el)}_pressed(){var t;const{left:e,top:o,right:i,bottom:s}=this.el.getBoundingClientRect(),n=(()=>{switch(this.parent.model.toolbar_location){case\"right\":return{right:e,top:o};case\"left\":return{left:i,top:o};case\"above\":return{left:e,top:s};case\"below\":return{left:e,bottom:o}}})();null===(t=this._menu)||void 0===t||t.toggle(n)}}o.ButtonToolButtonView=f,f.__name__=\"ButtonToolButtonView\";class b extends a.ToolView{}o.ButtonToolView=b,b.__name__=\"ButtonToolView\";class B extends a.Tool{constructor(t){super(t)}static init_ButtonTool(){this.internal((({Boolean:t})=>({disabled:[t,!1]})))}_get_dim_tooltip(t){const{description:e,tool_name:o}=this;return null!=e?e:\"both\"==t?o:`${o} (${\"width\"==t?\"x\":\"y\"}-axis)`}get tooltip(){var t;return null!==(t=this.description)&&void 0!==t?t:this.tool_name}get computed_icon(){return this.icon}get menu(){return null}}o.ButtonTool=B,B.__name__=\"ButtonTool\",B.init_ButtonTool()},\n",
- " function _(t,e,i,n,r){\n",
- " /*! Hammer.JS - v2.0.7 - 2016-04-22\n",
- " * http://hammerjs.github.io/\n",
- " *\n",
- " * Copyright (c) 2016 Jorik Tangelder;\n",
- " * Licensed under the MIT license */\n",
- " !function(t,i,n,r){\"use strict\";var s,o=[\"\",\"webkit\",\"Moz\",\"MS\",\"ms\",\"o\"],a=i.createElement(\"div\"),h=Math.round,u=Math.abs,c=Date.now;function l(t,e,i){return setTimeout(T(t,i),e)}function p(t,e,i){return!!Array.isArray(t)&&(f(t,i[e],i),!0)}function f(t,e,i){var n;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==r)for(n=0;nn.right)&&(l=!1)}if(null!=n.bottom&&null!=n.top){const t=s.invert(e);(t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},s=[];if(\"string\"==typeof i[0]){for(var r=0,o=i.length;r\",\"
\"],col:[2,\"
\"],tr:[2,\"\",\"
\"],td:[3,\"
\"],_default:[0,\"\",\"\"]};function ye(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||\"*\"):void 0!==e.querySelectorAll?e.querySelectorAll(t||\"*\"):[],void 0===t||t&&A(e,t)?w.merge([e],n):n}function me(e,t){for(var n=0,r=e.length;n\",\" >>t&1&&(yield e);else e+=32}}*zeros(){const{_array:t,_nwords:s,size:r}=this;for(let e=0,i=0;i>>t&1||(yield e);else e+=32}}_check_size(t){o.assert(this.size==t.size,\"Size mismatch\")}add(t){this._check_size(t);for(let s=0;s>1;s[h]>t?e=h:i=h+1}return s[i]}function x(t,s,i,e,h,n){if(Math.floor(e/n)>=Math.floor(h/n))return;const o=t[e+h>>1];let r=e-1,a=h+1;for(;;){do{r++}while(t[r]{let e=0;for(let n=0;n<=i;n++)for(let r=0;r{let e=t.length-4;for(let n=u;n>=i;n--)for(let r=0;r{const t=document.createElement(\"canvas\"),e=t.getContext(\"2d\");let n=-1,r=-1;return(l,a,c=1)=>{e.font=a;const{width:o}=e.measureText(\"M\"),s=o*c,u=Math.ceil(s),i=Math.ceil(2*s),f=Math.ceil(1.5*s);(n{let e=0;for(let n=0;n<=f;n++)for(let r=0;r{let e=t.length-4;for(let n=i;n>=f;n--)for(let r=0;r{try{return o(\"normal 10px sans-serif\"),o}catch(t){return u}})(),h=(()=>{try{return s(\"A\",\"normal 10px sans-serif\"),s}catch(t){return i}})(),g=new Map;function d(t){let e=g.get(t);return null==e&&(e={font:f(t),glyphs:new Map},g.set(t,e)),e.font}n.font_metrics=d,n.glyph_metrics=function(t,e){let n=g.get(e);null==n&&(d(e),n=g.get(e));let r=n.glyphs.get(t);return null==r&&(r=h(t,e),n.glyphs.set(t,r)),r},n.parse_css_font_size=function(t){const e=t.match(/^\\s*(\\d+(\\.\\d+)?)(\\w+)\\s*$/);if(null!=e){const[,t,,n]=e,r=Number(t);if(isFinite(r))return{value:r,unit:n}}return null}},\n",
- " function _(e,t,s,_,a){_();const r=e(145),n=e(157),g=e(156),i=e(159),c=e(104),h=e(99),o=e(13),l=e(11);class x{constructor(e,t,s,_,a={},r={}){this.in_x_scale=e,this.in_y_scale=t,this.x_range=s,this.y_range=_,this.extra_x_ranges=a,this.extra_y_ranges=r,this._bbox=new h.BBox,l.assert(null==e.source_range&&null==e.target_range),l.assert(null==t.source_range&&null==t.target_range),this._configure_scales()}get bbox(){return this._bbox}_get_ranges(e,t){return new Map(o.entries(Object.assign(Object.assign({},t),{default:e})))}_get_scales(e,t,s){const _=new Map;for(const[a,g]of t){if(g instanceof c.FactorRange!=e instanceof r.CategoricalScale)throw new Error(`Range ${g.type} is incompatible is Scale ${e.type}`);e instanceof n.LogScale&&g instanceof i.DataRange1d&&(g.scale_hint=\"log\");const t=e.clone();t.setv({source_range:g,target_range:s}),_.set(a,t)}return _}_configure_frame_ranges(){const{bbox:e}=this;this._x_target=new g.Range1d({start:e.left,end:e.right}),this._y_target=new g.Range1d({start:e.bottom,end:e.top})}_configure_scales(){this._configure_frame_ranges(),this._x_ranges=this._get_ranges(this.x_range,this.extra_x_ranges),this._y_ranges=this._get_ranges(this.y_range,this.extra_y_ranges),this._x_scales=this._get_scales(this.in_x_scale,this._x_ranges,this._x_target),this._y_scales=this._get_scales(this.in_y_scale,this._y_ranges,this._y_target)}_update_scales(){this._configure_frame_ranges();for(const[,e]of this._x_scales)e.target_range=this._x_target;for(const[,e]of this._y_scales)e.target_range=this._y_target}set_geometry(e){this._bbox=e,this._update_scales()}get x_target(){return this._x_target}get y_target(){return this._y_target}get x_ranges(){return this._x_ranges}get y_ranges(){return this._y_ranges}get x_scales(){return this._x_scales}get y_scales(){return this._y_scales}get x_scale(){return this._x_scales.get(\"default\")}get y_scale(){return this._y_scales.get(\"default\")}get xscales(){return o.to_object(this.x_scales)}get yscales(){return o.to_object(this.y_scales)}}s.CartesianFrame=x,x.__name__=\"CartesianFrame\"},\n",
- " function _(e,t,r,n,_){n();const c=e(146);class s extends c.Scale{constructor(e){super(e)}get s_compute(){const[e,t]=this._linear_compute_state(),r=this.source_range;return n=>e*r.synthetic(n)+t}compute(e){return super._linear_compute(this.source_range.synthetic(e))}v_compute(e){return super._linear_v_compute(this.source_range.v_synthetic(e))}invert(e){return this._linear_invert(e)}v_invert(e){return this._linear_v_invert(e)}}r.CategoricalScale=s,s.__name__=\"CategoricalScale\"},\n",
- " function _(t,e,r,n,s){n();const i=t(147),_=t(105),a=t(156),c=t(24);class o extends i.Transform{constructor(t){super(t)}static init_Scale(){this.internal((({Ref:t})=>({source_range:[t(_.Range)],target_range:[t(a.Range1d)]})))}r_compute(t,e){return this.target_range.is_reversed?[this.compute(e),this.compute(t)]:[this.compute(t),this.compute(e)]}r_invert(t,e){return this.target_range.is_reversed?[this.invert(e),this.invert(t)]:[this.invert(t),this.invert(e)]}_linear_compute(t){const[e,r]=this._linear_compute_state();return e*t+r}_linear_v_compute(t){const[e,r]=this._linear_compute_state(),n=new c.ScreenArray(t.length);for(let s=0;s