From 04deae3c7a11d49ce4cafd777882d899a3e11e18 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 17 Mar 2014 23:06:08 +0900 Subject: [PATCH] Fix update legend logic --- c3.js | 38 +++++++++++++++++++++++--------------- c3.min.js | 4 ++-- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/c3.js b/c3.js index 006ff4c..ae3ec36 100644 --- a/c3.js +++ b/c3.js @@ -388,7 +388,7 @@ //-- Scales --// function updateScales() { - var xAxisTickFormat, xAxisTicks; + var xAxisTickFormat, xAxisTicks, forInit = !x; // update edges xMin = __axis_rotated ? 1 : 0; xMax = __axis_rotated ? height : width; @@ -399,7 +399,7 @@ subYMin = __axis_rotated ? 0 : height2; subYMax = __axis_rotated ? width2 : 1; // update scales - x = getX(xMin, xMax, x ? x.domain() : undefined, function () { return xAxis.tickOffset(); }); + x = getX(xMin, xMax, forInit ? undefined : x.domain(), function () { return xAxis.tickOffset(); }); y = getY(yMin, yMax); y2 = getY(yMin, yMax); subX = getX(xMin, xMax, orgXDomain, function (d) { return d % 1 ? 0 : subXAxis.tickOffset(); }); @@ -412,6 +412,11 @@ subXAxis = getXAxis(subX, subXOrient, xAxisTickFormat, xAxisTicks); yAxis = getYAxis(y, yOrient, __axis_y_tick_format, __axis_y_ticks); yAxis2 = getYAxis(y2, y2Orient, __axis_y2_tick_format, __axis_y2_ticks); + // Set initialized scales to brush and zoom + if (!forInit) { + brush.scale(subX); + if (__zoom_enabled) { zoom.scale(x); } + } // update for arc updateArc(); } @@ -2292,10 +2297,9 @@ duration = withTransition ? __transition_duration : 0; durationForExit = isDefined(options.durationForExit) ? options.durationForExit : duration; - // update legend + // update legend and transform each g if (withLegend && __legend_show) { updateLegend(c3.data.targets, options); - return; // updateAndRedraw() will be called again in updateLegend() } if (withUpdateOrgXDomain) { @@ -2695,6 +2699,14 @@ }; return callResizeFunctions; } + + function updateSvgSize() { + svg.attr('width', currentWidth).attr('height', currentHeight); + svg.select('#' + clipId).select('rect').attr('width', width).attr('height', height); + svg.select('#xaxis-clip').select('rect').attr('width', getXAxisClipWidth); + svg.select('.zoom-rect').attr('width', width).attr('height', height); + } + function updateAndRedraw(options) { var withTransition, withTransform, withLegend; options = isDefined(options) ? options : {}; @@ -2704,15 +2716,7 @@ // Update sizes and scales updateSizes(); updateScales(); - // Set x for brush again because of scale update - brush.scale(subX); - // Set x for zoom again because of scale update - if (__zoom_enabled) { zoom.scale(x); } - // Update sizes - svg.attr('width', currentWidth).attr('height', currentHeight); - svg.select('#' + clipId).select('rect').attr('width', width).attr('height', height); - svg.select('#xaxis-clip').select('rect').attr('width', getXAxisClipWidth); - svg.select('.zoom-rect').attr('width', width).attr('height', height); + updateSvgSize(); // Update g positions transformAll(withTransition); // Draw with new sizes & scales @@ -3045,8 +3049,12 @@ updateLegendItemWidth(maxWidth); updateLegendItemHeight(maxHeight); updateLegndStep(step); - options.withLegend = false; - updateAndRedraw(options); + // Update size and scale + updateSizes(); + updateScales(); + updateSvgSize(); + // Update g positions + transformAll(false); } /*-- Event Handling --*/ diff --git a/c3.min.js b/c3.min.js index 6bfcbc5..ac29f0c 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 t(){return Tc(Zd.data.targets)?0:fe?fe:Hf?1:v("y")}function u(){return Tc(Zd.data.targets)?0:ge?ge:Gg?xe*(Lf&&!uf?1.25:1):Lf?Pf||uf?1:v("y2"):1}function v(){var a=X();return a.isInner?40:60}function w(){return+g.select(ce).style("width").replace("px","")}function x(){return+g.select(ce).style("height").replace("px","")}function y(){return qe+2}function z(){return 80}function A(){return ne.left+20}function B(){return se+2}function C(){var a=uf?se:qe,b=rb(),c=Ob();return c>1?a*b/(c-1):a}function D(a){Hg=a}function E(a){Ig=a}function F(a){Jg=a}function G(){return qf?Gg?Ig*(Hg+1):ue:0}function H(){return qf?Gg?ve:Jg*(Hg+1):0}function I(){var a=W();return a.isInner?5:20}function J(){var a,b;Fe=uf?1:0,Ge=uf?se:qe,He=uf?0:se,Ie=uf?qe:1,Je=Fe,Ke=Ge,Le=uf?0:te,Me=uf?re:1,Ne=L(Fe,Ge,Ne?Ne.domain():void 0,function(){return Te.tickOffset()}),Oe=M(He,Ie),Pe=M(He,Ie),Qe=L(Fe,Ge,Yg,function(a){return a%1?0:We.tickOffset()}),Re=M(Le,Me),Se=M(Le,Me),a=S(),b=T(),Te=P(Ne,Bg,a,b),We=P(Qe,Eg,a,b),Ue=Q(Oe,Cg,If,Kf),Ve=Q(Pe,Dg,Qf,Sf),K()}function K(){Be=gb(),Ce=hb(),De=hb(.98)}function L(a,b,c,f){var h=(tg?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}),ug){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 M(a,b){return g.scale.linear().range([a,b])}function N(a){return"y2"===R(a)?Pe:Oe}function O(a){return"y2"===R(a)?Se:Re}function P(a,c,d,e){var f=(ug?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),ug?f.tickCentered(xf):f.tickOffset=function(){var a=uf?se:qe;return a*rb()/Ob()/2},ug&&f.categories(wf),f}function Q(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function R(a){return a in bf?bf[a]:"y"}function S(){var a=tg?Ag:ug?Xb:null;return yf&&("function"==typeof yf?a=yf:tg&&(a=function(a){return g.time.format(yf)(a)})),a}function T(){var a=Ob();return zf&&a>Af?Af:a}function U(a){return"string"==typeof a?a:a?a.text:null}function V(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 W(){return V(Cf,"inner-right")}function X(){return V(Gf,"inner-top")}function Y(){return U(Cf)}function Z(){return U(Gf)}function $(){var a=W();return a.isLeft?0:a.isCenter?qe/2:qe}function _(){var a=X();return a.isBottom?-se:a.isMiddle?-se/2:0}function ab(){var a=X();return a.isTop?"-0.5em":"0"}function bb(){var a=W();return a.isInner?"-0.5em":"3.5em"}function cb(){var a=X(),b=0;return g.selectAll(".y.axis .tick text").each(function(){var a=this.getBBox();b0)for(f=Vb(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 pb(a){var b,c,d,e,f,h=Tb(a);if(af.length>0)for(f=Wb(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 qb(a){var b,d,e,f,g,h,i,j,k=Sb(function(b){return R(b.id)===a}),l="y2"===a?Nf:Ef,m="y2"===a?Mf:Df,n=c(l)?l:ob(k),o=c(m)?m:pb(k),p="y2"===a?Of:Ff,q=nc()&&uf;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&&Jf&&(e=c(Jf.top)?Jf.top:d,f=c(Jf.bottom)?Jf.bottom:d),"y2"===a&&Rf&&(e=c(Rf.top)?Rf.top:d,f=c(Rf.bottom)?Rf.bottom:d),q&&(h=oc(n,o),i=wb(Oe.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]))),Pc(k)&&!Vb(k)&&(f=n),[n-f,o+e]}function rb(a){var b=wb(Yg),c=wb(Ne.domain());return a||0===c?1:b/c}function sb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function tb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ug?d=0:Pc(a)?(c=Ob(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function vb(a){var b=[sb(a),tb(a)],c=b[0],d=b[1],e=ub(a,b),f=tg?new Date(c.getTime()-e):c-e,g=tg?new Date(d.getTime()+e):d+e;return[f,g]}function wb(a){return a[1]-a[0]}function xb(a){for(var b=0;bd?0:d}function Cb(a){return Xe&&a===Xe||Ye&&hd(Ye,a)}function Db(a){return!Cb(a)}function Eb(a){return Xe?Xe:Ye?Ye[a]:null}function Fb(a,b){return a in Zd.data.x&&Zd.data.x[a]&&Zd.data.x[a][b]?Zd.data.x[a][b]:b}function Gb(a){Object.keys(a).forEach(function(b){Ye[b]=a[b]})}function Hb(a){var b;return a&&(b=_e[a.id],a.name=b?b:a.id),a}function Ib(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):Zd.data.x[Object.keys(Zd.data.x)[0]]}),c=d.map(function(a){var c=$e(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Eb(a);return e=tg?dd(b[f]):vg?b[f]?+b[f]:Fb(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++})}),cf&&Nc(Qb(c).filter(function(a){return!(a in df)}),cf),c.forEach(function(a){yb(a.id_org,a)}),c)}function Lb(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 Mb(a){return a>0&&Zd.data.targets[0].values[a-1]?Zd.data.targets[0].values[a-1].x:void 0}function Nb(a){return a1?Zd.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Zd.data.targets[0]:null,a}function Qb(a){return a=d(a)?Zd.data.targets:a,a.map(function(a){return a.id})}function Rb(a){var b,c=Qb();for(b=0;ba})}function Wb(a){return Ub(a,function(a){return a>0})}function Xb(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(vc(a,f))),a[g].x&&(e=e.concat(vc(a,g))),yc(e,b)):wc(a,b,f,g)}function xc(a,b){var c;return c=a.map(function(a){return wc(a.values,b)}),yc(c,b)}function yc(a,b){var c,d;return a.forEach(function(a){var e=id(a,b);(c>e||!c)&&(c=e,d=a)}),d}function zc(){return ff&&"desc"===ff.toLowerCase()}function Ac(){return ff&&"asc"===ff.toLowerCase()}function Bc(a){var b=Ac(),c=zc();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 ff&&a.sort(ff),a}function Cc(a,b){var d,e,f,g,h,i,j,k=Tc(Zd.data.targets),l=k?uc:tc,m=a.filter(function(a){return a&&c(a.value)});kg&&0!==m.length&&(Wg.html(ng(a,S(),l,zg)).style("visibility","hidden").style("display","block"),d=Wg.property("offsetWidth"),e=Wg.property("offsetHeight"),k?(g=qe/2+b[0],i=se/2+b[1]+20):(uf?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=Ne(m[0].x)+20):(f=q(),g=f+t()+Ne(m[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)),Wg.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function Dc(){Wg.style("display","none")}function Ec(a){var b=a.filter(function(a){return a&&c(a.value)});kg&&(Qc(Zd.data.targets)||Tc(Zd.data.targets)||Tg.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(uf?"y1":"x1",pc).attr(uf?"y2":"x2",pc))}function Fc(){Tg.select("line.xgrid-focus").style("visibility","hidden")}function Gc(a){return a.x||0===a.x?Ne(a.x):null}function Hc(a){return N(a.id)(a.value)}function Ic(){var a,b,c={},e=0;return Sb(Wc).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Mc(a,b){return b?2*a.tickOffset()*.6/b:0}function Nc(a,b){var c=d(a)?Qb():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 Bd(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 Cd(b){var c,d,e;if(Xg=g.select(ce),Xg.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(Xg.html(""),Zd.data.x={},Zd.data.targets=Kb(b),o(),J(),Ne.domain(g.extent(vb(Zd.data.targets))),Oe.domain(qb("y")),Pe.domain(qb("y2")),Qe.domain(Ne.domain()),Re.domain(Oe.domain()),Se.domain(Pe.domain()),Yg=Ne.domain(),Mg.scale(Qe),he&&Qg.scale(Ne),Rg=g.select(ce).append("svg").attr("width",qe+ne.left+ne.right).attr("height",se+ne.top+ne.bottom).on("mouseenter",ke).on("mouseleave",le),Sg=Rg.append("defs"),Sg.append("clipPath").attr("id",rg).append("rect").attr("width",qe).attr("height",se),Sg.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",y).attr("height",z),Sg.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-ne.left+1).attr("width",A).attr("height",B),Tg=Rg.append("g").attr("transform",Fg.main),Ug=nf?Rg.append("g").attr("transform",Fg.context):null,Vg=qf?Rg.append("g").attr("transform",Fg.legend):null,Wg=g.select(ce).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Tg.append("g").attr("class","x axis").attr("clip-path",uf?"":j("xaxis-clip")).attr("transform",Fg.x).append("text").attr("class","-axis-x-label").attr("dy",bb).style("text-anchor",db).text(uf?Z:Y),Tg.append("g").attr("class","y axis").attr("clip-path",uf?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform","rotate(-90)").attr("dx",ab).style("text-anchor",eb).text(uf?Y:Z),Lf&&Tg.append("g").attr("class","y2 axis").attr("transform",Fg.y2),d=Tg.append("g").attr("clip-path",sg).attr("class","grid"),Tf&&d.append("g").attr("class","xgrids"),Vf&&d.append("g").attr("class","xgrid-lines"),_f&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",uf?0:-10).attr("x2",uf?qe:-10).attr("y1",uf?-10:ne.top).attr("y2",uf?-10:se),Wf&&d.append("g").attr("class","ygrids"),Xf&&d.append("g").attr("class","ygrid-lines"),Tg.append("g").attr("clip-path",sg).attr("class","regions"),Tg.append("g").attr("clip-path",sg).attr("class","chart"),c=Tg.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",he?uf?"ns-resize":"ew-resize":null),Tg.select(".chart").append("g").attr("class","chart-bars"),Tg.select(".chart").append("g").attr("class","chart-lines"),Tg.select(".chart").append("g").attr("class","chart-arcs").attr("transform",Fg.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(ig),Tg.select(".chart").append("g").attr("class","chart-texts"),he&&Tg.insert("rect",je?null:"g.grid").attr("class","zoom-rect").attr("width",qe).attr("height",se).style("opacity",0).style("cursor",uf?"ns-resize":"ew-resize").call(Qg).on("dblclick.zoom",null),null!==Bf&&Mg.extent("function"!=typeof Bf?Bf:Bf(vb())),nf&&(Ug.append("g").attr("clip-path",sg).attr("class","chart"),Ug.select(".chart").append("g").attr("class","chart-bars"),Ug.select(".chart").append("g").attr("class","chart-lines"),Ug.append("g").attr("clip-path",sg).attr("class","x brush").call(Mg).selectAll("rect").attr(uf?"width":"height",uf?re:te),Ug.append("g").attr("class","x axis").attr("transform",Fg.subx).attr("clip-path",uf?j("yaxis-clip"):"")),Od(Zd.data.targets),Jd({withTransform:!0,withUpdateXDomain:!0,withLegend:!0}),og){if(tg&&"string"==typeof pg){for(pg=dd(pg),e=0;e0){d=[];for(var f in _e)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=od,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(be,!n),l.classed(ae,!m),k(!m,l,a,b))}))}function Hd(a){Tc(Zd.data.targets)||jf&&(wg=a,Tg.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),xg=!0)}function Id(){Tc(Zd.data.targets)||jf&&(Tg.select(".dragarea").transition().duration(100).style("opacity",0).remove(),Tg.selectAll(".-shape").classed(be,!1),xg=!1)}function Jd(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,I=Ic(),J=Tc(Zd.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,A=e(a.withLegend)?a.withLegend:!1,G=w?me:0,H=e(a.durationForExit)?a.durationForExit:G,A&&qf)return void Td(Zd.data.targets,a);if(z&&(Ne.domain(g.extent(vb(Zd.data.targets))),Yg=Ne.domain(),he&&Qg.scale(Ne).updateScaleExtent(),Qe.domain(Ne.domain()),Mg.scale(Qe)),y&&(Ne.domain(Mg.empty()?Yg:Mg.extent()),he&&Qg.scale(Ne).updateScaleExtent()),Oe.domain(qb("y")),Pe.domain(qb("y2")),Tg.select(".x.axis").style("opacity",J?0:1).transition().duration(G).call(uf?Ue:Te),Tg.select(".y.axis").style("opacity",J?0:1).transition().duration(G).call(uf?Te:Ue),Tg.select(".y2.axis").style("opacity",J?0:1).transition().call(Ve),B=wd(I),E=xd(I,!0),F=xd(I,!1),Tg.select(".x.axis .-axis-x-label").attr("x",$),Tg.select(".y.axis .-axis-y-label").attr("x",_).attr("dy",cb),Re.domain(Oe.domain()),Se.domain(Pe.domain()),Wg.style("display","none"),Tg.select("line.xgrid-focus").style("visibility","hidden").attr("y2",se),Tf){if("year"===Uf){d=[];for(var K=vb(),L=K[0].getFullYear(),M=K[1].getFullYear(),N=L;M>=N;N++)d.push(new Date(N+"-01-01 00:00:00"))}else d=Ne.ticks(10);b=Tg.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",uf?0:function(a){return Ne(a)-Te.tickOffset()}).attr("x2",uf?qe:function(a){return Ne(a)-Te.tickOffset()}).attr("y1",uf?function(a){return Ne(a)-Te.tickOffset()}:ne.top).attr("y2",uf?function(a){return Ne(a)-Te.tickOffset()}:se).style("opacity",function(){return+g.select(this).attr(uf?"y1":"x1")===(uf?se:0)?0:1}),b.exit().remove()}Vf&&(f=Tg.select(".xgrid-lines").selectAll(".xgrid-line").data(Vf),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",uf?"":"rotate(-90)").attr("dx",uf?0:-ne.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(G).attr("x1",uf?0:qc).attr("x2",uf?qe:qc).attr("y1",uf?qc:ne.top).attr("y2",uf?qc:se).style("opacity",1),f.select("text").transition().duration(G).attr("x",uf?qe:0).attr("y",qc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(G).style("opacity",0).remove()),u&&Wf&&(i=Tg.select(".ygrids").selectAll(".ygrid").data(Oe.ticks(Yf)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",uf?Oe:0).attr("x2",uf?Oe:qe).attr("y1",uf?0:Oe).attr("y2",uf?se:Oe),i.exit().remove()),u&&Xf&&(j=Tg.select(".ygrid-lines").selectAll(".ygrid-line").data(Xf),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",uf?"rotate(-90)":"").attr("dx",uf?0:-ne.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(G).attr("x1",uf?rc:0).attr("x2",uf?rc:qe).attr("y1",uf?0:rc).attr("y2",uf?se:rc).style("opacity",1),j.select("text").transition().duration(G).attr("x",uf?0:qe).attr("y",rc).text(function(a){return a.text -}).style("opacity",1),j.exit().transition().duration(G).style("opacity",0).remove()),m=Tg.selectAll(".-bars").selectAll(".-bar").data(_c),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return zg(a.id)}).attr("class",gc),m.style("opacity",jc).transition().duration(G).attr("d",B).style("opacity",1),m.exit().transition().duration(H).style("opacity",0).remove(),o=Tg.selectAll(".-texts").selectAll(".-text").data(bd),o.enter().append("text").attr("class",Yb).attr("text-anchor",function(a){return uf?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return tc(a.value)}),o.style("fill-opacity",kc).transition().duration(G).attr("x",E).attr("y",F).style("fill-opacity",mc),o.exit().transition().duration(H).style("fill-opacity",0).remove(),Tg.selectAll(".-line").style("opacity",jc).transition().duration(G).attr("d",Ng).style("opacity",1),Tg.selectAll(".-area").style("opacity",0).transition().duration(G).attr("d",Og).style("opacity",Zg),l=Tg.selectAll(".-circles").selectAll(".-circle").data(ad),l.enter().append("circle").attr("class",fc).style("opacity",0).attr("r",$f),l.style("opacity",jc).transition().duration(G).style("opacity",lc).attr("cx",uf?Hc:Gc).attr("cy",uf?Gc:Hc),l.exit().remove(),Tg.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(G).attrTween("d",function(a){var b=fb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return ib(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),Tg.selectAll(".chart-arc").select("text").attr("transform",jb).style("opacity",0).transition().duration(G).text(lb).style("opacity",function(a){return $c(a.data)?1:0}),Tg.select(".chart-arcs-title").style("opacity",Sc(Zd.data.targets)?1:0),nf&&(null!==g.event&&"zoom"===g.event.type&&Mg.extent(Ne.orgDomain()).update(),v&&(Ug.select(".x.axis").style("opacity",J?0:1).transition().duration(G).call(We),Mg.empty()||Mg.extent(Ne.orgDomain()).update(),D=wd(I,!0),p=Ug.selectAll(".-bars").selectAll(".-bar").data(_c),p.enter().append("path").attr("d",D).style("stroke","none").style("fill",function(a){return zg(a.id)}).attr("class",gc),p.style("opacity",jc).transition().duration(G).attr("d",D).style("opacity",1),p.exit().transition().duration(G).style("opacity",0).remove(),Ug.selectAll(".-line").style("opacity",jc).transition().duration(G).attr("d",Pg).style("opacity",1))),Tg.selectAll(".selected-circles").filter(function(a){return Wc(a)}).selectAll("circle").remove(),Tg.selectAll(".selected-circle").transition().duration(G).attr("cx",uf?Hc:Gc).attr("cy",uf?Gc:Hc),Ye?(q=Tg.select(".event-rects").selectAll(".event-rect").data([0]),Ed(q.enter()),q.attr("x",0).attr("y",0).attr("width",qe).attr("height",se)):(vg?(t=function(a,b){var c=Mb(b),d=Nb(b);return(Ne(d?d:a.x+50)-Ne(c?c:a.x-50))/2},s=function(a,b){var c=Mb(b);return(Ne(a.x)+Ne(c?c:a.x-50))/2}):(t=C(),s=function(a){return Ne(a.x)-t/2}),r=Pb(),Tg.select(".event-rects").datum(r?r.values:[]),q=Tg.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Dd(q.enter()),q.attr("class",ic).attr("x",uf?0:s).attr("y",uf?s:0).attr("width",uf?qe:t).attr("height",uf?t:se),q.exit().remove()),n=Tg.select(".regions").selectAll("rect.region").data(jg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",hc).attr("x",uf?0:Ab).attr("y",uf?Ab:ne.top).attr("width",uf?qe:Bb).attr("height",uf?Bb:se).transition().duration(G).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(G).style("fill-opacity",0).remove(),Qb().forEach(function(a){$g[a]=!0})}function Kd(){Jd({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ld(){return"mousemove"===g.event.sourceEvent.type&&Qg.altDomain?(Ne.domain(Qg.altDomain),void Qg.scale(Ne).updateScaleExtent()):(ug&&Ne.orgDomain()[0]===Yg[0]&&Ne.domain([Yg[0]-1e-10,Ne.orgDomain()[1]]),Jd({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(yg=!0)))}function Md(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Nd(a){var b,c,d;a=e(a)?a:{},b=e(a.withTransition)?a.withTransition:!0,c=e(a.withTransform)?a.withTransform:!1,d=e(a.withLegend)?a.withLegend:!1,o(),J(),Mg.scale(Qe),he&&Qg.scale(Ne),Rg.attr("width",ue).attr("height",ve),Rg.select("#"+rg).select("rect").attr("width",qe).attr("height",se),Rg.select("#xaxis-clip").select("rect").attr("width",y),Rg.select(".zoom-rect").attr("width",qe).attr("height",se),n(b),Jd({withTransition:b,withUpdateXDomain:!0,withTransform:c,durationForExit:0,withLegend:d})}function Od(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Tg.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",Zb).style("fill",function(a){return zg(a.id)}),e=Tg.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",bc).style("fill",function(a){return zg(a.id)}).style("stroke","none").style("cursor",function(a){return lf(a)?"pointer":null}),c=Tg.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",_b).style("opacity",0).style("stroke",function(a){return zg(a.id)}),b.append("path").attr("class",dc).style("opacity",function(){return Zg=+g.select(this).style("opacity"),0}).style("fill",function(a){return zg(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",ac).style("fill",function(a){return zg(a.id)}).style("cursor",function(a){return lf(a)?"pointer":null}),a.forEach(function(a){var b=Ud(a.id);Tg.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=Tg.select(".chart-arcs").selectAll(".chart-arc").data(Ee(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",cc).style("opacity",0).style("fill",function(a){return zg(a.data.id)}).style("cursor",function(a){return lf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){mb(a.data.id),Qd(a.data.id)}).on("mousemove",function(a){var b=[Hb({id:a.data.id,value:a.value,ratio:kb(a)})];Cc(b,g.mouse(this))}).on("mouseout",function(a){nb(a.data.id),Sd(),Dc()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nf&&(n=Ug.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",bc).style("fill",function(a){return zg(a.id)}),l=Ug.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",_b).style("opacity",0).style("stroke",function(a){return zg(a.id)})),Rg.selectAll(".target").transition().style("opacity",1)}function Pd(a,b){Zd.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,t=0,z++)),y[a]=z,x[z]=e,u[a]=t,t+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+r)/10),i=10*Math.ceil((g.height+q)/10),j=Gg?i:h,k=Gg?we:xe;c&&(t=0,z=0,m=0,n=0),v[b]=h,w[b]=i,(!m||h>=m)&&(m=h),(!n||i>=n)&&(n=i),f=Gg?n:m,tf?(Object.keys(v).forEach(function(a){v[a]=m}),Object.keys(w).forEach(function(a){w[a]=n}),e=(k-f*p.length)/2,s>e?(t=0,z=0,p.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,l,m,n,o,p=Qb(a),q=4,r=26,s=10,t=0,u={},v={},w={},x={},y={},z=0;b=d(b)?{}:b,o=e(b.withTransition)?b.withTransition:!0,Gg?(g=function(a){return m*(.2+y[a])},j=function(a){return x[y[a]]+u[a]}):(g=function(a){return x[y[a]]+u[a]},j=function(a){return n*(.2+y[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},f=Vg.selectAll(".legend-item").data(p).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){sf(a)}).on("mouseover",function(a){Qd(a),Zd.focus(a)}).on("mouseout",function(){Sd(),Zd.revert()}),f.append("text").text(function(a){return e(_e[a])?_e[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gg?h:-200).attr("y",Gg?-200:k),f.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",Gg?i:-200).attr("y",Gg?-200:l).attr("width",function(a){return v[a]}).attr("height",function(a){return w[a]}),f.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return zg(a)}).attr("x",Gg?h:-200).attr("y",Gg?-200:j).attr("width",10).attr("height",10),Vg.selectAll("text").data(p).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",h).attr("y",k),Vg.selectAll("rect.legend-item-event").data(p).transition().duration(o?250:0).attr("x",i).attr("y",l),Vg.selectAll("rect.legend-item-tile").data(p).transition().duration(o?250:0).attr("x",g).attr("y",j),E(m),F(n),D(z),b.withLegend=!1,Nd(b)}function Ud(a){return a?"-"+a.replace(/\./g,"\\."):""}function Vd(a){return".target"+Ud(a)}function Wd(a){return Rb(a.id)}function Xd(a){return"data"in a&&Rb(a.data.id)}function Yd(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 Zd={data:{}},$d={},_d="_expanded_",ae="_selected_",be="_included_",ce=i(["bindto"],"#chart"),de=i(["size","width"],null),ee=i(["size","height"],null),fe=i(["padding","left"],null),ge=i(["padding","right"],null),he=i(["zoom","enabled"],!1),ie=i(["zoom","extent"],null),je=i(["zoom","privileged"],!1),ke=i(["onenter"],function(){}),le=i(["onleave"],function(){}),me=i(["transition","duration"],350);h("data","data is required in config");var 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,Ue,Ve,We,Xe=i(["data","x"],null),Ye=i(["data","xs"],null),Ze=i(["data","x_format"],"%Y-%m-%d"),$e=i(["data","id_converter"],function(a){return a}),_e=i(["data","names"],{}),af=i(["data","groups"],[]),bf=i(["data","axes"],{}),cf=i(["data","type"],null),df=i(["data","types"],{}),ef=i(["data","labels"],{}),ff=i(["data","order"],null),gf=i(["data","regions"],{}),hf=i(["data","colors"],{}),jf=i(["data","selection","enabled"],!1),kf=i(["data","selection","grouped"],!1),lf=i(["data","selection","isselectable"],function(){return!0}),mf=i(["data","selection","multiple"],!0),nf=i(["subchart","show"],!1),of=nf?i(["subchart","size","height"],60):0,pf=i(["color","pattern"],null),qf=i(["legend","show"],!0),rf=i(["legend","position"],"bottom"),sf=i(["legend","item","onclick"],function(){}),tf=i(["legend","equally"],!1),uf=i(["axis","rotated"],!1),vf=i(["axis","x","type"],"indexed"),wf=i(["axis","x","categories"],[]),xf=i(["axis","x","tick","centered"],!1),yf=i(["axis","x","tick","format"],null),zf=i(["axis","x","tick","culling"],"categorized"===vf?!1:!0),Af=i(["axis","x","tick","count"],10),Bf=i(["axis","x","default"],null),Cf=i(["axis","x","label"],null),Df=i(["axis","y","max"],null),Ef=i(["axis","y","min"],null),Ff=i(["axis","y","center"],null),Gf=i(["axis","y","label"],null),Hf=i(["axis","y","inner"],!1),If=i(["axis","y","tick","format"],null),Jf=i(["axis","y","padding"],null),Kf=i(["axis","y","ticks"],10),Lf=i(["axis","y2","show"],!1),Mf=i(["axis","y2","max"],null),Nf=i(["axis","y2","min"],null),Of=i(["axis","y2","center"],null),Pf=i(["axis","y2","inner"],!1),Qf=i(["axis","y2","tick","format"],null),Rf=i(["axis","y2","padding"],null),Sf=i(["axis","y2","ticks"],10),Tf=i(["grid","x","show"],!1),Uf=i(["grid","x","type"],"tick"),Vf=i(["grid","x","lines"],null),Wf=i(["grid","y","show"],!1),Xf=i(["grid","y","lines"],null),Yf=i(["grid","y","ticks"],10),Zf=i(["point","show"],!0),$f=Zf?i(["point","r"],2.5):0,_f=i(["point","focus","line","enabled"],!0),ag=i(["point","focus","expand","enabled"],!0),bg=i(["point","focus","expand","r"],ag?4:$f),cg=i(["point","focus","select","r"],8),dg=i(["point","onclick"],function(){}),eg=i(["point","onselected"],function(){}),fg=i(["point","onunselected"],function(){}),gg=i(["arc","label","show"],!0),hg=i(["arc","label","format"],null),ig=i(["arc","title"],""),jg=i(["regions"],[]),kg=i(["tooltip","show"],!0),lg=i(["tooltip","format","title"],null),mg=i(["tooltip","format","value"],null),ng=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=lg?lg:b,k=mg?mg:c;for(f=0;f"+(g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+=""+i+""+h+"");return e+""}),og=i(["tooltip","init","show"],!1),pg=i(["tooltip","init","x"],0),qg=i(["tooltip","init","position"],{top:"0px",left:"50px"}),rg=ce.replace("#","")+"-clip",sg=j(rg),tg="timeseries"===vf,ug="categorized"===vf,vg=!tg&&(Xe||Ye),wg=null,xg=!1,yg=!1,zg=cd(hf,pf),Ag=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)}}(),Bg=uf?"left":"bottom",Cg=uf?Hf?"top":"bottom":Hf?"right":"left",Dg=uf?Pf?"bottom":"top":Pf?"left":"right",Eg=uf?"left":"bottom",Fg={main:function(){return"translate("+ne.left+","+ne.top+")"},context:function(){return"translate("+oe.left+","+oe.top+")"},legend:function(){return"translate("+pe.left+","+pe.top+")"},y2:function(){return"translate("+(uf?0:qe)+","+(uf?1:0)+")"},x:function(){return"translate(0,"+se+")"},subx:function(){return"translate(0,"+(uf?0:te)+")"},arc:function(){return"translate("+qe/2+","+se/2+")"}},Gg="right"===rf,Hg=0,Ig=0,Jg=0,Kg=40,Lg=20;Ee=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Mg,Ng=function(){var a=g.svg.line().x(uf?function(a){return N(a.id)(a.value)}:pc).y(uf?pc:function(a){return N(a.id)(a.value)});return function(b){var c,d,e=pd(b.values);return Uc(b)?(a.interpolate(Vc(b)?"cardinal":"linear"),gf[b.id]?Bd(e,Ne,N(b.id),gf[b.id]):a(e)):(c=Ne(e[0].x),d=N(b.id)(e[0].value),uf?"M "+d+" "+c:"M "+c+" "+d)}}(),Og=function(){var a;return a=uf?g.svg.area().x0(function(a){return N(a.id)(0)}).x1(function(a){return N(a.id)(a.value)}).y(pc):g.svg.area().x(pc).y0(function(a){return N(a.id)(0)}).y1(function(a){return N(a.id)(a.value)}),function(b){var c,d,e=pd(b.values);return Oc([b],"area")||Oc([b],"area-spline")?(a.interpolate(Vc(b)?"cardinal":"linear"),a(e)):(c=Ne(e[0].x),d=N(b.id)(e[0].value),uf?"M "+d+" "+c:"M "+c+" "+d)}}(),Pg=function(){var a=g.svg.line().x(uf?function(a){return O(a.id)(a.value)}:sc).y(uf?sc:function(a){return O(a.id)(a.value)});return function(b){var c=pd(b.values);return Uc(b)?a(c):"M "+Qe(c[0].x)+" "+O(b.id)(c[0].value)}}(),Qg=function(){};Mg=g.svg.brush().on("brush",Kd),Mg.update=function(){return Ug&&Ug.select(".x.brush").call(this),this},Mg.scale=function(a){return uf?this.y(a):this.x(a)},he&&(Qg=g.behavior.zoom().on("zoomstart",function(){Qg.altDomain=g.event.sourceEvent.altKey?Ne.orgDomain():null}).on("zoom",he?Ld:null),Qg.scale=function(a){return uf?this.y(a):this.x(a)},Qg.orgScaleExtent=function(){var a=ie?ie:[1,10];return[a[0],Math.max(Ob()/a[1],a[1])]},Qg.updateScaleExtent=function(){var a=wb(Ne.orgDomain())/wb(Yg),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g={};if(Zd.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Rg.selectAll(Vd(a)),d=c.filter(Wd),e=c.filter(Xd);Zd.revert(),Zd.defocus(),b(d.classed("focused",!0)),b(e),Tc(Zd.data.targets)&&mb(a,!0),Qd(a)},Zd.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Rg.selectAll(Vd(a)),d=c.filter(Wd),e=c.filter(Xd);Zd.revert(),b(d.classed("focused",!1)),b(e),Tc(Zd.data.targets)&&nb(a),Rd(a)},Zd.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Rg.selectAll(Vd(a)),d=c.filter(Wd),e=c.filter(Xd);b(d.classed("focused",!1)),b(e),Tc(Zd.data.targets)&&nb(a),Sd()},Zd.show=function(a){Rg.selectAll(Vd(a)).transition().style("opacity",1)},Zd.hide=function(a){Rg.selectAll(Vd(a)).transition().style("opacity",0)},Zd.unzoom=function(){Mg.clear().update(),Jd({withUpdateXDomain:!0})},Zd.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&Gb(a.xs),"categories"in a&&ug&&(wf=a.categories,Te.categories(wf)),"cacheIds"in a&&xb(a.cacheIds))return void Pd(zb(a.cacheIds),a.done);if("data"in a)Pd(Kb(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){Pd(Kb(c),a.done)});else if("rows"in a)Pd(Kb(Ib(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");Pd(Kb(Jb(a.columns)),a.done)}},Zd.unload=function(a){Zd.data.targets=Zd.data.targets.filter(function(b){return b.id!==a}),Rg.selectAll(Vd(a)).transition().style("opacity",0).remove(),qf&&Rg.selectAll(".legend-item"+Ud(a)).remove(),Zd.data.targets.length>0&&Jd({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Zd.selected=function(a){var b=Ud(a);return g.merge(Tg.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(ae)}).map(function(a){return a.map(function(a){return a.__data__})}))},Zd.select=function(a,b,c){jf&&Tg.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?jd:md,i="circle"===this.nodeName?kd:nd,j=kf||!a||a.indexOf(d.id)>=0,k=!b||b.indexOf(f)>=0;j&&k?lf(d)&&h(g.select(this).classed(ae,!0),d,f):e(c)&&c&&i(g.select(this).classed(ae,!1),d,f)})},Zd.unselect=function(a,b){jf&&Tg.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var e="circle"===this.nodeName?kd:nd,f=kf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0;f&&h&&lf(c)&&e(g.select(this).classed(ae,!1),c,d)})},Zd.toLine=function(a){Nc(a,"line"),Nd()},Zd.toSpline=function(a){Nc(a,"spline"),Nd()},Zd.toBar=function(a){Nc(a,"bar"),Nd()},Zd.toScatter=function(a){Nc(a,"scatter"),Nd()},Zd.toArea=function(a){Nc(a,"area"),Nd()},Zd.toAreaSpline=function(a){Nc(a,"area-spline"),Nd()},Zd.toPie=function(a){Nc(a,"pie"),Nd({withTransform:!0})},Zd.toDonut=function(a){Nc(a,"donut"),Nd({withTransform:!0})},Zd.groups=function(a){return d(a)?af:(af=a,Jd(),af)},Zd.xgrids=function(a){return a?(Vf=a,Jd(),Vf):Vf},Zd.xgrids.add=function(a){return a?Zd.xgrids(Vf.concat(a)):void 0},Zd.xgrids.remove=function(a){var b=Yd(a);return Zd.xgrids(Vf.filter(b))},Zd.ygrids=function(a){return a?(Xf=a,Jd(),Xf):Xf},Zd.ygrids.add=function(a){return a?Zd.ygrids(Xf.concat(a)):void 0},Zd.ygrids.remove=function(a){var b=Yd(a);return Zd.ygrids(Xf.filter(b))},Zd.regions=function(a){return d(a)?jg:(jg=a,Jd(),jg)},Zd.regions.add=function(a){return d(a)?jg:(jg=jg.concat(a),Jd(),jg)},Zd.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;Rg.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),jg=jg.filter(function(b){return b.classes.indexOf(a)<0})}),jg},Zd.data.get=function(a){var b=Zd.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},Zd.data.getAsTarget=function(a){var b=Sb(function(b){return b.id===a});return b.length>0?b[0]:void 0},Zd.resize=function(a){de=a?a.width:null,ee=a?a.height:null,Nd({withLegend:!0,withTransition:!1})},Zd.destroy=function(){Zd.data.targets=void 0,Zd.data.x={},Xg.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){Cd(b)});else if("rows"in f.data)Cd(Ib(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Cd(Jb(f.data.columns))}return Zd}}(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 Tc($d.data.targets)?0:ge?ge:If?1:v("y")}function u(){return Tc($d.data.targets)?0:he?he:Hg?ye*(Mf&&!vf?1.25:1):Mf?Qf||vf?1:v("y2"):1}function v(){var a=X();return a.isInner?40:60}function w(){return+g.select(de).style("width").replace("px","")}function x(){return+g.select(de).style("height").replace("px","")}function y(){return re+2}function z(){return 80}function A(){return oe.left+20}function B(){return te+2}function C(){var a=vf?te:re,b=rb(),c=Ob();return c>1?a*b/(c-1):a}function D(a){Ig=a}function E(a){Jg=a}function F(a){Kg=a}function G(){return rf?Hg?Jg*(Ig+1):ve:0}function H(){return rf?Hg?we:Kg*(Ig+1):0}function I(){var a=W();return a.isInner?5:20}function J(){var a,b,c=!Oe;Ge=vf?1:0,He=vf?te:re,Ie=vf?0:te,Je=vf?re:1,Ke=Ge,Le=He,Me=vf?0:ue,Ne=vf?se:1,Oe=L(Ge,He,c?void 0:Oe.domain(),function(){return Ue.tickOffset()}),Pe=M(Ie,Je),Qe=M(Ie,Je),Re=L(Ge,He,Zg,function(a){return a%1?0:Xe.tickOffset()}),Se=M(Me,Ne),Te=M(Me,Ne),a=S(),b=T(),Ue=P(Oe,Cg,a,b),Xe=P(Re,Fg,a,b),Ve=Q(Pe,Dg,Jf,Lf),We=Q(Qe,Eg,Rf,Tf),c||(Ng.scale(Re),ie&&Rg.scale(Oe)),K()}function K(){Ce=gb(),De=hb(),Ee=hb(.98)}function L(a,b,c,f){var h=(ug?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}),vg){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 M(a,b){return g.scale.linear().range([a,b])}function N(a){return"y2"===R(a)?Qe:Pe}function O(a){return"y2"===R(a)?Te:Se}function P(a,c,d,e){var f=(vg?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),vg?f.tickCentered(yf):f.tickOffset=function(){var a=vf?te:re;return a*rb()/Ob()/2},vg&&f.categories(xf),f}function Q(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function R(a){return a in cf?cf[a]:"y"}function S(){var a=ug?Bg:vg?Xb:null;return zf&&("function"==typeof zf?a=zf:ug&&(a=function(a){return g.time.format(zf)(a)})),a}function T(){var a=Ob();return Af&&a>Bf?Bf:a}function U(a){return"string"==typeof a?a:a?a.text:null}function V(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 W(){return V(Df,"inner-right")}function X(){return V(Hf,"inner-top")}function Y(){return U(Df)}function Z(){return U(Hf)}function $(){var a=W();return a.isLeft?0:a.isCenter?re/2:re}function _(){var a=X();return a.isBottom?-te:a.isMiddle?-te/2:0}function ab(){var a=X();return a.isTop?"-0.5em":"0"}function bb(){var a=W();return a.isInner?"-0.5em":"3.5em"}function cb(){var a=X(),b=0;return g.selectAll(".y.axis .tick text").each(function(){var a=this.getBBox();b0)for(f=Vb(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 pb(a){var b,c,d,e,f,h=Tb(a);if(bf.length>0)for(f=Wb(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 qb(a){var b,d,e,f,g,h,i,j,k=Sb(function(b){return R(b.id)===a}),l="y2"===a?Of:Ff,m="y2"===a?Nf:Ef,n=c(l)?l:ob(k),o=c(m)?m:pb(k),p="y2"===a?Pf:Gf,q=nc()&&vf;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&&Kf&&(e=c(Kf.top)?Kf.top:d,f=c(Kf.bottom)?Kf.bottom:d),"y2"===a&&Sf&&(e=c(Sf.top)?Sf.top:d,f=c(Sf.bottom)?Sf.bottom:d),q&&(h=oc(n,o),i=wb(Pe.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]))),Pc(k)&&!Vb(k)&&(f=n),[n-f,o+e]}function rb(a){var b=wb(Zg),c=wb(Oe.domain());return a||0===c?1:b/c}function sb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function tb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return vg?d=0:Pc(a)?(c=Ob(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function vb(a){var b=[sb(a),tb(a)],c=b[0],d=b[1],e=ub(a,b),f=ug?new Date(c.getTime()-e):c-e,g=ug?new Date(d.getTime()+e):d+e;return[f,g]}function wb(a){return a[1]-a[0]}function xb(a){for(var b=0;bd?0:d}function Cb(a){return Ye&&a===Ye||Ze&&hd(Ze,a)}function Db(a){return!Cb(a)}function Eb(a){return Ye?Ye:Ze?Ze[a]:null}function Fb(a,b){return a in $d.data.x&&$d.data.x[a]&&$d.data.x[a][b]?$d.data.x[a][b]:b}function Gb(a){Object.keys(a).forEach(function(b){Ze[b]=a[b]})}function Hb(a){var b;return a&&(b=af[a.id],a.name=b?b:a.id),a}function Ib(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):$d.data.x[Object.keys($d.data.x)[0]]}),c=d.map(function(a){var c=_e(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Eb(a);return e=ug?dd(b[f]):wg?b[f]?+b[f]:Fb(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++})}),df&&Nc(Qb(c).filter(function(a){return!(a in ef)}),df),c.forEach(function(a){yb(a.id_org,a)}),c)}function Lb(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 Mb(a){return a>0&&$d.data.targets[0].values[a-1]?$d.data.targets[0].values[a-1].x:void 0}function Nb(a){return a1?$d.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?$d.data.targets[0]:null,a}function Qb(a){return a=d(a)?$d.data.targets:a,a.map(function(a){return a.id})}function Rb(a){var b,c=Qb();for(b=0;ba})}function Wb(a){return Ub(a,function(a){return a>0})}function Xb(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(vc(a,f))),a[g].x&&(e=e.concat(vc(a,g))),yc(e,b)):wc(a,b,f,g)}function xc(a,b){var c;return c=a.map(function(a){return wc(a.values,b)}),yc(c,b)}function yc(a,b){var c,d;return a.forEach(function(a){var e=id(a,b);(c>e||!c)&&(c=e,d=a)}),d}function zc(){return gf&&"desc"===gf.toLowerCase()}function Ac(){return gf&&"asc"===gf.toLowerCase()}function Bc(a){var b=Ac(),c=zc();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 gf&&a.sort(gf),a}function Cc(a,b){var d,e,f,g,h,i,j,k=Tc($d.data.targets),l=k?uc:tc,m=a.filter(function(a){return a&&c(a.value)});lg&&0!==m.length&&(Xg.html(og(a,S(),l,Ag)).style("visibility","hidden").style("display","block"),d=Xg.property("offsetWidth"),e=Xg.property("offsetHeight"),k?(g=re/2+b[0],i=te/2+b[1]+20):(vf?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=Oe(m[0].x)+20):(f=q(),g=f+t()+Oe(m[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)),Xg.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function Dc(){Xg.style("display","none")}function Ec(a){var b=a.filter(function(a){return a&&c(a.value)});lg&&(Qc($d.data.targets)||Tc($d.data.targets)||Ug.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(vf?"y1":"x1",pc).attr(vf?"y2":"x2",pc))}function Fc(){Ug.select("line.xgrid-focus").style("visibility","hidden")}function Gc(a){return a.x||0===a.x?Oe(a.x):null}function Hc(a){return N(a.id)(a.value)}function Ic(){var a,b,c={},e=0;return Sb(Wc).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Mc(a,b){return b?2*a.tickOffset()*.6/b:0}function Nc(a,b){var c=d(a)?Qb():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 Bd(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 Cd(b){var c,d,e;if(Yg=g.select(de),Yg.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(Yg.html(""),$d.data.x={},$d.data.targets=Kb(b),o(),J(),Oe.domain(g.extent(vb($d.data.targets))),Pe.domain(qb("y")),Qe.domain(qb("y2")),Re.domain(Oe.domain()),Se.domain(Pe.domain()),Te.domain(Qe.domain()),Zg=Oe.domain(),Ng.scale(Re),ie&&Rg.scale(Oe),Sg=g.select(de).append("svg").attr("width",re+oe.left+oe.right).attr("height",te+oe.top+oe.bottom).on("mouseenter",le).on("mouseleave",me),Tg=Sg.append("defs"),Tg.append("clipPath").attr("id",sg).append("rect").attr("width",re).attr("height",te),Tg.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",y).attr("height",z),Tg.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-oe.left+1).attr("width",A).attr("height",B),Ug=Sg.append("g").attr("transform",Gg.main),Vg=of?Sg.append("g").attr("transform",Gg.context):null,Wg=rf?Sg.append("g").attr("transform",Gg.legend):null,Xg=g.select(de).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Ug.append("g").attr("class","x axis").attr("clip-path",vf?"":j("xaxis-clip")).attr("transform",Gg.x).append("text").attr("class","-axis-x-label").attr("dy",bb).style("text-anchor",db).text(vf?Z:Y),Ug.append("g").attr("class","y axis").attr("clip-path",vf?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform","rotate(-90)").attr("dx",ab).style("text-anchor",eb).text(vf?Y:Z),Mf&&Ug.append("g").attr("class","y2 axis").attr("transform",Gg.y2),d=Ug.append("g").attr("clip-path",tg).attr("class","grid"),Uf&&d.append("g").attr("class","xgrids"),Wf&&d.append("g").attr("class","xgrid-lines"),ag&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",vf?0:-10).attr("x2",vf?re:-10).attr("y1",vf?-10:oe.top).attr("y2",vf?-10:te),Xf&&d.append("g").attr("class","ygrids"),Yf&&d.append("g").attr("class","ygrid-lines"),Ug.append("g").attr("clip-path",tg).attr("class","regions"),Ug.append("g").attr("clip-path",tg).attr("class","chart"),c=Ug.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",ie?vf?"ns-resize":"ew-resize":null),Ug.select(".chart").append("g").attr("class","chart-bars"),Ug.select(".chart").append("g").attr("class","chart-lines"),Ug.select(".chart").append("g").attr("class","chart-arcs").attr("transform",Gg.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(jg),Ug.select(".chart").append("g").attr("class","chart-texts"),ie&&Ug.insert("rect",ke?null:"g.grid").attr("class","zoom-rect").attr("width",re).attr("height",te).style("opacity",0).style("cursor",vf?"ns-resize":"ew-resize").call(Rg).on("dblclick.zoom",null),null!==Cf&&Ng.extent("function"!=typeof Cf?Cf:Cf(vb())),of&&(Vg.append("g").attr("clip-path",tg).attr("class","chart"),Vg.select(".chart").append("g").attr("class","chart-bars"),Vg.select(".chart").append("g").attr("class","chart-lines"),Vg.append("g").attr("clip-path",tg).attr("class","x brush").call(Ng).selectAll("rect").attr(vf?"width":"height",vf?se:ue),Vg.append("g").attr("class","x axis").attr("transform",Gg.subx).attr("clip-path",vf?j("yaxis-clip"):"")),Pd($d.data.targets),Jd({withTransform:!0,withUpdateXDomain:!0,withLegend:!0}),pg){if(ug&&"string"==typeof qg){for(qg=dd(qg),e=0;e<$d.data.targets[0].values.length&&$d.data.targets[0].values[e].x-qg!==0;e++);qg=e}Xg.html(og($d.data.targets.map(function(a){return Hb(a.values[qg])}),S(),tc,Ag)),Xg.style("top",rg.top).style("left",rg.left).style("display","block")}null==a.onresize&&(a.onresize=Md()),a.onresize.add&&a.onresize.add(function(){Od({withTransition:!1,withLegend:!0})})}function Dd(a){a.append("rect").attr("class",ic).style("cursor",kf&&lf?"pointer":null).on("mouseover",function(a,b){if(!yg&&!Tc($d.data.targets)){var c,d,e=$d.data.targets.map(function(a){return Hb(a.values[b])});if(Object.keys(af).length>0){d=[];for(var f in af)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=od,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(ce,!n),l.classed(be,!m),k(!m,l,a,b))}))}function Hd(a){Tc($d.data.targets)||kf&&(xg=a,Ug.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),yg=!0)}function Id(){Tc($d.data.targets)||kf&&(Ug.select(".dragarea").transition().duration(100).style("opacity",0).remove(),Ug.selectAll(".-shape").classed(ce,!1),yg=!1)}function Jd(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,I=Ic(),J=Tc($d.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,A=e(a.withLegend)?a.withLegend:!1,G=w?ne:0,H=e(a.durationForExit)?a.durationForExit:G,A&&rf&&Ud($d.data.targets,a),z&&(Oe.domain(g.extent(vb($d.data.targets))),Zg=Oe.domain(),ie&&Rg.scale(Oe).updateScaleExtent(),Re.domain(Oe.domain()),Ng.scale(Re)),y&&(Oe.domain(Ng.empty()?Zg:Ng.extent()),ie&&Rg.scale(Oe).updateScaleExtent()),Pe.domain(qb("y")),Qe.domain(qb("y2")),Ug.select(".x.axis").style("opacity",J?0:1).transition().duration(G).call(vf?Ve:Ue),Ug.select(".y.axis").style("opacity",J?0:1).transition().duration(G).call(vf?Ue:Ve),Ug.select(".y2.axis").style("opacity",J?0:1).transition().call(We),B=wd(I),E=xd(I,!0),F=xd(I,!1),Ug.select(".x.axis .-axis-x-label").attr("x",$),Ug.select(".y.axis .-axis-y-label").attr("x",_).attr("dy",cb),Se.domain(Pe.domain()),Te.domain(Qe.domain()),Xg.style("display","none"),Ug.select("line.xgrid-focus").style("visibility","hidden").attr("y2",te),Uf){if("year"===Vf){d=[];for(var K=vb(),L=K[0].getFullYear(),M=K[1].getFullYear(),N=L;M>=N;N++)d.push(new Date(N+"-01-01 00:00:00"))}else d=Oe.ticks(10);b=Ug.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",vf?0:function(a){return Oe(a)-Ue.tickOffset()}).attr("x2",vf?re:function(a){return Oe(a)-Ue.tickOffset()}).attr("y1",vf?function(a){return Oe(a)-Ue.tickOffset()}:oe.top).attr("y2",vf?function(a){return Oe(a)-Ue.tickOffset()}:te).style("opacity",function(){return+g.select(this).attr(vf?"y1":"x1")===(vf?te:0)?0:1}),b.exit().remove()}Wf&&(f=Ug.select(".xgrid-lines").selectAll(".xgrid-line").data(Wf),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",vf?"":"rotate(-90)").attr("dx",vf?0:-oe.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(G).attr("x1",vf?0:qc).attr("x2",vf?re:qc).attr("y1",vf?qc:oe.top).attr("y2",vf?qc:te).style("opacity",1),f.select("text").transition().duration(G).attr("x",vf?re:0).attr("y",qc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(G).style("opacity",0).remove()),u&&Xf&&(i=Ug.select(".ygrids").selectAll(".ygrid").data(Pe.ticks(Zf)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",vf?Pe:0).attr("x2",vf?Pe:re).attr("y1",vf?0:Pe).attr("y2",vf?te:Pe),i.exit().remove()),u&&Yf&&(j=Ug.select(".ygrid-lines").selectAll(".ygrid-line").data(Yf),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",vf?"rotate(-90)":"").attr("dx",vf?0:-oe.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(G).attr("x1",vf?rc:0).attr("x2",vf?rc:re).attr("y1",vf?0:rc).attr("y2",vf?te:rc).style("opacity",1),j.select("text").transition().duration(G).attr("x",vf?0:re).attr("y",rc).text(function(a){return a.text +}).style("opacity",1),j.exit().transition().duration(G).style("opacity",0).remove()),m=Ug.selectAll(".-bars").selectAll(".-bar").data(_c),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return Ag(a.id)}).attr("class",gc),m.style("opacity",jc).transition().duration(G).attr("d",B).style("opacity",1),m.exit().transition().duration(H).style("opacity",0).remove(),o=Ug.selectAll(".-texts").selectAll(".-text").data(bd),o.enter().append("text").attr("class",Yb).attr("text-anchor",function(a){return vf?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return tc(a.value)}),o.style("fill-opacity",kc).transition().duration(G).attr("x",E).attr("y",F).style("fill-opacity",mc),o.exit().transition().duration(H).style("fill-opacity",0).remove(),Ug.selectAll(".-line").style("opacity",jc).transition().duration(G).attr("d",Og).style("opacity",1),Ug.selectAll(".-area").style("opacity",0).transition().duration(G).attr("d",Pg).style("opacity",$g),l=Ug.selectAll(".-circles").selectAll(".-circle").data(ad),l.enter().append("circle").attr("class",fc).style("opacity",0).attr("r",_f),l.style("opacity",jc).transition().duration(G).style("opacity",lc).attr("cx",vf?Hc:Gc).attr("cy",vf?Gc:Hc),l.exit().remove(),Ug.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(G).attrTween("d",function(a){var b=fb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return ib(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),Ug.selectAll(".chart-arc").select("text").attr("transform",jb).style("opacity",0).transition().duration(G).text(lb).style("opacity",function(a){return $c(a.data)?1:0}),Ug.select(".chart-arcs-title").style("opacity",Sc($d.data.targets)?1:0),of&&(null!==g.event&&"zoom"===g.event.type&&Ng.extent(Oe.orgDomain()).update(),v&&(Vg.select(".x.axis").style("opacity",J?0:1).transition().duration(G).call(Xe),Ng.empty()||Ng.extent(Oe.orgDomain()).update(),D=wd(I,!0),p=Vg.selectAll(".-bars").selectAll(".-bar").data(_c),p.enter().append("path").attr("d",D).style("stroke","none").style("fill",function(a){return Ag(a.id)}).attr("class",gc),p.style("opacity",jc).transition().duration(G).attr("d",D).style("opacity",1),p.exit().transition().duration(G).style("opacity",0).remove(),Vg.selectAll(".-line").style("opacity",jc).transition().duration(G).attr("d",Qg).style("opacity",1))),Ug.selectAll(".selected-circles").filter(function(a){return Wc(a)}).selectAll("circle").remove(),Ug.selectAll(".selected-circle").transition().duration(G).attr("cx",vf?Hc:Gc).attr("cy",vf?Gc:Hc),Ze?(q=Ug.select(".event-rects").selectAll(".event-rect").data([0]),Ed(q.enter()),q.attr("x",0).attr("y",0).attr("width",re).attr("height",te)):(wg?(t=function(a,b){var c=Mb(b),d=Nb(b);return(Oe(d?d:a.x+50)-Oe(c?c:a.x-50))/2},s=function(a,b){var c=Mb(b);return(Oe(a.x)+Oe(c?c:a.x-50))/2}):(t=C(),s=function(a){return Oe(a.x)-t/2}),r=Pb(),Ug.select(".event-rects").datum(r?r.values:[]),q=Ug.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Dd(q.enter()),q.attr("class",ic).attr("x",vf?0:s).attr("y",vf?s:0).attr("width",vf?re:t).attr("height",vf?t:te),q.exit().remove()),n=Ug.select(".regions").selectAll("rect.region").data(kg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",hc).attr("x",vf?0:Ab).attr("y",vf?Ab:oe.top).attr("width",vf?re:Bb).attr("height",vf?Bb:te).transition().duration(G).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(G).style("fill-opacity",0).remove(),Qb().forEach(function(a){_g[a]=!0})}function Kd(){Jd({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ld(){return"mousemove"===g.event.sourceEvent.type&&Rg.altDomain?(Oe.domain(Rg.altDomain),void Rg.scale(Oe).updateScaleExtent()):(vg&&Oe.orgDomain()[0]===Zg[0]&&Oe.domain([Zg[0]-1e-10,Oe.orgDomain()[1]]),Jd({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(zg=!0)))}function Md(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Nd(){Sg.attr("width",ve).attr("height",we),Sg.select("#"+sg).select("rect").attr("width",re).attr("height",te),Sg.select("#xaxis-clip").select("rect").attr("width",y),Sg.select(".zoom-rect").attr("width",re).attr("height",te)}function Od(a){var b,c,d;a=e(a)?a:{},b=e(a.withTransition)?a.withTransition:!0,c=e(a.withTransform)?a.withTransform:!1,d=e(a.withLegend)?a.withLegend:!1,o(),J(),Nd(),n(b),Jd({withTransition:b,withUpdateXDomain:!0,withTransform:c,durationForExit:0,withLegend:d})}function Pd(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Ug.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",Zb).style("fill",function(a){return Ag(a.id)}),e=Ug.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",bc).style("fill",function(a){return Ag(a.id)}).style("stroke","none").style("cursor",function(a){return mf(a)?"pointer":null}),c=Ug.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",_b).style("opacity",0).style("stroke",function(a){return Ag(a.id)}),b.append("path").attr("class",dc).style("opacity",function(){return $g=+g.select(this).style("opacity"),0}).style("fill",function(a){return Ag(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",ac).style("fill",function(a){return Ag(a.id)}).style("cursor",function(a){return mf(a)?"pointer":null}),a.forEach(function(a){var b=Vd(a.id);Ug.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=Ug.select(".chart-arcs").selectAll(".chart-arc").data(Fe(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",cc).style("opacity",0).style("fill",function(a){return Ag(a.data.id)}).style("cursor",function(a){return mf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){mb(a.data.id),Rd(a.data.id)}).on("mousemove",function(a){var b=[Hb({id:a.data.id,value:a.value,ratio:kb(a)})];Cc(b,g.mouse(this))}).on("mouseout",function(a){nb(a.data.id),Td(),Dc()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),of&&(n=Vg.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",bc).style("fill",function(a){return Ag(a.id)}),l=Vg.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",_b).style("opacity",0).style("stroke",function(a){return Ag(a.id)})),Sg.selectAll(".target").transition().style("opacity",1)}function Qd(a,b){$d.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+t)/10),i=10*Math.ceil((g.height+s)/10),j=Hg?i:h,k=Hg?xe:ye;c&&(v=0,B=0,m=0,p=0),x[b]=h,y[b]=i,(!m||h>=m)&&(m=h),(!p||i>=p)&&(p=i),f=Hg?p:m,uf?(Object.keys(x).forEach(function(a){x[a]=m}),Object.keys(y).forEach(function(a){y[a]=p}),e=(k-f*r.length)/2,u>e?(v=0,B=0,r.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,l,m,p,q,r=Qb(a),s=4,t=26,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=d(b)?{}:b,q=e(b.withTransition)?b.withTransition:!0,Hg?(g=function(a){return m*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return p*(.2+A[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},f=Wg.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){tf(a)}).on("mouseover",function(a){Rd(a),$d.focus(a)}).on("mouseout",function(){Td(),$d.revert()}),f.append("text").text(function(a){return e(af[a])?af[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Hg?h:-200).attr("y",Hg?-200:k),f.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",Hg?i:-200).attr("y",Hg?-200:l).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return Ag(a)}).attr("x",Hg?h:-200).attr("y",Hg?-200:j).attr("width",10).attr("height",10),Wg.selectAll("text").data(r).each(function(a,b){c(this,a,0===b)}).transition().duration(q?250:0).attr("x",h).attr("y",k),Wg.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",i).attr("y",l),Wg.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",g).attr("y",j),E(m),F(p),D(B),o(),J(),Nd(),n(!1)}function Vd(a){return a?"-"+a.replace(/\./g,"\\."):""}function Wd(a){return".target"+Vd(a)}function Xd(a){return Rb(a.id)}function Yd(a){return"data"in a&&Rb(a.data.id)}function Zd(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 $d={data:{}},_d={},ae="_expanded_",be="_selected_",ce="_included_",de=i(["bindto"],"#chart"),ee=i(["size","width"],null),fe=i(["size","height"],null),ge=i(["padding","left"],null),he=i(["padding","right"],null),ie=i(["zoom","enabled"],!1),je=i(["zoom","extent"],null),ke=i(["zoom","privileged"],!1),le=i(["onenter"],function(){}),me=i(["onleave"],function(){}),ne=i(["transition","duration"],350);h("data","data is required in config");var 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,Ue,Ve,We,Xe,Ye=i(["data","x"],null),Ze=i(["data","xs"],null),$e=i(["data","x_format"],"%Y-%m-%d"),_e=i(["data","id_converter"],function(a){return a}),af=i(["data","names"],{}),bf=i(["data","groups"],[]),cf=i(["data","axes"],{}),df=i(["data","type"],null),ef=i(["data","types"],{}),ff=i(["data","labels"],{}),gf=i(["data","order"],null),hf=i(["data","regions"],{}),jf=i(["data","colors"],{}),kf=i(["data","selection","enabled"],!1),lf=i(["data","selection","grouped"],!1),mf=i(["data","selection","isselectable"],function(){return!0}),nf=i(["data","selection","multiple"],!0),of=i(["subchart","show"],!1),pf=of?i(["subchart","size","height"],60):0,qf=i(["color","pattern"],null),rf=i(["legend","show"],!0),sf=i(["legend","position"],"bottom"),tf=i(["legend","item","onclick"],function(){}),uf=i(["legend","equally"],!1),vf=i(["axis","rotated"],!1),wf=i(["axis","x","type"],"indexed"),xf=i(["axis","x","categories"],[]),yf=i(["axis","x","tick","centered"],!1),zf=i(["axis","x","tick","format"],null),Af=i(["axis","x","tick","culling"],"categorized"===wf?!1:!0),Bf=i(["axis","x","tick","count"],10),Cf=i(["axis","x","default"],null),Df=i(["axis","x","label"],null),Ef=i(["axis","y","max"],null),Ff=i(["axis","y","min"],null),Gf=i(["axis","y","center"],null),Hf=i(["axis","y","label"],null),If=i(["axis","y","inner"],!1),Jf=i(["axis","y","tick","format"],null),Kf=i(["axis","y","padding"],null),Lf=i(["axis","y","ticks"],10),Mf=i(["axis","y2","show"],!1),Nf=i(["axis","y2","max"],null),Of=i(["axis","y2","min"],null),Pf=i(["axis","y2","center"],null),Qf=i(["axis","y2","inner"],!1),Rf=i(["axis","y2","tick","format"],null),Sf=i(["axis","y2","padding"],null),Tf=i(["axis","y2","ticks"],10),Uf=i(["grid","x","show"],!1),Vf=i(["grid","x","type"],"tick"),Wf=i(["grid","x","lines"],null),Xf=i(["grid","y","show"],!1),Yf=i(["grid","y","lines"],null),Zf=i(["grid","y","ticks"],10),$f=i(["point","show"],!0),_f=$f?i(["point","r"],2.5):0,ag=i(["point","focus","line","enabled"],!0),bg=i(["point","focus","expand","enabled"],!0),cg=i(["point","focus","expand","r"],bg?4:_f),dg=i(["point","focus","select","r"],8),eg=i(["point","onclick"],function(){}),fg=i(["point","onselected"],function(){}),gg=i(["point","onunselected"],function(){}),hg=i(["arc","label","show"],!0),ig=i(["arc","label","format"],null),jg=i(["arc","title"],""),kg=i(["regions"],[]),lg=i(["tooltip","show"],!0),mg=i(["tooltip","format","title"],null),ng=i(["tooltip","format","value"],null),og=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=mg?mg:b,k=ng?ng:c;for(f=0;f"+(g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+=""+i+""+h+"");return e+""}),pg=i(["tooltip","init","show"],!1),qg=i(["tooltip","init","x"],0),rg=i(["tooltip","init","position"],{top:"0px",left:"50px"}),sg=de.replace("#","")+"-clip",tg=j(sg),ug="timeseries"===wf,vg="categorized"===wf,wg=!ug&&(Ye||Ze),xg=null,yg=!1,zg=!1,Ag=cd(jf,qf),Bg=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)}}(),Cg=vf?"left":"bottom",Dg=vf?If?"top":"bottom":If?"right":"left",Eg=vf?Qf?"bottom":"top":Qf?"left":"right",Fg=vf?"left":"bottom",Gg={main:function(){return"translate("+oe.left+","+oe.top+")"},context:function(){return"translate("+pe.left+","+pe.top+")"},legend:function(){return"translate("+qe.left+","+qe.top+")"},y2:function(){return"translate("+(vf?0:re)+","+(vf?1:0)+")"},x:function(){return"translate(0,"+te+")"},subx:function(){return"translate(0,"+(vf?0:ue)+")"},arc:function(){return"translate("+re/2+","+te/2+")"}},Hg="right"===sf,Ig=0,Jg=0,Kg=0,Lg=40,Mg=20;Fe=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ng,Og=function(){var a=g.svg.line().x(vf?function(a){return N(a.id)(a.value)}:pc).y(vf?pc:function(a){return N(a.id)(a.value)});return function(b){var c,d,e=pd(b.values);return Uc(b)?(a.interpolate(Vc(b)?"cardinal":"linear"),hf[b.id]?Bd(e,Oe,N(b.id),hf[b.id]):a(e)):(c=Oe(e[0].x),d=N(b.id)(e[0].value),vf?"M "+d+" "+c:"M "+c+" "+d)}}(),Pg=function(){var a;return a=vf?g.svg.area().x0(function(a){return N(a.id)(0)}).x1(function(a){return N(a.id)(a.value)}).y(pc):g.svg.area().x(pc).y0(function(a){return N(a.id)(0)}).y1(function(a){return N(a.id)(a.value)}),function(b){var c,d,e=pd(b.values);return Oc([b],"area")||Oc([b],"area-spline")?(a.interpolate(Vc(b)?"cardinal":"linear"),a(e)):(c=Oe(e[0].x),d=N(b.id)(e[0].value),vf?"M "+d+" "+c:"M "+c+" "+d)}}(),Qg=function(){var a=g.svg.line().x(vf?function(a){return O(a.id)(a.value)}:sc).y(vf?sc:function(a){return O(a.id)(a.value)});return function(b){var c=pd(b.values);return Uc(b)?a(c):"M "+Re(c[0].x)+" "+O(b.id)(c[0].value)}}(),Rg=function(){};Ng=g.svg.brush().on("brush",Kd),Ng.update=function(){return Vg&&Vg.select(".x.brush").call(this),this},Ng.scale=function(a){return vf?this.y(a):this.x(a)},ie&&(Rg=g.behavior.zoom().on("zoomstart",function(){Rg.altDomain=g.event.sourceEvent.altKey?Oe.orgDomain():null}).on("zoom",ie?Ld:null),Rg.scale=function(a){return vf?this.y(a):this.x(a)},Rg.orgScaleExtent=function(){var a=je?je:[1,10];return[a[0],Math.max(Ob()/a[1],a[1])]},Rg.updateScaleExtent=function(){var a=wb(Oe.orgDomain())/wb(Zg),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,_g={};if($d.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Sg.selectAll(Wd(a)),d=c.filter(Xd),e=c.filter(Yd);$d.revert(),$d.defocus(),b(d.classed("focused",!0)),b(e),Tc($d.data.targets)&&mb(a,!0),Rd(a)},$d.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Sg.selectAll(Wd(a)),d=c.filter(Xd),e=c.filter(Yd);$d.revert(),b(d.classed("focused",!1)),b(e),Tc($d.data.targets)&&nb(a),Sd(a)},$d.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Sg.selectAll(Wd(a)),d=c.filter(Xd),e=c.filter(Yd);b(d.classed("focused",!1)),b(e),Tc($d.data.targets)&&nb(a),Td()},$d.show=function(a){Sg.selectAll(Wd(a)).transition().style("opacity",1)},$d.hide=function(a){Sg.selectAll(Wd(a)).transition().style("opacity",0)},$d.unzoom=function(){Ng.clear().update(),Jd({withUpdateXDomain:!0})},$d.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&Gb(a.xs),"categories"in a&&vg&&(xf=a.categories,Ue.categories(xf)),"cacheIds"in a&&xb(a.cacheIds))return void Qd(zb(a.cacheIds),a.done);if("data"in a)Qd(Kb(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){Qd(Kb(c),a.done)});else if("rows"in a)Qd(Kb(Ib(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");Qd(Kb(Jb(a.columns)),a.done)}},$d.unload=function(a){$d.data.targets=$d.data.targets.filter(function(b){return b.id!==a}),Sg.selectAll(Wd(a)).transition().style("opacity",0).remove(),rf&&Sg.selectAll(".legend-item"+Vd(a)).remove(),$d.data.targets.length>0&&Jd({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},$d.selected=function(a){var b=Vd(a);return g.merge(Ug.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(be)}).map(function(a){return a.map(function(a){return a.__data__})}))},$d.select=function(a,b,c){kf&&Ug.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?jd:md,i="circle"===this.nodeName?kd:nd,j=lf||!a||a.indexOf(d.id)>=0,k=!b||b.indexOf(f)>=0;j&&k?mf(d)&&h(g.select(this).classed(be,!0),d,f):e(c)&&c&&i(g.select(this).classed(be,!1),d,f)})},$d.unselect=function(a,b){kf&&Ug.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var e="circle"===this.nodeName?kd:nd,f=lf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0;f&&h&&mf(c)&&e(g.select(this).classed(be,!1),c,d)})},$d.toLine=function(a){Nc(a,"line"),Od()},$d.toSpline=function(a){Nc(a,"spline"),Od()},$d.toBar=function(a){Nc(a,"bar"),Od()},$d.toScatter=function(a){Nc(a,"scatter"),Od()},$d.toArea=function(a){Nc(a,"area"),Od()},$d.toAreaSpline=function(a){Nc(a,"area-spline"),Od()},$d.toPie=function(a){Nc(a,"pie"),Od({withTransform:!0})},$d.toDonut=function(a){Nc(a,"donut"),Od({withTransform:!0})},$d.groups=function(a){return d(a)?bf:(bf=a,Jd(),bf)},$d.xgrids=function(a){return a?(Wf=a,Jd(),Wf):Wf},$d.xgrids.add=function(a){return a?$d.xgrids(Wf.concat(a)):void 0},$d.xgrids.remove=function(a){var b=Zd(a);return $d.xgrids(Wf.filter(b))},$d.ygrids=function(a){return a?(Yf=a,Jd(),Yf):Yf},$d.ygrids.add=function(a){return a?$d.ygrids(Yf.concat(a)):void 0},$d.ygrids.remove=function(a){var b=Zd(a);return $d.ygrids(Yf.filter(b))},$d.regions=function(a){return d(a)?kg:(kg=a,Jd(),kg)},$d.regions.add=function(a){return d(a)?kg:(kg=kg.concat(a),Jd(),kg)},$d.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;Sg.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),kg=kg.filter(function(b){return b.classes.indexOf(a)<0})}),kg},$d.data.get=function(a){var b=$d.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},$d.data.getAsTarget=function(a){var b=Sb(function(b){return b.id===a});return b.length>0?b[0]:void 0},$d.resize=function(a){ee=a?a.width:null,fe=a?a.height:null,Od({withLegend:!0,withTransition:!1})},$d.destroy=function(){$d.data.targets=void 0,$d.data.x={},Yg.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){Cd(b)});else if("rows"in f.data)Cd(Ib(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Cd(Jb(f.data.columns))}return $d}}(window); \ No newline at end of file