diff --git a/c3.js b/c3.js index 146e7c9..69dc9d0 100644 --- a/c3.js +++ b/c3.js @@ -167,7 +167,7 @@ /*-- Set Variables --*/ var clipId = __bindto.replace('#', '') + '-clip', - clipPath = "url(" + document.URL + "#" + clipId + ")"; + clipPath = getClipPath(clipId); var isTimeSeries = (__axis_x_type === 'timeseries'), isCategorized = (__axis_x_type === 'categorized'), @@ -221,6 +221,10 @@ /*-- Define Functions --*/ + function getClipPath(id) { + return "url(" + document.URL.split('#')[0] + "#" + id; + } + function transformMain() { main.attr("transform", translate.main); main.select('.x.axis').attr("transform", translate.x); @@ -1805,7 +1809,7 @@ // Add Axis main.append("g") .attr("class", "x axis") - .attr("clip-path", __axis_rotated ? "" : "url(" + document.URL + "#xaxis-clip)") + .attr("clip-path", __axis_rotated ? "" : getClipPath("xaxis-clip")) .attr("transform", translate.x) .append("text") .attr("class", "-axis-x-label") @@ -1814,7 +1818,7 @@ .text(__axis_rotated ? textForYAxisLabel : textForXAxisLabel); main.append("g") .attr("class", "y axis") - .attr("clip-path", __axis_rotated ? "url(" + document.URL + "#yaxis-clip)" : "") + .attr("clip-path", __axis_rotated ? getClipPath("yaxis-clip") : "") .append("text") .attr("class", "-axis-y-label") .attr("transform", "rotate(-90)") @@ -1940,7 +1944,7 @@ context.append("g") .attr("class", "x axis") .attr("transform", translate.subx) - .attr("clip-path", __axis_rotated ? "url(" + document.URL + "#yaxis-clip)" : ""); + .attr("clip-path", __axis_rotated ? getClipPath("yaxis-clip") : ""); } /*-- Legend Region --*/ diff --git a/c3.min.js b/c3.min.js index c9789ed..7ac4358 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,2 +1,2 @@ -!function(a){"use strict";function b(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+q)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return p>=c||b%Math.ceil(c/p)===0}function f(a){return a0?a:320}function s(){return Oc(Ud.data.targets)?0:ae?ae:Bf?1:u("y")}function t(){return Oc(Ud.data.targets)?0:be?be:zg?se*(Ff&&!of?1.25:1):Ff?Jf||of?1:u("y2"):1}function u(){var a=T();return a.isInner?40:60}function v(){return+g.select(Zd).style("width").replace("px","")}function w(){return+g.select(Zd).style("height").replace("px","")}function x(){return le+2}function y(){return 80}function z(){return ie.left+20}function A(){return ne+2}function B(){var a=of?ne:le,b=nb(),c=Kb();return c>1?a*b/(c-1):a}function C(){return kf?zg?150:pe:0}function D(){return kf?zg?qe:40:0}function E(){var a=S();return a.isInner?5:20}function F(){var a,b;Ae=of?1:0,Be=of?ne:le,Ce=of?0:ne,De=of?le:1,Ee=Ae,Fe=Be,Ge=of?0:oe,He=of?me:1,Ie=H(Ae,Be,Ie?Ie.domain():void 0,function(){return Oe.tickOffset()}),Je=I(Ce,De),Ke=I(Ce,De),Le=H(Ae,Be,Og,function(a){return a%1?0:Re.tickOffset()}),Me=I(Ge,He),Ne=I(Ge,He),a=O(),b=P(),Oe=L(Ie,ug,a,b),Re=L(Le,xg,a,b),Pe=M(Je,vg,Cf,Ef),Qe=M(Ke,wg,Kf,Mf),G()}function G(){we=cb(),xe=db(),ye=db(.98)}function H(a,b,c,f){var h=(mg?g.time.scale():g.scale.linear()).range([a,b]);if(h.orgDomain=function(){return h.domain()},e(c)&&h.domain(c),d(f)&&(f=function(){return 0}),ng){var i,j=h;h=function(a){return j(a)+f(a)};for(i in j)h[i]=j[i];h.orgDomain=function(){return j.domain()},h.domain=function(a){return arguments.length?(j.domain(a),h):(a=j.domain(),[a[0],a[1]+1])}}return h}function I(a,b){return g.scale.linear().range([a,b])}function J(a){return"y2"===N(a)?Ke:Je}function K(a){return"y2"===N(a)?Ne:Me}function L(a,c,d,e){var f=(ng?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),ng?f.tickCentered(rf):f.tickOffset=function(){var a=of?ne:le;return a*nb()/Kb()/2},ng&&f.categories(qf),f}function M(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function N(a){return a in Ye?Ye[a]:"y"}function O(){var a=mg?tg:ng?Tb:null;return sf&&("function"==typeof sf?a=sf:mg&&(a=function(a){return g.time.format(sf)(a)})),a}function P(){var a=Kb();return tf&&a>uf?uf:a}function Q(a){return"string"==typeof a?a:a?a.text:null}function R(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function S(){return R(wf,"inner-right")}function T(){return R(Af,"inner-top")}function U(){return Q(wf)}function V(){return Q(Af)}function W(){var a=S();return a.isLeft?0:a.isCenter?le/2:le}function X(){var a=T();return a.isBottom?-ne:a.isMiddle?-ne/2:0}function Y(){var a=T();return a.isTop?"-0.5em":"0"}function Z(){var a=S();return a.isInner?"-0.5em":"3.5em"}function $(){var a=T(),b=0;return g.selectAll(".y.axis .tick text").each(function(){var a=this.getBBox();b0)for(f=Rb(a),b=0;ba?a:0}),c=1;c0||(h[d][b]+=+a)});return g.min(Object.keys(h).map(function(a){return g.min(h[a])}))}function lb(a){var b,c,d,e,f,h=Pb(a);if(Xe.length>0)for(f=Sb(a),b=0;b0?a:0}),c=1;c+a||(h[d][b]+=+a)});return g.max(Object.keys(h).map(function(a){return g.max(h[a])}))}function mb(a){var b,d,e,f,g,h,i,j,k=Ob(function(b){return N(b.id)===a}),l="y2"===a?Hf:yf,m="y2"===a?Gf:xf,n=c(l)?l:kb(k),o=c(m)?m:lb(k),p="y2"===a?If:zf,q=jc()&&of;return n===o&&(0>n?o=0:n=0),b=Math.abs(o-n),d=e=f=q?0:.1*b,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&Df&&(e=c(Df.top)?Df.top:d,f=c(Df.bottom)?Df.bottom:d),"y2"===a&&Lf&&(e=c(Lf.top)?Lf.top:d,f=c(Lf.bottom)?Lf.bottom:d),q&&(h=kc(n,o),i=sb(Je.range()),j=[h[0]/i,h[1]/i],e+=b*(j[1]/(1-j[0]-j[1])),f+=b*(j[0]/(1-j[0]-j[1]))),Kc(k)&&!Rb(k)&&(f=n),[n-f,o+e]}function nb(a){var b=sb(Og),c=sb(Ie.domain());return a||0===c?1:b/c}function ob(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function pb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function qb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ng?d=0:Kc(a)?(c=Kb(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function rb(a){var b=[ob(a),pb(a)],c=b[0],d=b[1],e=qb(a,b),f=mg?new Date(c.getTime()-e):c-e,g=mg?new Date(d.getTime()+e):d+e;return[f,g]}function sb(a){return a[1]-a[0]}function tb(a){for(var b=0;bd?0:d}function yb(a){return Se&&a===Se||Te&&cd(Te,a)}function zb(a){return!yb(a)}function Ab(a){return Se?Se:Te?Te[a]:null}function Bb(a,b){return a in Ud.data.x&&Ud.data.x[a]&&Ud.data.x[a][b]?Ud.data.x[a][b]:b}function Cb(a){Object.keys(a).forEach(function(b){Te[b]=a[b]})}function Db(a){var b;return a&&(b=We[a.id],a.name=b?b:a.id),a}function Eb(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):Ud.data.x[Object.keys(Ud.data.x)[0]]}),c=d.map(function(a){var c=Ve(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Ab(a);return e=mg?$c(b[f]):og?b[f]?+b[f]:Bb(a,d):d,b.x=e,{x:e,value:null===b[a]||isNaN(b[a])?null:+b[a],id:c}})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ze&&Ic(Mb(c).filter(function(a){return!(a in $e)}),Ze),c.forEach(function(a){ub(a.id_org,a)}),c)}function Hb(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Ib(a){return a>0&&Ud.data.targets[0].values[a-1]?Ud.data.targets[0].values[a-1].x:void 0}function Jb(a){return a1?Ud.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ud.data.targets[0]:null,a}function Mb(a){return a=d(a)?Ud.data.targets:a,a.map(function(a){return a.id})}function Nb(a){var b,c=Mb();for(b=0;ba})}function Sb(a){return Qb(a,function(a){return a>0})}function Tb(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(qc(a,f))),a[g].x&&(e=e.concat(qc(a,g))),tc(e,b)):rc(a,b,f,g)}function sc(a,b){var c;return c=a.map(function(a){return rc(a.values,b)}),tc(c,b)}function tc(a,b){var c,d;return a.forEach(function(a){var e=dd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function uc(){return af&&"desc"===af.toLowerCase()}function vc(){return af&&"asc"===af.toLowerCase()}function wc(a){var b=vc(),c=uc();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof af&&a.sort(af),a}function xc(a,b){var d,e,f,g,h,i,j,k=a.filter(function(a){return a&&c(a.value)});dg&&0!==k.length&&(Mg.html(gg(a,O(),pc,sg)).style("visibility","hidden").style("display","block"),d=Mg.property("offsetWidth"),e=Mg.property("offsetHeight"),of?(f=p(),g=f+b[0]+100,h=g+d,j=q()-t(),i=Ie(k[0].x)+20):(f=p(),g=f+s()+Ie(k[0].x)+20,h=g+d,j=f+q()-t(),i=b[1]+15),h>j&&(g-=d+60),i+e>r()&&(i-=e+30),Mg.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function yc(){Mg.style("display","none")}function zc(a){var b=a.filter(function(a){return a&&c(a.value)});dg&&(Lc(Ud.data.targets)||Oc(Ud.data.targets)||Jg.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(of?"y1":"x1",lc).attr(of?"y2":"x2",lc))}function Ac(){Jg.select("line.xgrid-focus").style("visibility","hidden")}function Bc(a){return a.x||0===a.x?Ie(a.x):null}function Cc(a){return J(a.id)(a.value)}function Dc(){var a,b,c={},e=0;return Ob(Rc).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Hc(a,b){return b?2*a.tickOffset()*.6/b:0}function Ic(a,b){var c=d(a)?Mb():a;"string"==typeof c&&(c=[c]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function wd(a,b,c,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(e(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function xd(b){var c,d,e;if(Ng=g.select(Zd),Ng.empty())return void a.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ng.html(""),Ud.data.x={},Ud.data.targets=Gb(b),n(),F(),Ie.domain(g.extent(rb(Ud.data.targets))),Je.domain(mb("y")),Ke.domain(mb("y2")),Le.domain(Ie.domain()),Me.domain(Je.domain()),Ne.domain(Ke.domain()),Og=Ie.domain(),Cg.scale(Le),ce&&Gg.scale(Ie),Hg=g.select(Zd).append("svg").attr("width",le+ie.left+ie.right).attr("height",ne+ie.top+ie.bottom).on("mouseenter",fe).on("mouseleave",ge),Ig=Hg.append("defs"),Ig.append("clipPath").attr("id",kg).append("rect").attr("width",le).attr("height",ne),Ig.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",x).attr("height",y),Ig.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-ie.left+1).attr("width",z).attr("height",A),Jg=Hg.append("g").attr("transform",yg.main),Kg=gf?Hg.append("g").attr("transform",yg.context):null,Lg=kf?Hg.append("g").attr("transform",yg.legend):null,Mg=g.select(Zd).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Jg.append("g").attr("class","x axis").attr("clip-path",of?"":"url("+document.URL+"#xaxis-clip)").attr("transform",yg.x).append("text").attr("class","-axis-x-label").attr("dy",Z).style("text-anchor",_).text(of?V:U),Jg.append("g").attr("class","y axis").attr("clip-path",of?"url("+document.URL+"#yaxis-clip)":"").append("text").attr("class","-axis-y-label").attr("transform","rotate(-90)").attr("dx",Y).style("text-anchor",ab).text(of?U:V),Ff&&Jg.append("g").attr("class","y2 axis").attr("transform",yg.y2),d=Jg.append("g").attr("clip-path",lg).attr("class","grid"),Nf&&d.append("g").attr("class","xgrids"),Pf&&d.append("g").attr("class","xgrid-lines"),Vf&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",of?0:-10).attr("x2",of?le:-10).attr("y1",of?-10:ie.top).attr("y2",of?-10:ne),Qf&&d.append("g").attr("class","ygrids"),Rf&&d.append("g").attr("class","ygrid-lines"),Jg.append("g").attr("clip-path",lg).attr("class","regions"),Jg.append("g").attr("clip-path",lg).attr("class","chart"),c=Jg.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",ce?of?"ns-resize":"ew-resize":null),Jg.select(".chart").append("g").attr("class","chart-bars"),Jg.select(".chart").append("g").attr("class","chart-lines"),Jg.select(".chart").append("g").attr("class","chart-arcs").attr("transform",yg.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(bg),Jg.select(".chart").append("g").attr("class","chart-texts"),ce&&Jg.insert("rect",ee?null:"g.grid").attr("class","zoom-rect").attr("width",le).attr("height",ne).style("opacity",0).style("cursor",of?"ns-resize":"ew-resize").call(Gg).on("dblclick.zoom",null),null!==vf&&Cg.extent("function"!=typeof vf?vf:vf(rb())),gf&&(Kg.append("g").attr("clip-path",lg).attr("class","chart"),Kg.select(".chart").append("g").attr("class","chart-bars"),Kg.select(".chart").append("g").attr("class","chart-lines"),Kg.append("g").attr("clip-path",lg).attr("class","x brush").call(Cg).selectAll("rect").attr(of?"width":"height",of?me:oe),Kg.append("g").attr("class","x axis").attr("transform",yg.subx).attr("clip-path",of?"url("+document.URL+"#yaxis-clip)":"")),kf&&Od(Ud.data.targets),Jd(Ud.data.targets),Ed({withTransform:!0,withUpdateXDomain:!0}),hg){if(mg&&"string"==typeof ig){for(ig=$c(ig),e=0;e0){d=[];for(var f in We)for(c=0;cf&&h>c&&d>i&&j>d):"rect"===this.nodeName&&(c=1*l.attr("x"),d=1*l.attr("y"),e=1*l.attr("width"),k=jd,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(Yd,!n),l.classed(Xd,!m),k(!m,l,a,b))}))}function Cd(a){Oc(Ud.data.targets)||df&&(pg=a,Jg.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),qg=!0)}function Dd(){Oc(Ud.data.targets)||df&&(Jg.select(".dragarea").transition().duration(100).style("opacity",0).remove(),Jg.selectAll(".-shape").classed(Yd,!1),qg=!1)}function Ed(a){var b,d,f,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,C,D,E,F,G,H=Dc(),I=Oc(Ud.data.targets);if(a=e(a)?a:{},u=e(a.withY)?a.withY:!0,v=e(a.withSubchart)?a.withSubchart:!0,w=e(a.withTransition)?a.withTransition:!0,x=e(a.withTransform)?a.withTransform:!1,y=e(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=e(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,F=w?he:0,G=e(a.durationForExit)?a.durationForExit:F,z&&(Ie.domain(g.extent(rb(Ud.data.targets))),Og=Ie.domain(),ce&&Gg.scale(Ie).updateScaleExtent(),Le.domain(Ie.domain()),Cg.scale(Le)),y&&(Ie.domain(Cg.empty()?Og:Cg.extent()),ce&&Gg.scale(Ie).updateScaleExtent()),Je.domain(mb("y")),Ke.domain(mb("y2")),Jg.select(".x.axis").style("opacity",I?0:1).transition().duration(F).call(of?Pe:Oe),Jg.select(".y.axis").style("opacity",I?0:1).transition().duration(F).call(of?Oe:Pe),Jg.select(".y2.axis").style("opacity",I?0:1).transition().call(Qe),A=rd(H),D=sd(H,!0),E=sd(H,!1),Jg.select(".x.axis .-axis-x-label").attr("x",W),Jg.select(".y.axis .-axis-y-label").attr("x",X).attr("dy",$),Me.domain(Je.domain()),Ne.domain(Ke.domain()),Mg.style("display","none"),Jg.select("line.xgrid-focus").style("visibility","hidden").attr("y2",ne),Nf){if("year"===Of){d=[];for(var J=rb(),K=J[0].getFullYear(),L=J[1].getFullYear(),M=K;L>=M;M++)d.push(new Date(M+"-01-01 00:00:00"))}else d=Ie.ticks(10);b=Jg.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",of?0:function(a){return Ie(a)-Oe.tickOffset()}).attr("x2",of?le:function(a){return Ie(a)-Oe.tickOffset()}).attr("y1",of?function(a){return Ie(a)-Oe.tickOffset()}:ie.top).attr("y2",of?function(a){return Ie(a)-Oe.tickOffset()}:ne).style("opacity",function(){return+g.select(this).attr(of?"y1":"x1")===(of?ne:0)?0:1}),b.exit().remove()}Pf&&(f=Jg.select(".xgrid-lines").selectAll(".xgrid-line").data(Pf),h=f.enter().append("g").attr("class",function(a){return"xgrid-line xgrid-line-"+(a["class"]?a["class"]:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",of?"":"rotate(-90)").attr("dx",of?0:-ie.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(F).attr("x1",of?0:mc).attr("x2",of?le:mc).attr("y1",of?mc:ie.top).attr("y2",of?mc:ne).style("opacity",1),f.select("text").transition().duration(F).attr("x",of?le:0).attr("y",mc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(F).style("opacity",0).remove()),u&&Qf&&(i=Jg.select(".ygrids").selectAll(".ygrid").data(Je.ticks(Sf)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",of?Je:0).attr("x2",of?Je:le).attr("y1",of?0:Je).attr("y2",of?ne:Je),i.exit().remove()),u&&Rf&&(j=Jg.select(".ygrid-lines").selectAll(".ygrid-line").data(Rf),k=j.enter().append("g").attr("class",function(a){return"ygrid-line ygrid-line-"+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",of?"rotate(-90)":"").attr("dx",of?0:-ie.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",of?nc:0).attr("x2",of?nc:le).attr("y1",of?0:nc).attr("y2",of?ne:nc).style("opacity",1),j.select("text").transition().duration(F).attr("x",of?0:le).attr("y",nc).text(function(a){return a.text -}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=Jg.selectAll(".-bars").selectAll(".-bar").data(Wc),m.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return sg(a.id)}).attr("class",cc),m.style("opacity",fc).transition().duration(F).attr("d",A).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=Jg.selectAll(".-texts").selectAll(".-text").data(Yc),o.enter().append("text").attr("class",Ub).attr("text-anchor",function(a){return of?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return pc(a.value)}),o.style("fill-opacity",gc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",ic),o.exit().transition().duration(G).style("fill-opacity",0).remove(),Jg.selectAll(".-line").style("opacity",fc).transition().duration(F).attr("d",Dg).style("opacity",1),Jg.selectAll(".-area").style("opacity",0).transition().duration(F).attr("d",Eg).style("opacity",Pg),l=Jg.selectAll(".-circles").selectAll(".-circle").data(Xc),l.enter().append("circle").attr("class",bc).style("opacity",0).attr("r",Uf),l.style("opacity",fc).transition().duration(F).style("opacity",hc).attr("cx",of?Cc:Bc).attr("cy",of?Bc:Cc),l.exit().remove(),Jg.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b=bb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return eb(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),Jg.selectAll(".chart-arc").select("text").attr("transform",fb).style("opacity",0).transition().duration(F).text(hb).style("opacity",function(a){return Vc(a.data)?1:0}),Jg.select(".chart-arcs-title").style("opacity",Nc(Ud.data.targets)?1:0),gf&&(null!==g.event&&"zoom"===g.event.type&&Cg.extent(Ie.orgDomain()).update(),v&&(Kg.select(".x.axis").style("opacity",I?0:1).transition().duration(F).call(Re),Cg.empty()||Cg.extent(Ie.orgDomain()).update(),C=rd(H,!0),p=Kg.selectAll(".-bars").selectAll(".-bar").data(Wc),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return sg(a.id)}).attr("class",cc),p.style("opacity",fc).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),Kg.selectAll(".-line").style("opacity",fc).transition().duration(F).attr("d",Fg).style("opacity",1))),Jg.selectAll(".selected-circles").filter(function(a){return Rc(a)}).selectAll("circle").remove(),Jg.selectAll(".selected-circle").transition().duration(F).attr("cx",of?Cc:Bc).attr("cy",of?Bc:Cc),Te?(q=Jg.select(".event-rects").selectAll(".event-rect").data([0]),zd(q.enter()),q.attr("x",0).attr("y",0).attr("width",le).attr("height",ne)):(og?(t=function(a,b){var c=Ib(b),d=Jb(b);return(Ie(d?d:a.x+50)-Ie(c?c:a.x-50))/2},s=function(a,b){var c=Ib(b);return(Ie(a.x)+Ie(c?c:a.x-50))/2}):(t=B(),s=function(a){return Ie(a.x)-t/2}),r=Lb(),Jg.select(".event-rects").datum(r?r.values:[]),q=Jg.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),yd(q.enter()),q.attr("class",ec).attr("x",of?0:s).attr("y",of?s:0).attr("width",of?le:t).attr("height",of?t:ne),q.exit().remove()),n=Jg.select(".regions").selectAll("rect.region").data(cg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",dc).attr("x",of?0:wb).attr("y",of?wb:ie.top).attr("width",of?le:xb).attr("height",of?xb:ne).transition().duration(F).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),kf&&Od(Ud.data.targets,{withTransition:w}),Mb().forEach(function(a){Qg[a]=!0})}function Fd(){Ed({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Gd(){return"mousemove"===g.event.sourceEvent.type&&Gg.altDomain?(Ie.domain(Gg.altDomain),void Gg.scale(Ie).updateScaleExtent()):(ng&&Ie.orgDomain()[0]===Og[0]&&Ie.domain([Og[0]-1e-10,Ie.orgDomain()[1]]),Ed({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(rg=!0)))}function Hd(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Id(a){var b,c;a=e(a)?a:{},b=e(a.withTransition)?a.withTransition:!1,c=e(a.withTransform)?a.withTransform:!1,n(),F(),Cg.scale(Le),ce&&Gg.scale(Ie),Hg.attr("width",pe).attr("height",qe),Hg.select("#"+kg).select("rect").attr("width",le).attr("height",ne),Hg.select("#xaxis-clip").select("rect").attr("width",x),Hg.select(".zoom-rect").attr("width",le).attr("height",ne),m(b),Ed({withTransition:b,withUpdateXDomain:!0,withTransform:c,durationForExit:0})}function Jd(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Jg.select(".chart-texts").selectAll(".chart-text").data(a),j=i.enter().append("g").attr("class",function(a){return"chart-text target target-"+a.id}).style("pointer-events","none"),j.append("g").attr("class",Vb).style("fill",function(a){return sg(a.id)}),e=Jg.select(".chart-bars").selectAll(".chart-bar").data(a),d=e.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none"),d.append("g").attr("class",Zb).style("fill",function(a){return sg(a.id)}).style("stroke","none").style("cursor",function(a){return ff(a)?"pointer":null}),c=Jg.select(".chart-lines").selectAll(".chart-line").data(a),b=c.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none"),b.append("path").attr("class",Xb).style("opacity",0).style("stroke",function(a){return sg(a.id)}),b.append("path").attr("class",_b).style("opacity",function(){return Pg=+g.select(this).style("opacity"),0}).style("fill",function(a){return sg(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",Yb).style("fill",function(a){return sg(a.id)}).style("cursor",function(a){return ff(a)?"pointer":null}),a.forEach(function(a){var b=Pd(a.id);Jg.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=Jg.select(".chart-arcs").selectAll(".chart-arc").data(ze(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",$b).style("opacity",0).style("fill",function(a){return sg(a.data.id)}).style("cursor",function(a){return ff(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){ib(a.data.id),Ld(a.data.id)}).on("mouseout",function(a){jb(a.data.id),Nd()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),gf&&(n=Kg.select(".chart-bars").selectAll(".chart-bar").data(a),m=n.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}),m.append("g").attr("class",Zb).style("fill",function(a){return sg(a.id)}),l=Kg.select(".chart-lines").selectAll(".chart-line").data(a),k=l.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}),k.append("path").attr("class",Xb).style("opacity",0).style("stroke",function(a){return sg(a.id)})),kf&&Od(a),Hg.selectAll(".target").transition().style("opacity",1)}function Kd(a,b){Ud.data.targets.forEach(function(b){for(var c=0;c=d&&(Object.keys(w).forEach(function(a){w[a]=h}),zg||(p=(se-h*Object.keys(a).length)/2)),i>=e&&(Object.keys(x).forEach(function(a){x[a]=i}),zg&&(p=(re-i*Object.keys(a).length)/2))):(v[c]=u,u+=j,p=(k-u)/2)}var i,j,k,l,m,n,o,p,q,r=Mb(a),s=4,t=30,u=0,v={},w={},x={};b=d(b)?{}:b,q=e(b.withTransition)?b.withTransition:!0,zg?(j=function(){return.2*se},m=function(a,b){return p+f(a,b)}):(j=function(a,b){return p+c(a,b)},m=function(){return.2*re}),k=function(a,b){return j(a,b)+14},n=function(a,b){return m(a,b)+9},l=function(a,b){return j(a,b)-4},o=function(a,b){return m(a,b)-7},i=Lg.selectAll(".legend-item").data(r).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){mf(a)}).on("mouseover",function(a){Ld(a),Ud.focus(a)}).on("mouseout",function(){Nd(),Ud.revert()}),i.append("text").text(function(a){return e(We[a])?We[a]:a}).each(function(a){h(this,a)}).style("pointer-events","none").attr("x",zg?k:-200).attr("y",zg?-200:m),i.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",zg?l:-200).attr("y",zg?-200:o).attr("width",function(a){return w[a]}).attr("height",function(a){return x[a]}),i.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return sg(a)}).attr("x",zg?k:-200).attr("y",zg?-200:n).attr("width",10).attr("height",10),Lg.selectAll("text").data(r).each(function(a){h(this,a)}).transition().duration(q?250:0).attr("x",k).attr("y",n),Lg.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",l).attr("y",o),Lg.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",j).attr("y",m)}function Pd(a){return a?"-"+a.replace(/\./g,"\\."):""}function Qd(a){return".target"+Pd(a)}function Rd(a){return Nb(a.id)}function Sd(a){return"data"in a&&Nb(a.data.id)}function Td(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}var Ud={data:{}},Vd={},Wd="_expanded_",Xd="_selected_",Yd="_included_",Zd=i(["bindto"],"#chart"),$d=i(["size","width"],null),_d=i(["size","height"],null),ae=i(["padding","left"],null),be=i(["padding","right"],null),ce=i(["zoom","enabled"],!1),de=i(["zoom","extent"],null),ee=i(["zoom","privileged"],!1),fe=i(["onenter"],function(){}),ge=i(["onleave"],function(){}),he=i(["transition","duration"],350);h("data","data is required in config");var ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze,Ae,Be,Ce,De,Ee,Fe,Ge,He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se=i(["data","x"],null),Te=i(["data","xs"],null),Ue=i(["data","x_format"],"%Y-%m-%d"),Ve=i(["data","id_converter"],function(a){return a}),We=i(["data","names"],{}),Xe=i(["data","groups"],[]),Ye=i(["data","axes"],{}),Ze=i(["data","type"],null),$e=i(["data","types"],{}),_e=i(["data","labels"],{}),af=i(["data","order"],null),bf=i(["data","regions"],{}),cf=i(["data","colors"],{}),df=i(["data","selection","enabled"],!1),ef=i(["data","selection","grouped"],!1),ff=i(["data","selection","isselectable"],function(){return!0}),gf=i(["subchart","show"],!1),hf=gf?i(["subchart","size","height"],60):0,jf=i(["color","pattern"],null),kf=i(["legend","show"],!0),lf=i(["legend","position"],"bottom"),mf=i(["legend","item","onclick"],function(){}),nf=i(["legend","equally"],!1),of=i(["axis","rotated"],!1),pf=i(["axis","x","type"],"indexed"),qf=i(["axis","x","categories"],[]),rf=i(["axis","x","tick","centered"],!1),sf=i(["axis","x","tick","format"],null),tf=i(["axis","x","tick","culling"],"categorized"===pf?!1:!0),uf=i(["axis","x","tick","count"],10),vf=i(["axis","x","default"],null),wf=i(["axis","x","label"],null),xf=i(["axis","y","max"],null),yf=i(["axis","y","min"],null),zf=i(["axis","y","center"],null),Af=i(["axis","y","label"],null),Bf=i(["axis","y","inner"],!1),Cf=i(["axis","y","tick","format"],null),Df=i(["axis","y","padding"],null),Ef=i(["axis","y","ticks"],10),Ff=i(["axis","y2","show"],!1),Gf=i(["axis","y2","max"],null),Hf=i(["axis","y2","min"],null),If=i(["axis","y2","center"],null),Jf=i(["axis","y2","inner"],!1),Kf=i(["axis","y2","tick","format"],null),Lf=i(["axis","y2","padding"],null),Mf=i(["axis","y2","ticks"],10),Nf=i(["grid","x","show"],!1),Of=i(["grid","x","type"],"tick"),Pf=i(["grid","x","lines"],null),Qf=i(["grid","y","show"],!1),Rf=i(["grid","y","lines"],null),Sf=i(["grid","y","ticks"],10),Tf=i(["point","show"],!0),Uf=Tf?i(["point","r"],2.5):0,Vf=i(["point","focus","line","enabled"],!0),Wf=i(["point","focus","expand","enabled"],!0),Xf=i(["point","focus","expand","r"],Wf?4:Uf),Yf=i(["point","focus","select","r"],8),Zf=i(["point","onclick"],function(){}),$f=i(["point","onselected"],function(){}),_f=i(["point","onunselected"],function(){}),ag=i(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),bg=i(["arc","title"],""),cg=i(["regions"],[]),dg=i(["tooltip","show"],!0),eg=i(["tooltip","format","title"],null),fg=i(["tooltip","format","value"],null),gg=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=eg?eg:b,k=fg?fg:c;for(f=0;f"+g+""),i=a[f].name,h=k(a[f].value),e+=""+i+""+h+"");return e+""}),hg=i(["tooltip","init","show"],!1),ig=i(["tooltip","init","x"],0),jg=i(["tooltip","init","position"],{top:"0px",left:"50px"}),kg=Zd.replace("#","")+"-clip",lg="url("+document.URL+"#"+kg+")",mg="timeseries"===pf,ng="categorized"===pf,og=!mg&&(Se||Te),pg=null,qg=!1,rg=!1,sg=Zc(cf,jf),tg=function(){var a=[[g.time.format("%Y/%-m/%-d"),function(){return!0}],[g.time.format("%-m/%-d"),function(a){return a.getMonth()}],[g.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[g.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[g.time.format("%I %p"),function(a){return a.getHours()}],[g.time.format("%I:%M"),function(a){return a.getMinutes()}],[g.time.format(":%S"),function(a){return a.getSeconds()}],[g.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ug=of?"left":"bottom",vg=of?Bf?"top":"bottom":Bf?"right":"left",wg=of?Jf?"bottom":"top":Jf?"left":"right",xg=of?"left":"bottom",yg={main:function(){return"translate("+ie.left+","+ie.top+")"},context:function(){return"translate("+je.left+","+je.top+")"},legend:function(){return"translate("+ke.left+","+ke.top+")"},y2:function(){return"translate("+(of?0:le)+","+(of?1:0)+")"},x:function(){return"translate(0,"+ne+")"},subx:function(){return"translate(0,"+(of?0:oe)+")"},arc:function(){return"translate("+le/2+","+ne/2+")"}},zg="right"===lf,Ag=40,Bg=20;ze=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Cg,Dg=function(){var a=g.svg.line().x(of?function(a){return J(a.id)(a.value)}:lc).y(of?lc:function(a){return J(a.id)(a.value)});return function(b){var c,d,e=kd(b.values);return Pc(b)?(a.interpolate(Qc(b)?"cardinal":"linear"),bf[b.id]?wd(e,Ie,J(b.id),bf[b.id]):a(e)):(c=Ie(e[0].x),d=J(b.id)(e[0].value),of?"M "+d+" "+c:"M "+c+" "+d)}}(),Eg=function(){var a;return a=of?g.svg.area().x0(function(a){return J(a.id)(0)}).x1(function(a){return J(a.id)(a.value)}).y(lc):g.svg.area().x(lc).y0(function(a){return J(a.id)(0)}).y1(function(a){return J(a.id)(a.value)}),function(b){var c,d,e=kd(b.values);return Jc([b],"area")||Jc([b],"area-spline")?(a.interpolate(Qc(b)?"cardinal":"linear"),a(e)):(c=Ie(e[0].x),d=J(b.id)(e[0].value),of?"M "+d+" "+c:"M "+c+" "+d)}}(),Fg=function(){var a=g.svg.line().x(of?function(a){return K(a.id)(a.value)}:oc).y(of?oc:function(a){return K(a.id)(a.value)});return function(b){var c=kd(b.values);return Pc(b)?a(c):"M "+Le(c[0].x)+" "+K(b.id)(c[0].value)}}(),Gg=function(){};Cg=g.svg.brush().on("brush",Fd),Cg.update=function(){return Kg&&Kg.select(".x.brush").call(this),this},Cg.scale=function(a){return of?this.y(a):this.x(a)},ce&&(Gg=g.behavior.zoom().on("zoomstart",function(){Gg.altDomain=g.event.sourceEvent.altKey?Ie.orgDomain():null}).on("zoom",ce?Gd:null),Gg.scale=function(a){return of?this.y(a):this.x(a)},Gg.orgScaleExtent=function(){var a=de?de:[1,10];return[a[0],Math.max(Kb()/a[1],a[1])]},Gg.updateScaleExtent=function(){var a=sb(Ie.orgDomain())/sb(Og),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg={};if(Ud.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Hg.selectAll(Qd(a)),d=c.filter(Rd),e=c.filter(Sd);Ud.revert(),Ud.defocus(),b(d.classed("focused",!0)),b(e),Oc(Ud.data.targets)&&ib(a,!0),Ld(a)},Ud.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Hg.selectAll(Qd(a)),d=c.filter(Rd),e=c.filter(Sd);Ud.revert(),b(d.classed("focused",!1)),b(e),Oc(Ud.data.targets)&&jb(a),Md(a)},Ud.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Hg.selectAll(Qd(a)),d=c.filter(Rd),e=c.filter(Sd);b(d.classed("focused",!1)),b(e),Oc(Ud.data.targets)&&jb(a),Nd()},Ud.show=function(a){Hg.selectAll(Qd(a)).transition().style("opacity",1)},Ud.hide=function(a){Hg.selectAll(Qd(a)).transition().style("opacity",0)},Ud.unzoom=function(){Cg.clear().update(),Ed({withUpdateXDomain:!0})},Ud.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&Cb(a.xs),"categories"in a&&ng&&(qf=a.categories,Oe.categories(qf)),"cacheIds"in a&&tb(a.cacheIds))return void Kd(vb(a.cacheIds),a.done);if("data"in a)Kd(Gb(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){Kd(Gb(c),a.done)});else if("rows"in a)Kd(Gb(Eb(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");Kd(Gb(Fb(a.columns)),a.done)}},Ud.unload=function(a){Ud.data.targets=Ud.data.targets.filter(function(b){return b.id!==a}),Hg.selectAll(Qd(a)).transition().style("opacity",0).remove(),kf&&(Hg.selectAll(".legend-item"+Pd(a)).remove(),Od(Ud.data.targets)),Ud.data.targets.length>0&&Ed({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},Ud.selected=function(a){var b=Pd(a);return g.merge(Jg.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(Xd)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ud.select=function(a,b,c){df&&Jg.selectAll(".-shapes").selectAll(".-shape").each(function(f,h){var i="circle"===this.nodeName?ed:hd,j="circle"===this.nodeName?fd:id;b.indexOf(h)>=0?ff(f)&&(ef||d(a)||a.indexOf(f.id)>=0)&&i(g.select(this).classed(Xd,!0),f,h):e(c)&&c&&j(g.select(this).classed(Xd,!1),f,h)})},Ud.unselect=function(a,b){df&&Jg.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?fd:id;(d(b)||b.indexOf(e)>=0)&&ff(c)&&(ef||d(a)||a.indexOf(c.id)>=0)&&f(g.select(this).classed(Xd,!1),c,e)})},Ud.toLine=function(a){Ic(a,"line"),Id({withTransition:!0})},Ud.toSpline=function(a){Ic(a,"spline"),Id({withTransition:!0})},Ud.toBar=function(a){Ic(a,"bar"),Id({withTransition:!0})},Ud.toScatter=function(a){Ic(a,"scatter"),Id({withTransition:!0})},Ud.toArea=function(a){Ic(a,"area"),Id({withTransition:!0})},Ud.toAreaSpline=function(a){Ic(a,"area-spline"),Id({withTransition:!0})},Ud.toPie=function(a){Ic(a,"pie"),Id({withTransition:!0,withTransform:!0})},Ud.toDonut=function(a){Ic(a,"donut"),Id({withTransition:!0,withTransform:!0})},Ud.groups=function(a){return d(a)?Xe:(Xe=a,Ed(),Xe)},Ud.xgrids=function(a){return a?(Pf=a,Ed(),Pf):Pf},Ud.xgrids.add=function(a){return a?Ud.xgrids(Pf.concat(a)):void 0},Ud.xgrids.remove=function(a){var b=Td(a);return Ud.xgrids(Pf.filter(b))},Ud.ygrids=function(a){return a?(Rf=a,Ed(),Rf):Rf},Ud.ygrids.add=function(a){return a?Ud.ygrids(Rf.concat(a)):void 0},Ud.ygrids.remove=function(a){var b=Td(a);return Ud.ygrids(Rf.filter(b))},Ud.regions=function(a){return d(a)?cg:(cg=a,Ed(),cg)},Ud.regions.add=function(a){return d(a)?cg:(cg=cg.concat(a),Ed(),cg)},Ud.regions.remove=function(a,b){var d=[].concat(a);return b=e(b)?b:{},d.forEach(function(a){var d=c(b.duration)?b.duration:0;Hg.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),cg=cg.filter(function(b){return b.classes.indexOf(a)<0})}),cg},Ud.data.get=function(a){var b=Ud.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},Ud.data.getAsTarget=function(a){var b=Ob(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ud.resize=function(a){$d=a?a.width:null,_d=a?a.height:null,Id()},Ud.destroy=function(){Ud.data.targets=void 0,Ud.data.x={},Ng.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){xd(b)});else if("rows"in f.data)xd(Eb(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");xd(Fb(f.data.columns))}return Ud}}(window); \ No newline at end of file +!function(a){"use strict";function b(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+q)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return p>=c||b%Math.ceil(c/p)===0}function f(a){return a0?a:320}function t(){return Pc(Vd.data.targets)?0:be?be:Cf?1:v("y")}function u(){return Pc(Vd.data.targets)?0:ce?ce:Ag?te*(Gf&&!pf?1.25:1):Gf?Kf||pf?1:v("y2"):1}function v(){var a=U();return a.isInner?40:60}function w(){return+g.select($d).style("width").replace("px","")}function x(){return+g.select($d).style("height").replace("px","")}function y(){return me+2}function z(){return 80}function A(){return je.left+20}function B(){return oe+2}function C(){var a=pf?oe:me,b=ob(),c=Lb();return c>1?a*b/(c-1):a}function D(){return lf?Ag?150:qe:0}function E(){return lf?Ag?re:40:0}function F(){var a=T();return a.isInner?5:20}function G(){var a,b;Be=pf?1:0,Ce=pf?oe:me,De=pf?0:oe,Ee=pf?me:1,Fe=Be,Ge=Ce,He=pf?0:pe,Ie=pf?ne:1,Je=I(Be,Ce,Je?Je.domain():void 0,function(){return Pe.tickOffset()}),Ke=J(De,Ee),Le=J(De,Ee),Me=I(Be,Ce,Pg,function(a){return a%1?0:Se.tickOffset()}),Ne=J(He,Ie),Oe=J(He,Ie),a=P(),b=Q(),Pe=M(Je,vg,a,b),Se=M(Me,yg,a,b),Qe=N(Ke,wg,Df,Ff),Re=N(Le,xg,Lf,Nf),H()}function H(){xe=db(),ye=eb(),ze=eb(.98)}function I(a,b,c,f){var h=(ng?g.time.scale():g.scale.linear()).range([a,b]);if(h.orgDomain=function(){return h.domain()},e(c)&&h.domain(c),d(f)&&(f=function(){return 0}),og){var i,j=h;h=function(a){return j(a)+f(a)};for(i in j)h[i]=j[i];h.orgDomain=function(){return j.domain()},h.domain=function(a){return arguments.length?(j.domain(a),h):(a=j.domain(),[a[0],a[1]+1])}}return h}function J(a,b){return g.scale.linear().range([a,b])}function K(a){return"y2"===O(a)?Le:Ke}function L(a){return"y2"===O(a)?Oe:Ne}function M(a,c,d,e){var f=(og?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),og?f.tickCentered(sf):f.tickOffset=function(){var a=pf?oe:me;return a*ob()/Lb()/2},og&&f.categories(rf),f}function N(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function O(a){return a in Ze?Ze[a]:"y"}function P(){var a=ng?ug:og?Ub:null;return tf&&("function"==typeof tf?a=tf:ng&&(a=function(a){return g.time.format(tf)(a)})),a}function Q(){var a=Lb();return uf&&a>vf?vf:a}function R(a){return"string"==typeof a?a:a?a.text:null}function S(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function T(){return S(xf,"inner-right")}function U(){return S(Bf,"inner-top")}function V(){return R(xf)}function W(){return R(Bf)}function X(){var a=T();return a.isLeft?0:a.isCenter?me/2:me}function Y(){var a=U();return a.isBottom?-oe:a.isMiddle?-oe/2:0}function Z(){var a=U();return a.isTop?"-0.5em":"0"}function $(){var a=T();return a.isInner?"-0.5em":"3.5em"}function _(){var a=U(),b=0;return g.selectAll(".y.axis .tick text").each(function(){var a=this.getBBox();b0)for(f=Sb(a),b=0;ba?a:0}),c=1;c0||(h[d][b]+=+a)});return g.min(Object.keys(h).map(function(a){return g.min(h[a])}))}function mb(a){var b,c,d,e,f,h=Qb(a);if(Ye.length>0)for(f=Tb(a),b=0;b0?a:0}),c=1;c+a||(h[d][b]+=+a)});return g.max(Object.keys(h).map(function(a){return g.max(h[a])}))}function nb(a){var b,d,e,f,g,h,i,j,k=Pb(function(b){return O(b.id)===a}),l="y2"===a?If:zf,m="y2"===a?Hf:yf,n=c(l)?l:lb(k),o=c(m)?m:mb(k),p="y2"===a?Jf:Af,q=kc()&&pf;return n===o&&(0>n?o=0:n=0),b=Math.abs(o-n),d=e=f=q?0:.1*b,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&Ef&&(e=c(Ef.top)?Ef.top:d,f=c(Ef.bottom)?Ef.bottom:d),"y2"===a&&Mf&&(e=c(Mf.top)?Mf.top:d,f=c(Mf.bottom)?Mf.bottom:d),q&&(h=lc(n,o),i=tb(Ke.range()),j=[h[0]/i,h[1]/i],e+=b*(j[1]/(1-j[0]-j[1])),f+=b*(j[0]/(1-j[0]-j[1]))),Lc(k)&&!Sb(k)&&(f=n),[n-f,o+e]}function ob(a){var b=tb(Pg),c=tb(Je.domain());return a||0===c?1:b/c}function pb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function qb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function rb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return og?d=0:Lc(a)?(c=Lb(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function sb(a){var b=[pb(a),qb(a)],c=b[0],d=b[1],e=rb(a,b),f=ng?new Date(c.getTime()-e):c-e,g=ng?new Date(d.getTime()+e):d+e;return[f,g]}function tb(a){return a[1]-a[0]}function ub(a){for(var b=0;bd?0:d}function zb(a){return Te&&a===Te||Ue&&dd(Ue,a)}function Ab(a){return!zb(a)}function Bb(a){return Te?Te:Ue?Ue[a]:null}function Cb(a,b){return a in Vd.data.x&&Vd.data.x[a]&&Vd.data.x[a][b]?Vd.data.x[a][b]:b}function Db(a){Object.keys(a).forEach(function(b){Ue[b]=a[b]})}function Eb(a){var b;return a&&(b=Xe[a.id],a.name=b?b:a.id),a}function Fb(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):Vd.data.x[Object.keys(Vd.data.x)[0]]}),c=d.map(function(a){var c=We(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Bb(a);return e=ng?_c(b[f]):pg?b[f]?+b[f]:Cb(a,d):d,b.x=e,{x:e,value:null===b[a]||isNaN(b[a])?null:+b[a],id:c}})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),$e&&Jc(Nb(c).filter(function(a){return!(a in _e)}),$e),c.forEach(function(a){vb(a.id_org,a)}),c)}function Ib(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Jb(a){return a>0&&Vd.data.targets[0].values[a-1]?Vd.data.targets[0].values[a-1].x:void 0}function Kb(a){return a1?Vd.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Vd.data.targets[0]:null,a}function Nb(a){return a=d(a)?Vd.data.targets:a,a.map(function(a){return a.id})}function Ob(a){var b,c=Nb();for(b=0;ba})}function Tb(a){return Rb(a,function(a){return a>0})}function Ub(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(rc(a,f))),a[g].x&&(e=e.concat(rc(a,g))),uc(e,b)):sc(a,b,f,g)}function tc(a,b){var c;return c=a.map(function(a){return sc(a.values,b)}),uc(c,b)}function uc(a,b){var c,d;return a.forEach(function(a){var e=ed(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vc(){return bf&&"desc"===bf.toLowerCase()}function wc(){return bf&&"asc"===bf.toLowerCase()}function xc(a){var b=wc(),c=vc();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof bf&&a.sort(bf),a}function yc(a,b){var d,e,f,g,h,i,j,k=a.filter(function(a){return a&&c(a.value)});eg&&0!==k.length&&(Ng.html(hg(a,P(),qc,tg)).style("visibility","hidden").style("display","block"),d=Ng.property("offsetWidth"),e=Ng.property("offsetHeight"),pf?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=Je(k[0].x)+20):(f=q(),g=f+t()+Je(k[0].x)+20,h=g+d,j=f+r()-u(),i=b[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30),Ng.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function zc(){Ng.style("display","none")}function Ac(a){var b=a.filter(function(a){return a&&c(a.value)});eg&&(Mc(Vd.data.targets)||Pc(Vd.data.targets)||Kg.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(pf?"y1":"x1",mc).attr(pf?"y2":"x2",mc))}function Bc(){Kg.select("line.xgrid-focus").style("visibility","hidden")}function Cc(a){return a.x||0===a.x?Je(a.x):null}function Dc(a){return K(a.id)(a.value)}function Ec(){var a,b,c={},e=0;return Pb(Sc).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Ic(a,b){return b?2*a.tickOffset()*.6/b:0}function Jc(a,b){var c=d(a)?Nb():a;"string"==typeof c&&(c=[c]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function xd(a,b,c,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(e(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function yd(b){var c,d,e;if(Og=g.select($d),Og.empty())return void a.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Og.html(""),Vd.data.x={},Vd.data.targets=Hb(b),o(),G(),Je.domain(g.extent(sb(Vd.data.targets))),Ke.domain(nb("y")),Le.domain(nb("y2")),Me.domain(Je.domain()),Ne.domain(Ke.domain()),Oe.domain(Le.domain()),Pg=Je.domain(),Dg.scale(Me),de&&Hg.scale(Je),Ig=g.select($d).append("svg").attr("width",me+je.left+je.right).attr("height",oe+je.top+je.bottom).on("mouseenter",ge).on("mouseleave",he),Jg=Ig.append("defs"),Jg.append("clipPath").attr("id",lg).append("rect").attr("width",me).attr("height",oe),Jg.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",y).attr("height",z),Jg.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-je.left+1).attr("width",A).attr("height",B),Kg=Ig.append("g").attr("transform",zg.main),Lg=hf?Ig.append("g").attr("transform",zg.context):null,Mg=lf?Ig.append("g").attr("transform",zg.legend):null,Ng=g.select($d).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Kg.append("g").attr("class","x axis").attr("clip-path",pf?"":j("xaxis-clip")).attr("transform",zg.x).append("text").attr("class","-axis-x-label").attr("dy",$).style("text-anchor",ab).text(pf?W:V),Kg.append("g").attr("class","y axis").attr("clip-path",pf?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform","rotate(-90)").attr("dx",Z).style("text-anchor",bb).text(pf?V:W),Gf&&Kg.append("g").attr("class","y2 axis").attr("transform",zg.y2),d=Kg.append("g").attr("clip-path",mg).attr("class","grid"),Of&&d.append("g").attr("class","xgrids"),Qf&&d.append("g").attr("class","xgrid-lines"),Wf&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",pf?0:-10).attr("x2",pf?me:-10).attr("y1",pf?-10:je.top).attr("y2",pf?-10:oe),Rf&&d.append("g").attr("class","ygrids"),Sf&&d.append("g").attr("class","ygrid-lines"),Kg.append("g").attr("clip-path",mg).attr("class","regions"),Kg.append("g").attr("clip-path",mg).attr("class","chart"),c=Kg.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",de?pf?"ns-resize":"ew-resize":null),Kg.select(".chart").append("g").attr("class","chart-bars"),Kg.select(".chart").append("g").attr("class","chart-lines"),Kg.select(".chart").append("g").attr("class","chart-arcs").attr("transform",zg.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(cg),Kg.select(".chart").append("g").attr("class","chart-texts"),de&&Kg.insert("rect",fe?null:"g.grid").attr("class","zoom-rect").attr("width",me).attr("height",oe).style("opacity",0).style("cursor",pf?"ns-resize":"ew-resize").call(Hg).on("dblclick.zoom",null),null!==wf&&Dg.extent("function"!=typeof wf?wf:wf(sb())),hf&&(Lg.append("g").attr("clip-path",mg).attr("class","chart"),Lg.select(".chart").append("g").attr("class","chart-bars"),Lg.select(".chart").append("g").attr("class","chart-lines"),Lg.append("g").attr("clip-path",mg).attr("class","x brush").call(Dg).selectAll("rect").attr(pf?"width":"height",pf?ne:pe),Lg.append("g").attr("class","x axis").attr("transform",zg.subx).attr("clip-path",pf?j("yaxis-clip"):"")),lf&&Pd(Vd.data.targets),Kd(Vd.data.targets),Fd({withTransform:!0,withUpdateXDomain:!0}),ig){if(ng&&"string"==typeof jg){for(jg=_c(jg),e=0;e0){d=[];for(var f in Xe)for(c=0;cf&&h>c&&d>i&&j>d):"rect"===this.nodeName&&(c=1*l.attr("x"),d=1*l.attr("y"),e=1*l.attr("width"),k=kd,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(Zd,!n),l.classed(Yd,!m),k(!m,l,a,b))}))}function Dd(a){Pc(Vd.data.targets)||ef&&(qg=a,Kg.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),rg=!0)}function Ed(){Pc(Vd.data.targets)||ef&&(Kg.select(".dragarea").transition().duration(100).style("opacity",0).remove(),Kg.selectAll(".-shape").classed(Zd,!1),rg=!1)}function Fd(a){var b,d,f,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,D,E,F,G,H=Ec(),I=Pc(Vd.data.targets);if(a=e(a)?a:{},u=e(a.withY)?a.withY:!0,v=e(a.withSubchart)?a.withSubchart:!0,w=e(a.withTransition)?a.withTransition:!0,x=e(a.withTransform)?a.withTransform:!1,y=e(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=e(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,F=w?ie:0,G=e(a.durationForExit)?a.durationForExit:F,z&&(Je.domain(g.extent(sb(Vd.data.targets))),Pg=Je.domain(),de&&Hg.scale(Je).updateScaleExtent(),Me.domain(Je.domain()),Dg.scale(Me)),y&&(Je.domain(Dg.empty()?Pg:Dg.extent()),de&&Hg.scale(Je).updateScaleExtent()),Ke.domain(nb("y")),Le.domain(nb("y2")),Kg.select(".x.axis").style("opacity",I?0:1).transition().duration(F).call(pf?Qe:Pe),Kg.select(".y.axis").style("opacity",I?0:1).transition().duration(F).call(pf?Pe:Qe),Kg.select(".y2.axis").style("opacity",I?0:1).transition().call(Re),A=sd(H),D=td(H,!0),E=td(H,!1),Kg.select(".x.axis .-axis-x-label").attr("x",X),Kg.select(".y.axis .-axis-y-label").attr("x",Y).attr("dy",_),Ne.domain(Ke.domain()),Oe.domain(Le.domain()),Ng.style("display","none"),Kg.select("line.xgrid-focus").style("visibility","hidden").attr("y2",oe),Of){if("year"===Pf){d=[];for(var J=sb(),K=J[0].getFullYear(),L=J[1].getFullYear(),M=K;L>=M;M++)d.push(new Date(M+"-01-01 00:00:00"))}else d=Je.ticks(10);b=Kg.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",pf?0:function(a){return Je(a)-Pe.tickOffset()}).attr("x2",pf?me:function(a){return Je(a)-Pe.tickOffset()}).attr("y1",pf?function(a){return Je(a)-Pe.tickOffset()}:je.top).attr("y2",pf?function(a){return Je(a)-Pe.tickOffset()}:oe).style("opacity",function(){return+g.select(this).attr(pf?"y1":"x1")===(pf?oe:0)?0:1}),b.exit().remove()}Qf&&(f=Kg.select(".xgrid-lines").selectAll(".xgrid-line").data(Qf),h=f.enter().append("g").attr("class",function(a){return"xgrid-line xgrid-line-"+(a["class"]?a["class"]:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",pf?"":"rotate(-90)").attr("dx",pf?0:-je.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(F).attr("x1",pf?0:nc).attr("x2",pf?me:nc).attr("y1",pf?nc:je.top).attr("y2",pf?nc:oe).style("opacity",1),f.select("text").transition().duration(F).attr("x",pf?me:0).attr("y",nc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(F).style("opacity",0).remove()),u&&Rf&&(i=Kg.select(".ygrids").selectAll(".ygrid").data(Ke.ticks(Tf)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",pf?Ke:0).attr("x2",pf?Ke:me).attr("y1",pf?0:Ke).attr("y2",pf?oe:Ke),i.exit().remove()),u&&Sf&&(j=Kg.select(".ygrid-lines").selectAll(".ygrid-line").data(Sf),k=j.enter().append("g").attr("class",function(a){return"ygrid-line ygrid-line-"+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",pf?"rotate(-90)":"").attr("dx",pf?0:-je.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",pf?oc:0).attr("x2",pf?oc:me).attr("y1",pf?0:oc).attr("y2",pf?oe:oc).style("opacity",1),j.select("text").transition().duration(F).attr("x",pf?0:me).attr("y",oc).text(function(a){return a.text +}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=Kg.selectAll(".-bars").selectAll(".-bar").data(Xc),m.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return tg(a.id)}).attr("class",dc),m.style("opacity",gc).transition().duration(F).attr("d",A).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=Kg.selectAll(".-texts").selectAll(".-text").data(Zc),o.enter().append("text").attr("class",Vb).attr("text-anchor",function(a){return pf?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return qc(a.value)}),o.style("fill-opacity",hc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",jc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),Kg.selectAll(".-line").style("opacity",gc).transition().duration(F).attr("d",Eg).style("opacity",1),Kg.selectAll(".-area").style("opacity",0).transition().duration(F).attr("d",Fg).style("opacity",Qg),l=Kg.selectAll(".-circles").selectAll(".-circle").data(Yc),l.enter().append("circle").attr("class",cc).style("opacity",0).attr("r",Vf),l.style("opacity",gc).transition().duration(F).style("opacity",ic).attr("cx",pf?Dc:Cc).attr("cy",pf?Cc:Dc),l.exit().remove(),Kg.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b=cb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return fb(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),Kg.selectAll(".chart-arc").select("text").attr("transform",gb).style("opacity",0).transition().duration(F).text(ib).style("opacity",function(a){return Wc(a.data)?1:0}),Kg.select(".chart-arcs-title").style("opacity",Oc(Vd.data.targets)?1:0),hf&&(null!==g.event&&"zoom"===g.event.type&&Dg.extent(Je.orgDomain()).update(),v&&(Lg.select(".x.axis").style("opacity",I?0:1).transition().duration(F).call(Se),Dg.empty()||Dg.extent(Je.orgDomain()).update(),B=sd(H,!0),p=Lg.selectAll(".-bars").selectAll(".-bar").data(Xc),p.enter().append("path").attr("d",B).style("stroke","none").style("fill",function(a){return tg(a.id)}).attr("class",dc),p.style("opacity",gc).transition().duration(F).attr("d",B).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),Lg.selectAll(".-line").style("opacity",gc).transition().duration(F).attr("d",Gg).style("opacity",1))),Kg.selectAll(".selected-circles").filter(function(a){return Sc(a)}).selectAll("circle").remove(),Kg.selectAll(".selected-circle").transition().duration(F).attr("cx",pf?Dc:Cc).attr("cy",pf?Cc:Dc),Ue?(q=Kg.select(".event-rects").selectAll(".event-rect").data([0]),Ad(q.enter()),q.attr("x",0).attr("y",0).attr("width",me).attr("height",oe)):(pg?(t=function(a,b){var c=Jb(b),d=Kb(b);return(Je(d?d:a.x+50)-Je(c?c:a.x-50))/2},s=function(a,b){var c=Jb(b);return(Je(a.x)+Je(c?c:a.x-50))/2}):(t=C(),s=function(a){return Je(a.x)-t/2}),r=Mb(),Kg.select(".event-rects").datum(r?r.values:[]),q=Kg.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),zd(q.enter()),q.attr("class",fc).attr("x",pf?0:s).attr("y",pf?s:0).attr("width",pf?me:t).attr("height",pf?t:oe),q.exit().remove()),n=Kg.select(".regions").selectAll("rect.region").data(dg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",ec).attr("x",pf?0:xb).attr("y",pf?xb:je.top).attr("width",pf?me:yb).attr("height",pf?yb:oe).transition().duration(F).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),lf&&Pd(Vd.data.targets,{withTransition:w}),Nb().forEach(function(a){Rg[a]=!0})}function Gd(){Fd({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Hd(){return"mousemove"===g.event.sourceEvent.type&&Hg.altDomain?(Je.domain(Hg.altDomain),void Hg.scale(Je).updateScaleExtent()):(og&&Je.orgDomain()[0]===Pg[0]&&Je.domain([Pg[0]-1e-10,Je.orgDomain()[1]]),Fd({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(sg=!0)))}function Id(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Jd(a){var b,c;a=e(a)?a:{},b=e(a.withTransition)?a.withTransition:!1,c=e(a.withTransform)?a.withTransform:!1,o(),G(),Dg.scale(Me),de&&Hg.scale(Je),Ig.attr("width",qe).attr("height",re),Ig.select("#"+lg).select("rect").attr("width",me).attr("height",oe),Ig.select("#xaxis-clip").select("rect").attr("width",y),Ig.select(".zoom-rect").attr("width",me).attr("height",oe),n(b),Fd({withTransition:b,withUpdateXDomain:!0,withTransform:c,durationForExit:0})}function Kd(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Kg.select(".chart-texts").selectAll(".chart-text").data(a),j=i.enter().append("g").attr("class",function(a){return"chart-text target target-"+a.id}).style("pointer-events","none"),j.append("g").attr("class",Wb).style("fill",function(a){return tg(a.id)}),e=Kg.select(".chart-bars").selectAll(".chart-bar").data(a),d=e.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none"),d.append("g").attr("class",$b).style("fill",function(a){return tg(a.id)}).style("stroke","none").style("cursor",function(a){return gf(a)?"pointer":null}),c=Kg.select(".chart-lines").selectAll(".chart-line").data(a),b=c.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none"),b.append("path").attr("class",Yb).style("opacity",0).style("stroke",function(a){return tg(a.id)}),b.append("path").attr("class",ac).style("opacity",function(){return Qg=+g.select(this).style("opacity"),0}).style("fill",function(a){return tg(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",Zb).style("fill",function(a){return tg(a.id)}).style("cursor",function(a){return gf(a)?"pointer":null}),a.forEach(function(a){var b=Qd(a.id);Kg.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=Kg.select(".chart-arcs").selectAll(".chart-arc").data(Ae(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",_b).style("opacity",0).style("fill",function(a){return tg(a.data.id)}).style("cursor",function(a){return gf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){jb(a.data.id),Md(a.data.id)}).on("mouseout",function(a){kb(a.data.id),Od()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),hf&&(n=Lg.select(".chart-bars").selectAll(".chart-bar").data(a),m=n.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}),m.append("g").attr("class",$b).style("fill",function(a){return tg(a.id)}),l=Lg.select(".chart-lines").selectAll(".chart-line").data(a),k=l.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}),k.append("path").attr("class",Yb).style("opacity",0).style("stroke",function(a){return tg(a.id)})),lf&&Pd(a),Ig.selectAll(".target").transition().style("opacity",1)}function Ld(a,b){Vd.data.targets.forEach(function(b){for(var c=0;c=d&&(Object.keys(w).forEach(function(a){w[a]=h}),Ag||(p=(te-h*Object.keys(a).length)/2)),i>=e&&(Object.keys(x).forEach(function(a){x[a]=i}),Ag&&(p=(se-i*Object.keys(a).length)/2))):(v[c]=u,u+=j,p=(k-u)/2)}var i,j,k,l,m,n,o,p,q,r=Nb(a),s=4,t=30,u=0,v={},w={},x={};b=d(b)?{}:b,q=e(b.withTransition)?b.withTransition:!0,Ag?(j=function(){return.2*te},m=function(a,b){return p+f(a,b)}):(j=function(a,b){return p+c(a,b)},m=function(){return.2*se}),k=function(a,b){return j(a,b)+14},n=function(a,b){return m(a,b)+9},l=function(a,b){return j(a,b)-4},o=function(a,b){return m(a,b)-7},i=Mg.selectAll(".legend-item").data(r).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){nf(a)}).on("mouseover",function(a){Md(a),Vd.focus(a)}).on("mouseout",function(){Od(),Vd.revert()}),i.append("text").text(function(a){return e(Xe[a])?Xe[a]:a}).each(function(a){h(this,a)}).style("pointer-events","none").attr("x",Ag?k:-200).attr("y",Ag?-200:m),i.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",Ag?l:-200).attr("y",Ag?-200:o).attr("width",function(a){return w[a]}).attr("height",function(a){return x[a]}),i.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return tg(a)}).attr("x",Ag?k:-200).attr("y",Ag?-200:n).attr("width",10).attr("height",10),Mg.selectAll("text").data(r).each(function(a){h(this,a)}).transition().duration(q?250:0).attr("x",k).attr("y",n),Mg.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",l).attr("y",o),Mg.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",j).attr("y",m)}function Qd(a){return a?"-"+a.replace(/\./g,"\\."):""}function Rd(a){return".target"+Qd(a)}function Sd(a){return Ob(a.id)}function Td(a){return"data"in a&&Ob(a.data.id)}function Ud(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}var Vd={data:{}},Wd={},Xd="_expanded_",Yd="_selected_",Zd="_included_",$d=i(["bindto"],"#chart"),_d=i(["size","width"],null),ae=i(["size","height"],null),be=i(["padding","left"],null),ce=i(["padding","right"],null),de=i(["zoom","enabled"],!1),ee=i(["zoom","extent"],null),fe=i(["zoom","privileged"],!1),ge=i(["onenter"],function(){}),he=i(["onleave"],function(){}),ie=i(["transition","duration"],350);h("data","data is required in config");var je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze,Ae,Be,Ce,De,Ee,Fe,Ge,He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se,Te=i(["data","x"],null),Ue=i(["data","xs"],null),Ve=i(["data","x_format"],"%Y-%m-%d"),We=i(["data","id_converter"],function(a){return a}),Xe=i(["data","names"],{}),Ye=i(["data","groups"],[]),Ze=i(["data","axes"],{}),$e=i(["data","type"],null),_e=i(["data","types"],{}),af=i(["data","labels"],{}),bf=i(["data","order"],null),cf=i(["data","regions"],{}),df=i(["data","colors"],{}),ef=i(["data","selection","enabled"],!1),ff=i(["data","selection","grouped"],!1),gf=i(["data","selection","isselectable"],function(){return!0}),hf=i(["subchart","show"],!1),jf=hf?i(["subchart","size","height"],60):0,kf=i(["color","pattern"],null),lf=i(["legend","show"],!0),mf=i(["legend","position"],"bottom"),nf=i(["legend","item","onclick"],function(){}),of=i(["legend","equally"],!1),pf=i(["axis","rotated"],!1),qf=i(["axis","x","type"],"indexed"),rf=i(["axis","x","categories"],[]),sf=i(["axis","x","tick","centered"],!1),tf=i(["axis","x","tick","format"],null),uf=i(["axis","x","tick","culling"],"categorized"===qf?!1:!0),vf=i(["axis","x","tick","count"],10),wf=i(["axis","x","default"],null),xf=i(["axis","x","label"],null),yf=i(["axis","y","max"],null),zf=i(["axis","y","min"],null),Af=i(["axis","y","center"],null),Bf=i(["axis","y","label"],null),Cf=i(["axis","y","inner"],!1),Df=i(["axis","y","tick","format"],null),Ef=i(["axis","y","padding"],null),Ff=i(["axis","y","ticks"],10),Gf=i(["axis","y2","show"],!1),Hf=i(["axis","y2","max"],null),If=i(["axis","y2","min"],null),Jf=i(["axis","y2","center"],null),Kf=i(["axis","y2","inner"],!1),Lf=i(["axis","y2","tick","format"],null),Mf=i(["axis","y2","padding"],null),Nf=i(["axis","y2","ticks"],10),Of=i(["grid","x","show"],!1),Pf=i(["grid","x","type"],"tick"),Qf=i(["grid","x","lines"],null),Rf=i(["grid","y","show"],!1),Sf=i(["grid","y","lines"],null),Tf=i(["grid","y","ticks"],10),Uf=i(["point","show"],!0),Vf=Uf?i(["point","r"],2.5):0,Wf=i(["point","focus","line","enabled"],!0),Xf=i(["point","focus","expand","enabled"],!0),Yf=i(["point","focus","expand","r"],Xf?4:Vf),Zf=i(["point","focus","select","r"],8),$f=i(["point","onclick"],function(){}),_f=i(["point","onselected"],function(){}),ag=i(["point","onunselected"],function(){}),bg=i(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),cg=i(["arc","title"],""),dg=i(["regions"],[]),eg=i(["tooltip","show"],!0),fg=i(["tooltip","format","title"],null),gg=i(["tooltip","format","value"],null),hg=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=fg?fg:b,k=gg?gg:c;for(f=0;f"+g+""),i=a[f].name,h=k(a[f].value),e+=""+i+""+h+"");return e+""}),ig=i(["tooltip","init","show"],!1),jg=i(["tooltip","init","x"],0),kg=i(["tooltip","init","position"],{top:"0px",left:"50px"}),lg=$d.replace("#","")+"-clip",mg=j(lg),ng="timeseries"===qf,og="categorized"===qf,pg=!ng&&(Te||Ue),qg=null,rg=!1,sg=!1,tg=$c(df,kf),ug=function(){var a=[[g.time.format("%Y/%-m/%-d"),function(){return!0}],[g.time.format("%-m/%-d"),function(a){return a.getMonth()}],[g.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[g.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[g.time.format("%I %p"),function(a){return a.getHours()}],[g.time.format("%I:%M"),function(a){return a.getMinutes()}],[g.time.format(":%S"),function(a){return a.getSeconds()}],[g.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),vg=pf?"left":"bottom",wg=pf?Cf?"top":"bottom":Cf?"right":"left",xg=pf?Kf?"bottom":"top":Kf?"left":"right",yg=pf?"left":"bottom",zg={main:function(){return"translate("+je.left+","+je.top+")"},context:function(){return"translate("+ke.left+","+ke.top+")"},legend:function(){return"translate("+le.left+","+le.top+")"},y2:function(){return"translate("+(pf?0:me)+","+(pf?1:0)+")"},x:function(){return"translate(0,"+oe+")"},subx:function(){return"translate(0,"+(pf?0:pe)+")"},arc:function(){return"translate("+me/2+","+oe/2+")"}},Ag="right"===mf,Bg=40,Cg=20;Ae=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Dg,Eg=function(){var a=g.svg.line().x(pf?function(a){return K(a.id)(a.value)}:mc).y(pf?mc:function(a){return K(a.id)(a.value)});return function(b){var c,d,e=ld(b.values);return Qc(b)?(a.interpolate(Rc(b)?"cardinal":"linear"),cf[b.id]?xd(e,Je,K(b.id),cf[b.id]):a(e)):(c=Je(e[0].x),d=K(b.id)(e[0].value),pf?"M "+d+" "+c:"M "+c+" "+d)}}(),Fg=function(){var a;return a=pf?g.svg.area().x0(function(a){return K(a.id)(0)}).x1(function(a){return K(a.id)(a.value)}).y(mc):g.svg.area().x(mc).y0(function(a){return K(a.id)(0)}).y1(function(a){return K(a.id)(a.value)}),function(b){var c,d,e=ld(b.values);return Kc([b],"area")||Kc([b],"area-spline")?(a.interpolate(Rc(b)?"cardinal":"linear"),a(e)):(c=Je(e[0].x),d=K(b.id)(e[0].value),pf?"M "+d+" "+c:"M "+c+" "+d)}}(),Gg=function(){var a=g.svg.line().x(pf?function(a){return L(a.id)(a.value)}:pc).y(pf?pc:function(a){return L(a.id)(a.value)});return function(b){var c=ld(b.values);return Qc(b)?a(c):"M "+Me(c[0].x)+" "+L(b.id)(c[0].value)}}(),Hg=function(){};Dg=g.svg.brush().on("brush",Gd),Dg.update=function(){return Lg&&Lg.select(".x.brush").call(this),this},Dg.scale=function(a){return pf?this.y(a):this.x(a)},de&&(Hg=g.behavior.zoom().on("zoomstart",function(){Hg.altDomain=g.event.sourceEvent.altKey?Je.orgDomain():null}).on("zoom",de?Hd:null),Hg.scale=function(a){return pf?this.y(a):this.x(a)},Hg.orgScaleExtent=function(){var a=ee?ee:[1,10];return[a[0],Math.max(Lb()/a[1],a[1])]},Hg.updateScaleExtent=function(){var a=tb(Je.orgDomain())/tb(Pg),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg={};if(Vd.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Ig.selectAll(Rd(a)),d=c.filter(Sd),e=c.filter(Td);Vd.revert(),Vd.defocus(),b(d.classed("focused",!0)),b(e),Pc(Vd.data.targets)&&jb(a,!0),Md(a)},Vd.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Ig.selectAll(Rd(a)),d=c.filter(Sd),e=c.filter(Td);Vd.revert(),b(d.classed("focused",!1)),b(e),Pc(Vd.data.targets)&&kb(a),Nd(a)},Vd.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Ig.selectAll(Rd(a)),d=c.filter(Sd),e=c.filter(Td);b(d.classed("focused",!1)),b(e),Pc(Vd.data.targets)&&kb(a),Od()},Vd.show=function(a){Ig.selectAll(Rd(a)).transition().style("opacity",1)},Vd.hide=function(a){Ig.selectAll(Rd(a)).transition().style("opacity",0)},Vd.unzoom=function(){Dg.clear().update(),Fd({withUpdateXDomain:!0})},Vd.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&Db(a.xs),"categories"in a&&og&&(rf=a.categories,Pe.categories(rf)),"cacheIds"in a&&ub(a.cacheIds))return void Ld(wb(a.cacheIds),a.done);if("data"in a)Ld(Hb(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){Ld(Hb(c),a.done)});else if("rows"in a)Ld(Hb(Fb(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");Ld(Hb(Gb(a.columns)),a.done)}},Vd.unload=function(a){Vd.data.targets=Vd.data.targets.filter(function(b){return b.id!==a}),Ig.selectAll(Rd(a)).transition().style("opacity",0).remove(),lf&&(Ig.selectAll(".legend-item"+Qd(a)).remove(),Pd(Vd.data.targets)),Vd.data.targets.length>0&&Fd({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},Vd.selected=function(a){var b=Qd(a);return g.merge(Kg.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(Yd)}).map(function(a){return a.map(function(a){return a.__data__})}))},Vd.select=function(a,b,c){ef&&Kg.selectAll(".-shapes").selectAll(".-shape").each(function(f,h){var i="circle"===this.nodeName?fd:id,j="circle"===this.nodeName?gd:jd;b.indexOf(h)>=0?gf(f)&&(ff||d(a)||a.indexOf(f.id)>=0)&&i(g.select(this).classed(Yd,!0),f,h):e(c)&&c&&j(g.select(this).classed(Yd,!1),f,h)})},Vd.unselect=function(a,b){ef&&Kg.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?gd:jd;(d(b)||b.indexOf(e)>=0)&&gf(c)&&(ff||d(a)||a.indexOf(c.id)>=0)&&f(g.select(this).classed(Yd,!1),c,e)})},Vd.toLine=function(a){Jc(a,"line"),Jd({withTransition:!0})},Vd.toSpline=function(a){Jc(a,"spline"),Jd({withTransition:!0})},Vd.toBar=function(a){Jc(a,"bar"),Jd({withTransition:!0})},Vd.toScatter=function(a){Jc(a,"scatter"),Jd({withTransition:!0})},Vd.toArea=function(a){Jc(a,"area"),Jd({withTransition:!0})},Vd.toAreaSpline=function(a){Jc(a,"area-spline"),Jd({withTransition:!0})},Vd.toPie=function(a){Jc(a,"pie"),Jd({withTransition:!0,withTransform:!0})},Vd.toDonut=function(a){Jc(a,"donut"),Jd({withTransition:!0,withTransform:!0})},Vd.groups=function(a){return d(a)?Ye:(Ye=a,Fd(),Ye)},Vd.xgrids=function(a){return a?(Qf=a,Fd(),Qf):Qf},Vd.xgrids.add=function(a){return a?Vd.xgrids(Qf.concat(a)):void 0},Vd.xgrids.remove=function(a){var b=Ud(a);return Vd.xgrids(Qf.filter(b))},Vd.ygrids=function(a){return a?(Sf=a,Fd(),Sf):Sf},Vd.ygrids.add=function(a){return a?Vd.ygrids(Sf.concat(a)):void 0},Vd.ygrids.remove=function(a){var b=Ud(a);return Vd.ygrids(Sf.filter(b))},Vd.regions=function(a){return d(a)?dg:(dg=a,Fd(),dg)},Vd.regions.add=function(a){return d(a)?dg:(dg=dg.concat(a),Fd(),dg)},Vd.regions.remove=function(a,b){var d=[].concat(a);return b=e(b)?b:{},d.forEach(function(a){var d=c(b.duration)?b.duration:0;Ig.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),dg=dg.filter(function(b){return b.classes.indexOf(a)<0})}),dg},Vd.data.get=function(a){var b=Vd.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},Vd.data.getAsTarget=function(a){var b=Pb(function(b){return b.id===a});return b.length>0?b[0]:void 0},Vd.resize=function(a){_d=a?a.width:null,ae=a?a.height:null,Jd()},Vd.destroy=function(){Vd.data.targets=void 0,Vd.data.x={},Og.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){yd(b)});else if("rows"in f.data)yd(Fb(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");yd(Gb(f.data.columns))}return Vd}}(window); \ No newline at end of file