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