From 0b2f76c6ef5cd9b40d08247b6d15d76beb2ad0d1 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 19 Mar 2014 01:22:10 +0900 Subject: [PATCH] Fix axis label position logic --- c3.js | 17 ++++------------- c3.min.js | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/c3.js b/c3.js index d2a66a7..00d82f2 100644 --- a/c3.js +++ b/c3.js @@ -268,7 +268,7 @@ margin = { top: __axis_rotated && __axis_y2_show ? getAxisHeightByAxisId('y2') : 0, right: getCurrentPaddingRight(), - bottom: getAxisHeightByAxisId(__axis_rotated ? 'y' : 'x') + (__axis_rotated ? 0 : __subchart_size_height) + getLegendPaddingTop() + (isLegendRight ? 0 : legendHeight), + bottom: getAxisHeightByAxisId(__axis_rotated ? 'y' : 'x') + (__axis_rotated ? 0 : __subchart_size_height) + (isLegendRight ? 0 : legendHeight), left: (__axis_rotated ? __subchart_size_height + rotated_padding_right : 0) + getCurrentPaddingLeft() }; width = currentWidth - margin.left - margin.right; @@ -343,10 +343,8 @@ return position.isInner ? 20 + getMaxTickWidth(id) : 40 + getMaxTickWidth(id); } function getAxisHeightByAxisId(id) { - var position; - if (! getAxisLabel(id)) { return 20; } - position = getAxisLabelPositionById(id); - return (position.isInner ? 0 : 20) + (id === 'y2' ? 20 : 0); + var position = getAxisLabelPositionById(id); + return (position.isInner ? 30 : 40) + (id === 'y2' ? -10 : 0); } function getParentWidth() { return +d3.select(__bindto).style("width").replace('px', ''); // TODO: if rotated, use height @@ -411,10 +409,6 @@ function getLegendHeight() { return __legend_show ? isLegendRight ? currentHeight : legendItemHeight * (legendStep + 1) : 0; } - function getLegendPaddingTop() { - var xAxisLabelPositon = getXAxisLabelPosition(); - return xAxisLabelPositon.isInner ? 5 : 20; - } //-- Scales --// @@ -541,9 +535,6 @@ function getAxisLabelText(option) { return typeof option === 'string' ? option : option ? option.text : null; } - function getAxisLabel(id) { - return id === 'x' ? __axis_x_label : id === 'y' ? __axis_y_label : __axis_y2_label; - } function getAxisLabelPosition(option, defaultPosition) { var position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition; return { @@ -633,7 +624,7 @@ function dyForY2AxisLabel() { var position = getY2AxisLabelPosition(); if (__axis_rotated) { - return position.isInner ? "1.2em" : "-2.5em"; + return position.isInner ? "1.2em" : "-2.2em"; } else { return position.isInner ? "-0.5em" : 30 + getMaxTickWidth('y2'); } diff --git a/c3.min.js b/c3.min.js index 830b1c8..1b318bc 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 md(te.data.targets)?0:Be?Be:bg?1:v("y")}function u(){return md(te.data.targets)?0:Ce?Ce:bh?Te+(fg&&!Qf?v("y2"):1):fg?kg||Qf?1:v("y2"):1}function v(a){var b=hb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){var b;return cb(a)?(b=hb(a),(b.isInner?0:20)+("y2"===a?20:0)):20}function x(){return+g.select(ye).style("width").replace("px","")}function y(){return+g.select(ye).style("height").replace("px","")}function z(a){return a?-1:-(Je.left-1)}function A(a){return a?-20:-1}function B(){return z(!Qf)}function C(){return A(!Qf)}function D(){return z(Qf)}function E(){return A(Qf)}function F(a){return a?Me+2:Je.left+20}function G(a){return a?80:Oe+2}function H(){return F(!Qf)}function I(){return G(!Qf)}function J(){return F(Qf)}function K(){return G(Qf)}function L(){var a=Qf?Oe:Me,b=Mb(),c=hc();return c>1?a*b/(c-1):a}function M(a){ch=a}function N(a){dh=a}function O(a){eh=a}function P(){return Mf?bh?dh*(ch+1):Qe:0}function Q(){return Mf?bh?Re:eh*(ch+1):0}function R(){var a=eb();return a.isInner?5:20}function S(){var a,b,c=!hf;_e=Qf?1:0,af=Qf?Oe:Me,bf=Qf?0:Oe,cf=Qf?Me:1,df=_e,ef=af,ff=Qf?0:Pe,gf=Qf?Ne:1,hf=U(_e,af,c?void 0:hf.domain(),function(){return of.tickOffset()}),jf=V(bf,cf),kf=V(bf,cf),lf=U(_e,af,th,function(a){return a%1?0:rf.tickOffset()}),mf=V(ff,gf),nf=V(ff,gf),a=_(),b=ab(),of=Y(hf,Yg,a,b),rf=Y(lf,_g,a,b),pf=Z(jf,Zg,cg,eg),qf=Z(kf,$g,lg,ng),c||(hh.scale(lf),De&&lh.scale(hf)),T()}function T(){Xe=Bb(),Ye=Cb(),Ze=Cb(.98)}function U(a,b,c,f){var h=(Qg?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}),Rg){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 V(a,b){return g.scale.linear().range([a,b])}function W(a){return"y2"===$(a)?kf:jf}function X(a){return"y2"===$(a)?nf:mf}function Y(a,c,d,e){var f=(Rg?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),Rg?f.tickCentered(Tf):f.tickOffset=function(){var a=Qf?Oe:Me;return a*Mb()/hc()/2},Rg&&f.categories(Sf),f}function Z(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function $(a){return a in yf?yf[a]:"y"}function _(){var a=Qg?Xg:Rg?qc:null;return Uf&&("function"==typeof Uf?a=Uf:Qg&&(a=function(a){return g.time.format(Uf)(a)})),a}function ab(){var a=hc();return Vf&&a>Wf?Wf:a}function bb(a){return"string"==typeof a?a:a?a.text:null}function cb(a){return"x"===a?Yf:"y"===a?ag:jg}function db(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 eb(){return db(Yf,"inner-right")}function fb(){return db(ag,"inner-top")}function gb(){return db(jg,"inner-top")}function hb(a){return"y2"===a?gb():"y"===a?fb():eb()}function ib(){return bb(Yf)}function jb(){return bb(ag)}function kb(){return bb(jg)}function lb(a,b){return a?b.isLeft?0:b.isCenter?Me/2:Me:b.isBottom?-Oe:b.isMiddle?-Oe/2:0}function mb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function nb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function ob(){return lb(!Qf,eb())}function pb(){return lb(Qf,fb())}function qb(){return lb(Qf,gb())}function rb(){return mb(Qf,fb())}function sb(){return mb(Qf,gb())}function tb(){var a=eb();return Qf?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=fb();return Qf?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=gb();return Qf?a.isInner?"1.2em":"-2.5em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return nb(!Qf,eb())}function xb(){return nb(Qf,fb())}function yb(){return nb(Qf,gb())}function zb(a){var b=0;return g.selectAll("."+a+".axis .tick text").each(function(){var a=this.getBBox();b0)for(f=oc(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 Kb(a){var b,c,d,e,f,h=mc(a);if(xf.length>0)for(f=pc(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 Lb(a){var b,d,e,f,g,h,i,j,k=lc(function(b){return $(b.id)===a}),l="y2"===a?hg:$f,m="y2"===a?gg:Zf,n=c(l)?l:Jb(k),o=c(m)?m:Kb(k),p="y2"===a?ig:_f,q=Ic()&&Qf;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&&dg&&(e=c(dg.top)?dg.top:d,f=c(dg.bottom)?dg.bottom:d),"y2"===a&&mg&&(e=c(mg.top)?mg.top:d,f=c(mg.bottom)?mg.bottom:d),q&&(h=Jc(n,o),i=Rb(jf.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]))),id(k)&&!oc(k)&&(f=n),[n-f,o+e]}function Mb(a){var b=Rb(th),c=Rb(hf.domain());return a||0===c?1:b/c}function Nb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function Ob(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function Pb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Rg?d=0:id(a)?(c=hc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Qb(a){var b=[Nb(a),Ob(a)],c=b[0],d=b[1],e=Pb(a,b),f=Qg?new Date(c.getTime()-e):c-e,g=Qg?new Date(d.getTime()+e):d+e;return[f,g]}function Rb(a){return a[1]-a[0]}function Sb(a){for(var b=0;bd?0:d}function Xb(a){return sf&&a===sf||tf&&Cd(tf,a)}function Yb(a){return!Xb(a)}function Zb(a){return sf?sf:tf?tf[a]:null}function $b(a,b){return a in te.data.x&&te.data.x[a]&&te.data.x[a][b]?te.data.x[a][b]:b}function _b(a){Object.keys(a).forEach(function(b){tf[b]=a[b]})}function ac(a){var b;return a&&(b=wf[a.id],a.name=b?b:a.id),a}function bc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):te.data.x[Object.keys(te.data.x)[0]]}),c=d.map(function(a){var c=vf(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Zb(a);return e=Qg?yd(b[f]):Sg?b[f]?+b[f]:$b(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++})}),zf&&gd(jc(c).filter(function(a){return!(a in Af)}),zf),c.forEach(function(a){Tb(a.id_org,a)}),c)}function ec(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 fc(a){return a>0&&te.data.targets[0].values[a-1]?te.data.targets[0].values[a-1].x:void 0}function gc(a){return a1?te.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?te.data.targets[0]:null,a}function jc(a){return a=d(a)?te.data.targets:a,a.map(function(a){return a.id})}function kc(a){var b,c=jc();for(b=0;ba})}function pc(a){return nc(a,function(a){return a>0})}function qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(Qc(a,f))),a[g].x&&(e=e.concat(Qc(a,g))),Tc(e,b)):Rc(a,b,f,g)}function Sc(a,b){var c;return c=a.map(function(a){return Rc(a.values,b)}),Tc(c,b)}function Tc(a,b){var c,d;return a.forEach(function(a){var e=Dd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Uc(){return Cf&&"desc"===Cf.toLowerCase()}function Vc(){return Cf&&"asc"===Cf.toLowerCase()}function Wc(a){var b=Vc(),c=Uc();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Cf&&a.sort(Cf),a}function Xc(a,b){var d,e,f,g,h,i,j,k=md(te.data.targets),l=k?Pc:Oc,m=a.filter(function(a){return a&&c(a.value)});Hg&&0!==m.length&&(rh.html(Kg(a,_(),l,Wg)).style("visibility","hidden").style("display","block"),d=rh.property("offsetWidth"),e=rh.property("offsetHeight"),k?(g=Me/2+b[0],i=Oe/2+b[1]+20):(Qf?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=hf(m[0].x)+20):(f=q(),g=f+t()+hf(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)),rh.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function Yc(){rh.style("display","none")}function Zc(a){var b=a.filter(function(a){return a&&c(a.value)});Hg&&(jd(te.data.targets)||md(te.data.targets)||oh.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(Qf?"y1":"x1",Kc).attr(Qf?"y2":"x2",Kc))}function $c(){oh.select("line.xgrid-focus").style("visibility","hidden")}function _c(a){return a.x||0===a.x?hf(a.x):null}function ad(a){return W(a.id)(a.value)}function bd(){var a,b,c={},e=0;return lc(pd).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function fd(a,b){return b?2*a.tickOffset()*.6/b:0}function gd(a,b){var c=d(a)?jc():a;"string"==typeof c&&(c=[c]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Wd(a,b,c,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(e(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Xd(b){var c,d,e;if(sh=g.select(ye),sh.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(sh.html(""),te.data.x={},te.data.targets=dc(b),o(),S(),hf.domain(g.extent(Qb(te.data.targets))),jf.domain(Lb("y")),kf.domain(Lb("y2")),lf.domain(hf.domain()),mf.domain(jf.domain()),nf.domain(kf.domain()),th=hf.domain(),hh.scale(lf),De&&lh.scale(hf),mh=g.select(ye).append("svg").attr("width",Me+Je.left+Je.right).attr("height",Oe+Je.top+Je.bottom).on("mouseenter",Ge).on("mouseleave",He),nh=mh.append("defs"),nh.append("clipPath").attr("id",Og).append("rect").attr("width",Me).attr("height",Oe),nh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),oh=mh.append("g").attr("transform",ah.main),ph=Jf?mh.append("g").attr("transform",ah.context):null,qh=Mf?mh.append("g").attr("transform",ah.legend):null,rh=g.select(ye).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),oh.append("g").attr("class","x axis").attr("clip-path",Qf?"":j("xaxis-clip")).attr("transform",ah.x).append("text").attr("class","-axis-x-label").attr("transform",Qf?"rotate(-90)":"").attr("dy",tb).style("text-anchor",wb).text(ib),oh.append("g").attr("class","y axis").attr("clip-path",Qf?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform",Qf?"":"rotate(-90)").attr("dx",rb).style("text-anchor",xb).text(jb),fg&&oh.append("g").attr("class","y2 axis").attr("transform",ah.y2).append("text").attr("class","-axis-y2-label").attr("transform",Qf?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb).text(kb),d=oh.append("g").attr("clip-path",Pg).attr("class","grid"),og&&d.append("g").attr("class","xgrids"),qg&&d.append("g").attr("class","xgrid-lines"),wg&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",Qf?0:-10).attr("x2",Qf?Me:-10).attr("y1",Qf?-10:Je.top).attr("y2",Qf?-10:Oe),rg&&d.append("g").attr("class","ygrids"),sg&&d.append("g").attr("class","ygrid-lines"),oh.append("g").attr("clip-path",Pg).attr("class","regions"),oh.append("g").attr("clip-path",Pg).attr("class","chart"),c=oh.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",De?Qf?"ns-resize":"ew-resize":null),oh.select(".chart").append("g").attr("class","chart-bars"),oh.select(".chart").append("g").attr("class","chart-lines"),oh.select(".chart").append("g").attr("class","chart-arcs").attr("transform",ah.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Fg),oh.select(".chart").append("g").attr("class","chart-texts"),De&&oh.insert("rect",Fe?null:"g.grid").attr("class","zoom-rect").attr("width",Me).attr("height",Oe).style("opacity",0).style("cursor",Qf?"ns-resize":"ew-resize").call(lh).on("dblclick.zoom",null),null!==Xf&&hh.extent("function"!=typeof Xf?Xf:Xf(Qb())),Jf&&(ph.append("g").attr("clip-path",Pg).attr("class","chart"),ph.select(".chart").append("g").attr("class","chart-bars"),ph.select(".chart").append("g").attr("class","chart-lines"),ph.append("g").attr("clip-path",Pg).attr("class","x brush").call(hh).selectAll("rect").attr(Qf?"width":"height",Qf?Ne:Pe),ph.append("g").attr("class","x axis").attr("transform",ah.subx).attr("clip-path",Qf?j("yaxis-clip"):"")),ie(te.data.targets),Qf?oh.select(".x.axis").style("opacity",0).call(of):(oh.select(".y.axis").style("opacity",0).call(pf),oh.select(".y2.axis").style("opacity",0).call(qf)),he({withTransform:!0,withUpdateXDomain:!0,withLegend:!0,durationForAxis:0}),Lg){if(Qg&&"string"==typeof Mg){for(Mg=yd(Mg),e=0;e0){d=[];for(var f in wf)for(c=0;cf&&h>c&&d>i&&j>d):"rect"===this.nodeName&&(c=1*l.attr("x"),d=1*l.attr("y"),e=1*l.attr("width"),k=Jd,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(xe,!n),l.classed(we,!m),k(!m,l,a,b))}))}function ae(a){md(te.data.targets)||Ff&&(Tg=a,oh.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),Ug=!0)}function be(){md(te.data.targets)||Ff&&(oh.select(".dragarea").transition().duration(100).style("opacity",0).remove(),oh.selectAll(".-shape").classed(xe,!1),Ug=!1)}function ce(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,C,D,E,F,G,H,I=bd(),J=md(te.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,F=w?Ie:0,G=e(a.durationForExit)?a.durationForExit:F,H=e(a.durationForAxis)?a.durationForAxis:F,A&&Mf&&ne(te.data.targets,a),z&&(hf.domain(g.extent(Qb(te.data.targets))),th=hf.domain(),De&&lh.scale(hf).updateScaleExtent(),lf.domain(hf.domain()),hh.scale(lf)),y&&(hf.domain(hh.empty()?th:hh.extent()),De&&lh.scale(hf).updateScaleExtent()),jf.domain(Lb("y")),kf.domain(Lb("y2")),oh.select(".x.axis").style("opacity",J?0:1).transition().duration(H).call(of),oh.select(".y.axis").style("opacity",J?0:1).transition().duration(H).call(pf),oh.select(".y2.axis").style("opacity",J?0:1).transition().duration(H).call(qf),B=Rd(I),D=Sd(I,!0),E=Sd(I,!1),oh.select(".x.axis .-axis-x-label").attr("x",ob),oh.select(".y.axis .-axis-y-label").attr("x",pb).attr("dy",ub),oh.select(".y2.axis .-axis-y2-label").attr("x",qb).attr("dy",vb),mf.domain(jf.domain()),nf.domain(kf.domain()),rh.style("display","none"),oh.select("line.xgrid-focus").style("visibility","hidden").attr("y2",Oe),og){if("year"===pg){d=[];for(var K=Qb(),M=K[0].getFullYear(),N=K[1].getFullYear(),O=M;N>=O;O++)d.push(new Date(O+"-01-01 00:00:00"))}else d=hf.ticks(10);b=oh.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",Qf?0:function(a){return hf(a)-of.tickOffset() -}).attr("x2",Qf?Me:function(a){return hf(a)-of.tickOffset()}).attr("y1",Qf?function(a){return hf(a)-of.tickOffset()}:Je.top).attr("y2",Qf?function(a){return hf(a)-of.tickOffset()}:Oe).style("opacity",function(){return+g.select(this).attr(Qf?"y1":"x1")===(Qf?Oe:0)?0:1}),b.exit().remove()}qg&&(f=oh.select(".xgrid-lines").selectAll(".xgrid-line").data(qg),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",Qf?"":"rotate(-90)").attr("dx",Qf?0:-Je.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(F).attr("x1",Qf?0:Lc).attr("x2",Qf?Me:Lc).attr("y1",Qf?Lc:Je.top).attr("y2",Qf?Lc:Oe).style("opacity",1),f.select("text").transition().duration(F).attr("x",Qf?Me:0).attr("y",Lc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(F).style("opacity",0).remove()),u&&rg&&(i=oh.select(".ygrids").selectAll(".ygrid").data(jf.ticks(tg)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",Qf?jf:0).attr("x2",Qf?jf:Me).attr("y1",Qf?0:jf).attr("y2",Qf?Oe:jf),i.exit().remove()),u&&sg&&(j=oh.select(".ygrid-lines").selectAll(".ygrid-line").data(sg),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",Qf?"rotate(-90)":"").attr("dx",Qf?0:-Je.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",Qf?Mc:0).attr("x2",Qf?Mc:Me).attr("y1",Qf?0:Mc).attr("y2",Qf?Oe:Mc).style("opacity",1),j.select("text").transition().duration(F).attr("x",Qf?0:Me).attr("y",Mc).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=oh.selectAll(".-bars").selectAll(".-bar").data(ud),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return Wg(a.id)}).attr("class",Bc),m.style("opacity",Ec).transition().duration(F).attr("d",B).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=oh.selectAll(".-texts").selectAll(".-text").data(wd),o.enter().append("text").attr("class",rc).attr("text-anchor",function(a){return Qf?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Oc(a.value)}),o.style("fill-opacity",Fc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",Hc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),oh.selectAll(".-line").style("opacity",Ec).transition().duration(F).attr("d",ih).style("opacity",1),oh.selectAll(".-area").style("opacity",0).transition().duration(F).attr("d",jh).style("opacity",uh),l=oh.selectAll(".-circles").selectAll(".-circle").data(vd),l.enter().append("circle").attr("class",Ac).style("opacity",0).attr("r",vg),l.style("opacity",Ec).transition().duration(F).style("opacity",Gc).attr("cx",Qf?ad:_c).attr("cy",Qf?_c:ad),l.exit().remove(),oh.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b=Ab(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return Db(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),oh.selectAll(".chart-arc").select("text").attr("transform",Eb).style("opacity",0).transition().duration(F).text(Gb).style("opacity",function(a){return td(a.data)?1:0}),oh.select(".chart-arcs-title").style("opacity",ld(te.data.targets)?1:0),Jf&&(null!==g.event&&"zoom"===g.event.type&&hh.extent(hf.orgDomain()).update(),v&&(ph.select(".x.axis").style("opacity",J?0:1).transition().duration(F).call(rf),hh.empty()||hh.extent(hf.orgDomain()).update(),C=Rd(I,!0),p=ph.selectAll(".-bars").selectAll(".-bar").data(ud),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return Wg(a.id)}).attr("class",Bc),p.style("opacity",Ec).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),ph.selectAll(".-line").style("opacity",Ec).transition().duration(F).attr("d",kh).style("opacity",1))),oh.selectAll(".selected-circles").filter(function(a){return pd(a)}).selectAll("circle").remove(),oh.selectAll(".selected-circle").transition().duration(F).attr("cx",Qf?ad:_c).attr("cy",Qf?_c:ad),tf?(q=oh.select(".event-rects").selectAll(".event-rect").data([0]),Zd(q.enter()),q.attr("x",0).attr("y",0).attr("width",Me).attr("height",Oe)):(Sg?(t=function(a,b){var c=fc(b),d=gc(b);return(hf(d?d:a.x+50)-hf(c?c:a.x-50))/2},s=function(a,b){var c=fc(b);return(hf(a.x)+hf(c?c:a.x-50))/2}):(t=L(),s=function(a){return hf(a.x)-t/2}),r=ic(),oh.select(".event-rects").datum(r?r.values:[]),q=oh.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Yd(q.enter()),q.attr("class",Dc).attr("x",Qf?0:s).attr("y",Qf?s:0).attr("width",Qf?Me:t).attr("height",Qf?t:Oe),q.exit().remove()),n=oh.select(".regions").selectAll("rect.region").data(Gg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Cc).attr("x",Qf?0:Vb).attr("y",Qf?Vb:Je.top).attr("width",Qf?Me:Wb).attr("height",Qf?Wb:Oe).transition().duration(F).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),jc().forEach(function(a){vh[a]=!0})}function de(){ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function ee(){return"mousemove"===g.event.sourceEvent.type&&lh.altDomain?(hf.domain(lh.altDomain),void lh.scale(hf).updateScaleExtent()):(Rg&&hf.orgDomain()[0]===th[0]&&hf.domain([th[0]-1e-10,hf.orgDomain()[1]]),ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(Vg=!0)))}function fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ge(){mh.attr("width",Qe).attr("height",Re),mh.select("#"+Og).select("rect").attr("width",Me).attr("height",Oe),mh.select("#xaxis-clip").select("rect").attr("width",H),mh.select(".zoom-rect").attr("width",Me).attr("height",Oe)}function he(a){a=e(a)?a:{},a.withTransition=e(a.withTransition)?a.withTransition:!0,a.withTransform=e(a.withTransform)?a.withTransform:!1,a.withLegend=e(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.durationForExit=0,o(),S(),ge(),n(a.withTransition),ce(a)}function ie(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=oh.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",sc).style("fill",function(a){return Wg(a.id)}),e=oh.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",wc).style("fill",function(a){return Wg(a.id)}).style("stroke","none").style("cursor",function(a){return Hf(a)?"pointer":null}),c=oh.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",uc).style("opacity",0).style("stroke",function(a){return Wg(a.id)}),b.append("path").attr("class",yc).style("opacity",function(){return uh=+g.select(this).style("opacity"),0}).style("fill",function(a){return Wg(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",vc).style("fill",function(a){return Wg(a.id)}).style("cursor",function(a){return Hf(a)?"pointer":null}),a.forEach(function(a){var b=oe(a.id);oh.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=oh.select(".chart-arcs").selectAll(".chart-arc").data($e(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",xc).style("opacity",0).style("fill",function(a){return Wg(a.data.id)}).style("cursor",function(a){return Hf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){Hb(a.data.id),ke(a.data.id)}).on("mousemove",function(a){var b=[ac({id:a.data.id,value:a.value,ratio:Fb(a)})];Xc(b,g.mouse(this))}).on("mouseout",function(a){Ib(a.data.id),me(),Yc()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jf&&(n=ph.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",wc).style("fill",function(a){return Wg(a.id)}),l=ph.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",uc).style("opacity",0).style("stroke",function(a){return Wg(a.id)})),mh.selectAll(".target").transition().style("opacity",1)}function je(a,b){te.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=bh?i:h,k=bh?Se:Te;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=bh?p:m,Pf?(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=jc(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,bh?(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=qh.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){Of(a)}).on("mouseover",function(a){te.focus(a)}).on("mouseout",function(){te.revert()}),f.append("text").text(function(a){return e(wf[a])?wf[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",bh?h:-200).attr("y",bh?-200:k),f.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",bh?i:-200).attr("y",bh?-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 Wg(a)}).attr("x",bh?h:-200).attr("y",bh?-200:j).attr("width",10).attr("height",10),qh.selectAll("text").data(r).each(function(a,b){c(this,a,0===b)}).transition().duration(q?250:0).attr("x",h).attr("y",k),qh.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",i).attr("y",l),qh.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",g).attr("y",j),N(m),O(p),M(B),o(),S(),ge(),n(!1)}function oe(a){return a?"-"+a.replace(/\./g,"\\."):""}function pe(a){return".target"+oe(a)}function qe(a){return kc(a.id)}function re(a){return"data"in a&&kc(a.data.id)}function se(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 te={data:{}},ue={},ve="_expanded_",we="_selected_",xe="_included_",ye=i(["bindto"],"#chart"),ze=i(["size","width"],null),Ae=i(["size","height"],null),Be=i(["padding","left"],null),Ce=i(["padding","right"],null),De=i(["zoom","enabled"],!1),Ee=i(["zoom","extent"],null),Fe=i(["zoom","privileged"],!1),Ge=i(["onenter"],function(){}),He=i(["onleave"],function(){}),Ie=i(["transition","duration"],350);h("data","data is required in config");var Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se,Te,Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf=i(["data","x"],null),tf=i(["data","xs"],null),uf=i(["data","x_format"],"%Y-%m-%d"),vf=i(["data","id_converter"],function(a){return a}),wf=i(["data","names"],{}),xf=i(["data","groups"],[]),yf=i(["data","axes"],{}),zf=i(["data","type"],null),Af=i(["data","types"],{}),Bf=i(["data","labels"],{}),Cf=i(["data","order"],null),Df=i(["data","regions"],{}),Ef=i(["data","colors"],{}),Ff=i(["data","selection","enabled"],!1),Gf=i(["data","selection","grouped"],!1),Hf=i(["data","selection","isselectable"],function(){return!0}),If=i(["data","selection","multiple"],!0),Jf=i(["subchart","show"],!1),Kf=Jf?i(["subchart","size","height"],60):0,Lf=i(["color","pattern"],null),Mf=i(["legend","show"],!0),Nf=i(["legend","position"],"bottom"),Of=i(["legend","item","onclick"],function(){}),Pf=i(["legend","equally"],!1),Qf=i(["axis","rotated"],!1),Rf=i(["axis","x","type"],"indexed"),Sf=i(["axis","x","categories"],[]),Tf=i(["axis","x","tick","centered"],!1),Uf=i(["axis","x","tick","format"],null),Vf=i(["axis","x","tick","culling"],"categorized"===Rf?!1:!0),Wf=i(["axis","x","tick","count"],10),Xf=i(["axis","x","default"],null),Yf=i(["axis","x","label"],null),Zf=i(["axis","y","max"],null),$f=i(["axis","y","min"],null),_f=i(["axis","y","center"],null),ag=i(["axis","y","label"],null),bg=i(["axis","y","inner"],!1),cg=i(["axis","y","tick","format"],null),dg=i(["axis","y","padding"],null),eg=i(["axis","y","ticks"],10),fg=i(["axis","y2","show"],!1),gg=i(["axis","y2","max"],null),hg=i(["axis","y2","min"],null),ig=i(["axis","y2","center"],null),jg=i(["axis","y2","label"],null),kg=i(["axis","y2","inner"],!1),lg=i(["axis","y2","tick","format"],null),mg=i(["axis","y2","padding"],null),ng=i(["axis","y2","ticks"],10),og=i(["grid","x","show"],!1),pg=i(["grid","x","type"],"tick"),qg=i(["grid","x","lines"],null),rg=i(["grid","y","show"],!1),sg=i(["grid","y","lines"],null),tg=i(["grid","y","ticks"],10),ug=i(["point","show"],!0),vg=ug?i(["point","r"],2.5):0,wg=i(["point","focus","line","enabled"],!0),xg=i(["point","focus","expand","enabled"],!0),yg=i(["point","focus","expand","r"],xg?4:vg),zg=i(["point","focus","select","r"],8),Ag=i(["point","onclick"],function(){}),Bg=i(["point","onselected"],function(){}),Cg=i(["point","onunselected"],function(){}),Dg=i(["arc","label","show"],!0),Eg=i(["arc","label","format"],null),Fg=i(["arc","title"],""),Gg=i(["regions"],[]),Hg=i(["tooltip","show"],!0),Ig=i(["tooltip","format","title"],null),Jg=i(["tooltip","format","value"],null),Kg=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=Ig?Ig:b,k=Jg?Jg:c;for(f=0;f"+(g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+=""+i+""+h+"");return e+""}),Lg=i(["tooltip","init","show"],!1),Mg=i(["tooltip","init","x"],0),Ng=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Og=ye.replace("#","")+"-clip",Pg=j(Og),Qg="timeseries"===Rf,Rg="categorized"===Rf,Sg=!Qg&&(sf||tf),Tg=null,Ug=!1,Vg=!1,Wg=xd(Ef,Lf),Xg=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)}}(),Yg=Qf?"left":"bottom",Zg=Qf?bg?"top":"bottom":bg?"right":"left",$g=Qf?kg?"bottom":"top":kg?"left":"right",_g=Qf?"left":"bottom",ah={main:function(){return"translate("+Je.left+","+Je.top+")"},context:function(){return"translate("+Ke.left+","+Ke.top+")"},legend:function(){return"translate("+Le.left+","+Le.top+")"},x:function(){return"translate(0,"+(Qf?0:Oe)+")"},y:function(){return"translate(0,"+(Qf?Oe:0)+")"},y2:function(){return"translate("+(Qf?0:Me)+","+(Qf?1:0)+")"},subx:function(){return"translate(0,"+(Qf?0:Pe)+")"},arc:function(){return"translate("+Me/2+","+Oe/2+")"}},bh="right"===Nf,ch=0,dh=0,eh=0,fh=40,gh=20;$e=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hh,ih=function(){var a=g.svg.line().x(Qf?function(a){return W(a.id)(a.value)}:Kc).y(Qf?Kc:function(a){return W(a.id)(a.value)});return function(b){var c,d,e=Kd(b.values);return nd(b)?(a.interpolate(od(b)?"cardinal":"linear"),Df[b.id]?Wd(e,hf,W(b.id),Df[b.id]):a(e)):(c=hf(e[0].x),d=W(b.id)(e[0].value),Qf?"M "+d+" "+c:"M "+c+" "+d)}}(),jh=function(){var a;return a=Qf?g.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Kc):g.svg.area().x(Kc).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Kd(b.values);return hd([b],"area")||hd([b],"area-spline")?(a.interpolate(od(b)?"cardinal":"linear"),a(e)):(c=hf(e[0].x),d=W(b.id)(e[0].value),Qf?"M "+d+" "+c:"M "+c+" "+d)}}(),kh=function(){var a=g.svg.line().x(Qf?function(a){return X(a.id)(a.value)}:Nc).y(Qf?Nc:function(a){return X(a.id)(a.value)});return function(b){var c=Kd(b.values);return nd(b)?a(c):"M "+lf(c[0].x)+" "+X(b.id)(c[0].value)}}(),lh=function(){};hh=g.svg.brush().on("brush",de),hh.update=function(){return ph&&ph.select(".x.brush").call(this),this},hh.scale=function(a){return Qf?this.y(a):this.x(a)},De&&(lh=g.behavior.zoom().on("zoomstart",function(){lh.altDomain=g.event.sourceEvent.altKey?hf.orgDomain():null}).on("zoom",De?ee:null),lh.scale=function(a){return Qf?this.y(a):this.x(a)},lh.orgScaleExtent=function(){var a=Ee?Ee:[1,10];return[a[0],Math.max(hc()/a[1],a[1])]},lh.updateScaleExtent=function(){var a=Rb(hf.orgDomain())/Rb(th),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mh,nh,oh,ph,qh,rh,sh,th,uh,vh={};if(te.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=mh.selectAll(pe(a)),d=c.filter(qe),e=c.filter(re);te.revert(),te.defocus(),b(d.classed("focused",!0)),b(e),md(te.data.targets)&&Hb(a,!0),ke(a)},te.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=mh.selectAll(pe(a)),d=c.filter(qe),e=c.filter(re);te.revert(),b(d.classed("focused",!1)),b(e),md(te.data.targets)&&Ib(a),le(a)},te.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=mh.selectAll(pe(a)),d=c.filter(qe),e=c.filter(re);b(d.classed("focused",!1)),b(e),md(te.data.targets)&&Ib(a),me()},te.show=function(a){mh.selectAll(pe(a)).transition().style("opacity",1)},te.hide=function(a){mh.selectAll(pe(a)).transition().style("opacity",0)},te.unzoom=function(){hh.clear().update(),ce({withUpdateXDomain:!0})},te.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&_b(a.xs),"categories"in a&&Rg&&(Sf=a.categories,of.categories(Sf)),"cacheIds"in a&&Sb(a.cacheIds))return void je(Ub(a.cacheIds),a.done);if("data"in a)je(dc(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){je(dc(c),a.done)});else if("rows"in a)je(dc(bc(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");je(dc(cc(a.columns)),a.done)}},te.unload=function(a){te.data.targets=te.data.targets.filter(function(b){return b.id!==a}),mh.selectAll(pe(a)).transition().style("opacity",0).remove(),Mf&&qh.selectAll(".legend-item"+oe(a)).remove(),te.data.targets.length>0&&ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},te.selected=function(a){var b=oe(a);return g.merge(oh.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(we)}).map(function(a){return a.map(function(a){return a.__data__})}))},te.select=function(a,b,c){Ff&&oh.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?Ed:Hd,i="circle"===this.nodeName?Fd:Id,j=Gf||!a||a.indexOf(d.id)>=0,k=!b||b.indexOf(f)>=0;j&&k?Hf(d)&&h(g.select(this).classed(we,!0),d,f):e(c)&&c&&i(g.select(this).classed(we,!1),d,f)})},te.unselect=function(a,b){Ff&&oh.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var e="circle"===this.nodeName?Fd:Id,f=Gf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0;f&&h&&Hf(c)&&e(g.select(this).classed(we,!1),c,d)})},te.toLine=function(a){gd(a,"line"),he()},te.toSpline=function(a){gd(a,"spline"),he()},te.toBar=function(a){gd(a,"bar"),he()},te.toScatter=function(a){gd(a,"scatter"),he()},te.toArea=function(a){gd(a,"area"),he()},te.toAreaSpline=function(a){gd(a,"area-spline"),he()},te.toPie=function(a){gd(a,"pie"),he({withTransform:!0})},te.toDonut=function(a){gd(a,"donut"),he({withTransform:!0})},te.groups=function(a){return d(a)?xf:(xf=a,ce(),xf)},te.xgrids=function(a){return a?(qg=a,ce(),qg):qg},te.xgrids.add=function(a){return a?te.xgrids(qg.concat(a)):void 0},te.xgrids.remove=function(a){var b=se(a);return te.xgrids(qg.filter(b))},te.ygrids=function(a){return a?(sg=a,ce(),sg):sg},te.ygrids.add=function(a){return a?te.ygrids(sg.concat(a)):void 0},te.ygrids.remove=function(a){var b=se(a);return te.ygrids(sg.filter(b))},te.regions=function(a){return d(a)?Gg:(Gg=a,ce(),Gg)},te.regions.add=function(a){return d(a)?Gg:(Gg=Gg.concat(a),ce(),Gg)},te.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;mh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gg=Gg.filter(function(b){return b.classes.indexOf(a)<0})}),Gg},te.data.get=function(a){var b=te.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},te.data.getAsTarget=function(a){var b=lc(function(b){return b.id===a});return b.length>0?b[0]:void 0},te.resize=function(a){ze=a?a.width:null,Ae=a?a.height:null,he({withLegend:!0,withTransition:!1})},te.destroy=function(){te.data.targets=void 0,te.data.x={},sh.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){Xd(b)});else if("rows"in f.data)Xd(bc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Xd(cc(f.data.columns))}return te}}(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 kd(re.data.targets)?0:ze?ze:_f?1:v("y")}function u(){return kd(re.data.targets)?0:Ae?Ae:_g?Re+(dg&&!Of?v("y2"):1):dg?ig||Of?1:v("y2"):1}function v(a){var b=fb(a);return b.isInner?20+xb(a):40+xb(a)}function w(a){var b=fb(a);return(b.isInner?30:40)+("y2"===a?-10:0)}function x(){return+g.select(we).style("width").replace("px","")}function y(){return+g.select(we).style("height").replace("px","")}function z(a){return a?-1:-(He.left-1)}function A(a){return a?-20:-1}function B(){return z(!Of)}function C(){return A(!Of)}function D(){return z(Of)}function E(){return A(Of)}function F(a){return a?Ke+2:He.left+20}function G(a){return a?80:Me+2}function H(){return F(!Of)}function I(){return G(!Of)}function J(){return F(Of)}function K(){return G(Of)}function L(){var a=Of?Me:Ke,b=Kb(),c=fc();return c>1?a*b/(c-1):a}function M(a){ah=a}function N(a){bh=a}function O(a){ch=a}function P(){return Kf?_g?bh*(ah+1):Oe:0}function Q(){return Kf?_g?Pe:ch*(ah+1):0}function R(){var a,b,c=!ff;Ze=Of?1:0,$e=Of?Me:Ke,_e=Of?0:Me,af=Of?Ke:1,bf=Ze,cf=$e,df=Of?0:Ne,ef=Of?Le:1,ff=T(Ze,$e,c?void 0:ff.domain(),function(){return mf.tickOffset()}),gf=U(_e,af),hf=U(_e,af),jf=T(Ze,$e,rh,function(a){return a%1?0:pf.tickOffset()}),kf=U(df,ef),lf=U(df,ef),a=$(),b=_(),mf=X(ff,Wg,a,b),pf=X(jf,Zg,a,b),nf=Y(gf,Xg,ag,cg),of=Y(hf,Yg,jg,lg),c||(fh.scale(jf),Be&&jh.scale(ff)),S()}function S(){Ve=zb(),We=Ab(),Xe=Ab(.98)}function T(a,b,c,f){var h=(Og?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}),Pg){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 U(a,b){return g.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hf:gf}function W(a){return"y2"===Z(a)?lf:kf}function X(a,c,d,e){var f=(Pg?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),Pg?f.tickCentered(Rf):f.tickOffset=function(){var a=Of?Me:Ke;return a*Kb()/fc()/2},Pg&&f.categories(Qf),f}function Y(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wf?wf[a]:"y"}function $(){var a=Og?Vg:Pg?oc:null;return Sf&&("function"==typeof Sf?a=Sf:Og&&(a=function(a){return g.time.format(Sf)(a)})),a}function _(){var a=fc();return Tf&&a>Uf?Uf:a}function ab(a){return"string"==typeof a?a:a?a.text:null}function bb(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 cb(){return bb(Wf,"inner-right")}function db(){return bb($f,"inner-top")}function eb(){return bb(hg,"inner-top")}function fb(a){return"y2"===a?eb():"y"===a?db():cb()}function gb(){return ab(Wf)}function hb(){return ab($f)}function ib(){return ab(hg)}function jb(a,b){return a?b.isLeft?0:b.isCenter?Ke/2:Ke:b.isBottom?-Me:b.isMiddle?-Me/2:0}function kb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function lb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function mb(){return jb(!Of,cb())}function nb(){return jb(Of,db())}function ob(){return jb(Of,eb())}function pb(){return kb(Of,db())}function qb(){return kb(Of,eb())}function rb(){var a=cb();return Of?a.isInner?"1.2em":-30-xb("x"):a.isInner?"-0.5em":"3em"}function sb(){var a=db();return Of?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-xb("y")}function tb(){var a=eb();return Of?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+xb("y2")}function ub(){return lb(!Of,cb())}function vb(){return lb(Of,db())}function wb(){return lb(Of,eb())}function xb(a){var b=0;return g.selectAll("."+a+".axis .tick text").each(function(){var a=this.getBBox();b0)for(f=mc(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 Ib(a){var b,c,d,e,f,h=kc(a);if(vf.length>0)for(f=nc(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 Jb(a){var b,d,e,f,g,h,i,j,k=jc(function(b){return Z(b.id)===a}),l="y2"===a?fg:Yf,m="y2"===a?eg:Xf,n=c(l)?l:Hb(k),o=c(m)?m:Ib(k),p="y2"===a?gg:Zf,q=Gc()&&Of;return n===o&&(0>n?o=0:n=0),b=Math.abs(o-n),d=e=f=q?0:.1*b,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&bg&&(e=c(bg.top)?bg.top:d,f=c(bg.bottom)?bg.bottom:d),"y2"===a&&kg&&(e=c(kg.top)?kg.top:d,f=c(kg.bottom)?kg.bottom:d),q&&(h=Hc(n,o),i=Pb(gf.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]))),gd(k)&&!mc(k)&&(f=n),[n-f,o+e]}function Kb(a){var b=Pb(rh),c=Pb(ff.domain());return a||0===c?1:b/c}function Lb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function Mb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function Nb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Pg?d=0:gd(a)?(c=fc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Ob(a){var b=[Lb(a),Mb(a)],c=b[0],d=b[1],e=Nb(a,b),f=Og?new Date(c.getTime()-e):c-e,g=Og?new Date(d.getTime()+e):d+e;return[f,g]}function Pb(a){return a[1]-a[0]}function Qb(a){for(var b=0;bd?0:d}function Vb(a){return qf&&a===qf||rf&&Ad(rf,a)}function Wb(a){return!Vb(a)}function Xb(a){return qf?qf:rf?rf[a]:null}function Yb(a,b){return a in re.data.x&&re.data.x[a]&&re.data.x[a][b]?re.data.x[a][b]:b}function Zb(a){Object.keys(a).forEach(function(b){rf[b]=a[b]})}function $b(a){var b;return a&&(b=uf[a.id],a.name=b?b:a.id),a}function _b(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):re.data.x[Object.keys(re.data.x)[0]]}),c=d.map(function(a){var c=tf(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Xb(a);return e=Og?wd(b[f]):Qg?b[f]?+b[f]:Yb(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++})}),xf&&ed(hc(c).filter(function(a){return!(a in yf)}),xf),c.forEach(function(a){Rb(a.id_org,a)}),c)}function cc(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 dc(a){return a>0&&re.data.targets[0].values[a-1]?re.data.targets[0].values[a-1].x:void 0}function ec(a){return a1?re.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?re.data.targets[0]:null,a}function hc(a){return a=d(a)?re.data.targets:a,a.map(function(a){return a.id})}function ic(a){var b,c=hc();for(b=0;ba})}function nc(a){return lc(a,function(a){return a>0})}function oc(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 Af&&"desc"===Af.toLowerCase()}function Tc(){return Af&&"asc"===Af.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 Af&&a.sort(Af),a}function Vc(a,b){var d,e,f,g,h,i,j,k=kd(re.data.targets),l=k?Nc:Mc,m=a.filter(function(a){return a&&c(a.value)});Fg&&0!==m.length&&(ph.html(Ig(a,$(),l,Ug)).style("visibility","hidden").style("display","block"),d=ph.property("offsetWidth"),e=ph.property("offsetHeight"),k?(g=Ke/2+b[0],i=Me/2+b[1]+20):(Of?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=ff(m[0].x)+20):(f=q(),g=f+t()+ff(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)),ph.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function Wc(){ph.style("display","none")}function Xc(a){var b=a.filter(function(a){return a&&c(a.value)});Fg&&(hd(re.data.targets)||kd(re.data.targets)||mh.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(Of?"y1":"x1",Ic).attr(Of?"y2":"x2",Ic))}function Yc(){mh.select("line.xgrid-focus").style("visibility","hidden")}function Zc(a){return a.x||0===a.x?ff(a.x):null}function $c(a){return V(a.id)(a.value)}function _c(){var a,b,c={},e=0;return jc(nd).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function dd(a,b){return b?2*a.tickOffset()*.6/b:0}function ed(a,b){var c=d(a)?hc():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 Ud(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 Vd(b){var c,d,e;if(qh=g.select(we),qh.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(qh.html(""),re.data.x={},re.data.targets=bc(b),o(),R(),ff.domain(g.extent(Ob(re.data.targets))),gf.domain(Jb("y")),hf.domain(Jb("y2")),jf.domain(ff.domain()),kf.domain(gf.domain()),lf.domain(hf.domain()),rh=ff.domain(),fh.scale(jf),Be&&jh.scale(ff),kh=g.select(we).append("svg").attr("width",Ke+He.left+He.right).attr("height",Me+He.top+He.bottom).on("mouseenter",Ee).on("mouseleave",Fe),lh=kh.append("defs"),lh.append("clipPath").attr("id",Mg).append("rect").attr("width",Ke).attr("height",Me),lh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mh=kh.append("g").attr("transform",$g.main),nh=Hf?kh.append("g").attr("transform",$g.context):null,oh=Kf?kh.append("g").attr("transform",$g.legend):null,ph=g.select(we).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),mh.append("g").attr("class","x axis").attr("clip-path",Of?"":j("xaxis-clip")).attr("transform",$g.x).append("text").attr("class","-axis-x-label").attr("transform",Of?"rotate(-90)":"").attr("dy",rb).style("text-anchor",ub).text(gb),mh.append("g").attr("class","y axis").attr("clip-path",Of?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform",Of?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(hb),dg&&mh.append("g").attr("class","y2 axis").attr("transform",$g.y2).append("text").attr("class","-axis-y2-label").attr("transform",Of?"":"rotate(-90)").attr("dx",qb).style("text-anchor",wb).text(ib),d=mh.append("g").attr("clip-path",Ng).attr("class","grid"),mg&&d.append("g").attr("class","xgrids"),og&&d.append("g").attr("class","xgrid-lines"),ug&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",Of?0:-10).attr("x2",Of?Ke:-10).attr("y1",Of?-10:He.top).attr("y2",Of?-10:Me),pg&&d.append("g").attr("class","ygrids"),qg&&d.append("g").attr("class","ygrid-lines"),mh.append("g").attr("clip-path",Ng).attr("class","regions"),mh.append("g").attr("clip-path",Ng).attr("class","chart"),c=mh.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",Be?Of?"ns-resize":"ew-resize":null),mh.select(".chart").append("g").attr("class","chart-bars"),mh.select(".chart").append("g").attr("class","chart-lines"),mh.select(".chart").append("g").attr("class","chart-arcs").attr("transform",$g.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Dg),mh.select(".chart").append("g").attr("class","chart-texts"),Be&&mh.insert("rect",De?null:"g.grid").attr("class","zoom-rect").attr("width",Ke).attr("height",Me).style("opacity",0).style("cursor",Of?"ns-resize":"ew-resize").call(jh).on("dblclick.zoom",null),null!==Vf&&fh.extent("function"!=typeof Vf?Vf:Vf(Ob())),Hf&&(nh.append("g").attr("clip-path",Ng).attr("class","chart"),nh.select(".chart").append("g").attr("class","chart-bars"),nh.select(".chart").append("g").attr("class","chart-lines"),nh.append("g").attr("clip-path",Ng).attr("class","x brush").call(fh).selectAll("rect").attr(Of?"width":"height",Of?Le:Ne),nh.append("g").attr("class","x axis").attr("transform",$g.subx).attr("clip-path",Of?j("yaxis-clip"):"")),ge(re.data.targets),Of?mh.select(".x.axis").style("opacity",0).call(mf):(mh.select(".y.axis").style("opacity",0).call(nf),mh.select(".y2.axis").style("opacity",0).call(of)),fe({withTransform:!0,withUpdateXDomain:!0,withLegend:!0,durationForAxis:0}),Jg){if(Og&&"string"==typeof Kg){for(Kg=wd(Kg),e=0;e0){d=[];for(var f in uf)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(ve,!n),l.classed(ue,!m),k(!m,l,a,b))}))}function $d(a){kd(re.data.targets)||Df&&(Rg=a,mh.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),Sg=!0)}function _d(){kd(re.data.targets)||Df&&(mh.select(".dragarea").transition().duration(100).style("opacity",0).remove(),mh.selectAll(".-shape").classed(ve,!1),Sg=!1)}function ae(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,C,D,E,F,G,H,I=_c(),J=kd(re.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,F=w?Ge:0,G=e(a.durationForExit)?a.durationForExit:F,H=e(a.durationForAxis)?a.durationForAxis:F,A&&Kf&&le(re.data.targets,a),z&&(ff.domain(g.extent(Ob(re.data.targets))),rh=ff.domain(),Be&&jh.scale(ff).updateScaleExtent(),jf.domain(ff.domain()),fh.scale(jf)),y&&(ff.domain(fh.empty()?rh:fh.extent()),Be&&jh.scale(ff).updateScaleExtent()),gf.domain(Jb("y")),hf.domain(Jb("y2")),mh.select(".x.axis").style("opacity",J?0:1).transition().duration(H).call(mf),mh.select(".y.axis").style("opacity",J?0:1).transition().duration(H).call(nf),mh.select(".y2.axis").style("opacity",J?0:1).transition().duration(H).call(of),B=Pd(I),D=Qd(I,!0),E=Qd(I,!1),mh.select(".x.axis .-axis-x-label").attr("x",mb),mh.select(".y.axis .-axis-y-label").attr("x",nb).attr("dy",sb),mh.select(".y2.axis .-axis-y2-label").attr("x",ob).attr("dy",tb),kf.domain(gf.domain()),lf.domain(hf.domain()),ph.style("display","none"),mh.select("line.xgrid-focus").style("visibility","hidden").attr("y2",Me),mg){if("year"===ng){d=[];for(var K=Ob(),M=K[0].getFullYear(),N=K[1].getFullYear(),O=M;N>=O;O++)d.push(new Date(O+"-01-01 00:00:00"))}else d=ff.ticks(10);b=mh.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",Of?0:function(a){return ff(a)-mf.tickOffset()}).attr("x2",Of?Ke:function(a){return ff(a)-mf.tickOffset() +}).attr("y1",Of?function(a){return ff(a)-mf.tickOffset()}:He.top).attr("y2",Of?function(a){return ff(a)-mf.tickOffset()}:Me).style("opacity",function(){return+g.select(this).attr(Of?"y1":"x1")===(Of?Me:0)?0:1}),b.exit().remove()}og&&(f=mh.select(".xgrid-lines").selectAll(".xgrid-line").data(og),h=f.enter().append("g").attr("class",function(a){return"xgrid-line xgrid-line-"+(a["class"]?a["class"]:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",Of?"":"rotate(-90)").attr("dx",Of?0:-He.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(F).attr("x1",Of?0:Jc).attr("x2",Of?Ke:Jc).attr("y1",Of?Jc:He.top).attr("y2",Of?Jc:Me).style("opacity",1),f.select("text").transition().duration(F).attr("x",Of?Ke:0).attr("y",Jc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(F).style("opacity",0).remove()),u&&pg&&(i=mh.select(".ygrids").selectAll(".ygrid").data(gf.ticks(rg)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",Of?gf:0).attr("x2",Of?gf:Ke).attr("y1",Of?0:gf).attr("y2",Of?Me:gf),i.exit().remove()),u&&qg&&(j=mh.select(".ygrid-lines").selectAll(".ygrid-line").data(qg),k=j.enter().append("g").attr("class",function(a){return"ygrid-line ygrid-line-"+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Of?"rotate(-90)":"").attr("dx",Of?0:-He.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",Of?Kc:0).attr("x2",Of?Kc:Ke).attr("y1",Of?0:Kc).attr("y2",Of?Me:Kc).style("opacity",1),j.select("text").transition().duration(F).attr("x",Of?0:Ke).attr("y",Kc).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=mh.selectAll(".-bars").selectAll(".-bar").data(sd),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return Ug(a.id)}).attr("class",zc),m.style("opacity",Cc).transition().duration(F).attr("d",B).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=mh.selectAll(".-texts").selectAll(".-text").data(ud),o.enter().append("text").attr("class",pc).attr("text-anchor",function(a){return Of?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Mc(a.value)}),o.style("fill-opacity",Dc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",Fc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),mh.selectAll(".-line").style("opacity",Cc).transition().duration(F).attr("d",gh).style("opacity",1),mh.selectAll(".-area").style("opacity",0).transition().duration(F).attr("d",hh).style("opacity",sh),l=mh.selectAll(".-circles").selectAll(".-circle").data(td),l.enter().append("circle").attr("class",yc).style("opacity",0).attr("r",tg),l.style("opacity",Cc).transition().duration(F).style("opacity",Ec).attr("cx",Of?$c:Zc).attr("cy",Of?Zc:$c),l.exit().remove(),mh.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b=yb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return Bb(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),mh.selectAll(".chart-arc").select("text").attr("transform",Cb).style("opacity",0).transition().duration(F).text(Eb).style("opacity",function(a){return rd(a.data)?1:0}),mh.select(".chart-arcs-title").style("opacity",jd(re.data.targets)?1:0),Hf&&(null!==g.event&&"zoom"===g.event.type&&fh.extent(ff.orgDomain()).update(),v&&(nh.select(".x.axis").style("opacity",J?0:1).transition().duration(F).call(pf),fh.empty()||fh.extent(ff.orgDomain()).update(),C=Pd(I,!0),p=nh.selectAll(".-bars").selectAll(".-bar").data(sd),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return Ug(a.id)}).attr("class",zc),p.style("opacity",Cc).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),nh.selectAll(".-line").style("opacity",Cc).transition().duration(F).attr("d",ih).style("opacity",1))),mh.selectAll(".selected-circles").filter(function(a){return nd(a)}).selectAll("circle").remove(),mh.selectAll(".selected-circle").transition().duration(F).attr("cx",Of?$c:Zc).attr("cy",Of?Zc:$c),rf?(q=mh.select(".event-rects").selectAll(".event-rect").data([0]),Xd(q.enter()),q.attr("x",0).attr("y",0).attr("width",Ke).attr("height",Me)):(Qg?(t=function(a,b){var c=dc(b),d=ec(b);return(ff(d?d:a.x+50)-ff(c?c:a.x-50))/2},s=function(a,b){var c=dc(b);return(ff(a.x)+ff(c?c:a.x-50))/2}):(t=L(),s=function(a){return ff(a.x)-t/2}),r=gc(),mh.select(".event-rects").datum(r?r.values:[]),q=mh.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Wd(q.enter()),q.attr("class",Bc).attr("x",Of?0:s).attr("y",Of?s:0).attr("width",Of?Ke:t).attr("height",Of?t:Me),q.exit().remove()),n=mh.select(".regions").selectAll("rect.region").data(Eg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Ac).attr("x",Of?0:Tb).attr("y",Of?Tb:He.top).attr("width",Of?Ke:Ub).attr("height",Of?Ub:Me).transition().duration(F).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),hc().forEach(function(a){th[a]=!0})}function be(){ae({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function ce(){return"mousemove"===g.event.sourceEvent.type&&jh.altDomain?(ff.domain(jh.altDomain),void jh.scale(ff).updateScaleExtent()):(Pg&&ff.orgDomain()[0]===rh[0]&&ff.domain([rh[0]-1e-10,ff.orgDomain()[1]]),ae({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(Tg=!0)))}function de(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ee(){kh.attr("width",Oe).attr("height",Pe),kh.select("#"+Mg).select("rect").attr("width",Ke).attr("height",Me),kh.select("#xaxis-clip").select("rect").attr("width",H),kh.select(".zoom-rect").attr("width",Ke).attr("height",Me)}function fe(a){a=e(a)?a:{},a.withTransition=e(a.withTransition)?a.withTransition:!0,a.withTransform=e(a.withTransform)?a.withTransform:!1,a.withLegend=e(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.durationForExit=0,o(),R(),ee(),n(a.withTransition),ae(a)}function ge(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=mh.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",qc).style("fill",function(a){return Ug(a.id)}),e=mh.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",uc).style("fill",function(a){return Ug(a.id)}).style("stroke","none").style("cursor",function(a){return Ff(a)?"pointer":null}),c=mh.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",sc).style("opacity",0).style("stroke",function(a){return Ug(a.id)}),b.append("path").attr("class",wc).style("opacity",function(){return sh=+g.select(this).style("opacity"),0}).style("fill",function(a){return Ug(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",tc).style("fill",function(a){return Ug(a.id)}).style("cursor",function(a){return Ff(a)?"pointer":null}),a.forEach(function(a){var b=me(a.id);mh.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=mh.select(".chart-arcs").selectAll(".chart-arc").data(Ye(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",vc).style("opacity",0).style("fill",function(a){return Ug(a.data.id)}).style("cursor",function(a){return Ff(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){Fb(a.data.id),ie(a.data.id)}).on("mousemove",function(a){var b=[$b({id:a.data.id,value:a.value,ratio:Db(a)})];Vc(b,g.mouse(this))}).on("mouseout",function(a){Gb(a.data.id),ke(),Wc()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Hf&&(n=nh.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",uc).style("fill",function(a){return Ug(a.id)}),l=nh.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",sc).style("opacity",0).style("stroke",function(a){return Ug(a.id)})),kh.selectAll(".target").transition().style("opacity",1)}function he(a,b){re.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=_g?i:h,k=_g?Qe:Re;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=_g?p:m,Nf?(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=hc(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,_g?(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=oh.selectAll(".legend-item").data(r).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Mf(a)}).on("mouseover",function(a){re.focus(a)}).on("mouseout",function(){re.revert()}),f.append("text").text(function(a){return e(uf[a])?uf[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",_g?h:-200).attr("y",_g?-200:k),f.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",_g?i:-200).attr("y",_g?-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 Ug(a)}).attr("x",_g?h:-200).attr("y",_g?-200:j).attr("width",10).attr("height",10),oh.selectAll("text").data(r).each(function(a,b){c(this,a,0===b)}).transition().duration(q?250:0).attr("x",h).attr("y",k),oh.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",i).attr("y",l),oh.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",g).attr("y",j),N(m),O(p),M(B),o(),R(),ee(),n(!1)}function me(a){return a?"-"+a.replace(/\./g,"\\."):""}function ne(a){return".target"+me(a)}function oe(a){return ic(a.id)}function pe(a){return"data"in a&&ic(a.data.id)}function qe(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 re={data:{}},se={},te="_expanded_",ue="_selected_",ve="_included_",we=i(["bindto"],"#chart"),xe=i(["size","width"],null),ye=i(["size","height"],null),ze=i(["padding","left"],null),Ae=i(["padding","right"],null),Be=i(["zoom","enabled"],!1),Ce=i(["zoom","extent"],null),De=i(["zoom","privileged"],!1),Ee=i(["onenter"],function(){}),Fe=i(["onleave"],function(){}),Ge=i(["transition","duration"],350);h("data","data is required in config");var He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se,Te,Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf=i(["data","x"],null),rf=i(["data","xs"],null),sf=i(["data","x_format"],"%Y-%m-%d"),tf=i(["data","id_converter"],function(a){return a}),uf=i(["data","names"],{}),vf=i(["data","groups"],[]),wf=i(["data","axes"],{}),xf=i(["data","type"],null),yf=i(["data","types"],{}),zf=i(["data","labels"],{}),Af=i(["data","order"],null),Bf=i(["data","regions"],{}),Cf=i(["data","colors"],{}),Df=i(["data","selection","enabled"],!1),Ef=i(["data","selection","grouped"],!1),Ff=i(["data","selection","isselectable"],function(){return!0}),Gf=i(["data","selection","multiple"],!0),Hf=i(["subchart","show"],!1),If=Hf?i(["subchart","size","height"],60):0,Jf=i(["color","pattern"],null),Kf=i(["legend","show"],!0),Lf=i(["legend","position"],"bottom"),Mf=i(["legend","item","onclick"],function(){}),Nf=i(["legend","equally"],!1),Of=i(["axis","rotated"],!1),Pf=i(["axis","x","type"],"indexed"),Qf=i(["axis","x","categories"],[]),Rf=i(["axis","x","tick","centered"],!1),Sf=i(["axis","x","tick","format"],null),Tf=i(["axis","x","tick","culling"],"categorized"===Pf?!1:!0),Uf=i(["axis","x","tick","count"],10),Vf=i(["axis","x","default"],null),Wf=i(["axis","x","label"],null),Xf=i(["axis","y","max"],null),Yf=i(["axis","y","min"],null),Zf=i(["axis","y","center"],null),$f=i(["axis","y","label"],null),_f=i(["axis","y","inner"],!1),ag=i(["axis","y","tick","format"],null),bg=i(["axis","y","padding"],null),cg=i(["axis","y","ticks"],10),dg=i(["axis","y2","show"],!1),eg=i(["axis","y2","max"],null),fg=i(["axis","y2","min"],null),gg=i(["axis","y2","center"],null),hg=i(["axis","y2","label"],null),ig=i(["axis","y2","inner"],!1),jg=i(["axis","y2","tick","format"],null),kg=i(["axis","y2","padding"],null),lg=i(["axis","y2","ticks"],10),mg=i(["grid","x","show"],!1),ng=i(["grid","x","type"],"tick"),og=i(["grid","x","lines"],null),pg=i(["grid","y","show"],!1),qg=i(["grid","y","lines"],null),rg=i(["grid","y","ticks"],10),sg=i(["point","show"],!0),tg=sg?i(["point","r"],2.5):0,ug=i(["point","focus","line","enabled"],!0),vg=i(["point","focus","expand","enabled"],!0),wg=i(["point","focus","expand","r"],vg?4:tg),xg=i(["point","focus","select","r"],8),yg=i(["point","onclick"],function(){}),zg=i(["point","onselected"],function(){}),Ag=i(["point","onunselected"],function(){}),Bg=i(["arc","label","show"],!0),Cg=i(["arc","label","format"],null),Dg=i(["arc","title"],""),Eg=i(["regions"],[]),Fg=i(["tooltip","show"],!0),Gg=i(["tooltip","format","title"],null),Hg=i(["tooltip","format","value"],null),Ig=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=Gg?Gg:b,k=Hg?Hg:c;for(f=0;f"+(g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+=""+i+""+h+"");return e+""}),Jg=i(["tooltip","init","show"],!1),Kg=i(["tooltip","init","x"],0),Lg=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Mg=we.replace("#","")+"-clip",Ng=j(Mg),Og="timeseries"===Pf,Pg="categorized"===Pf,Qg=!Og&&(qf||rf),Rg=null,Sg=!1,Tg=!1,Ug=vd(Cf,Jf),Vg=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)}}(),Wg=Of?"left":"bottom",Xg=Of?_f?"top":"bottom":_f?"right":"left",Yg=Of?ig?"bottom":"top":ig?"left":"right",Zg=Of?"left":"bottom",$g={main:function(){return"translate("+He.left+","+He.top+")"},context:function(){return"translate("+Ie.left+","+Ie.top+")"},legend:function(){return"translate("+Je.left+","+Je.top+")"},x:function(){return"translate(0,"+(Of?0:Me)+")"},y:function(){return"translate(0,"+(Of?Me:0)+")"},y2:function(){return"translate("+(Of?0:Ke)+","+(Of?1:0)+")"},subx:function(){return"translate(0,"+(Of?0:Ne)+")"},arc:function(){return"translate("+Ke/2+","+Me/2+")"}},_g="right"===Lf,ah=0,bh=0,ch=0,dh=40,eh=20;Ye=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fh,gh=function(){var a=g.svg.line().x(Of?function(a){return V(a.id)(a.value)}:Ic).y(Of?Ic:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=Id(b.values);return ld(b)?(a.interpolate(md(b)?"cardinal":"linear"),Bf[b.id]?Ud(e,ff,V(b.id),Bf[b.id]):a(e)):(c=ff(e[0].x),d=V(b.id)(e[0].value),Of?"M "+d+" "+c:"M "+c+" "+d)}}(),hh=function(){var a;return a=Of?g.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Ic):g.svg.area().x(Ic).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Id(b.values);return fd([b],"area")||fd([b],"area-spline")?(a.interpolate(md(b)?"cardinal":"linear"),a(e)):(c=ff(e[0].x),d=V(b.id)(e[0].value),Of?"M "+d+" "+c:"M "+c+" "+d)}}(),ih=function(){var a=g.svg.line().x(Of?function(a){return W(a.id)(a.value)}:Lc).y(Of?Lc:function(a){return W(a.id)(a.value)});return function(b){var c=Id(b.values);return ld(b)?a(c):"M "+jf(c[0].x)+" "+W(b.id)(c[0].value)}}(),jh=function(){};fh=g.svg.brush().on("brush",be),fh.update=function(){return nh&&nh.select(".x.brush").call(this),this},fh.scale=function(a){return Of?this.y(a):this.x(a)},Be&&(jh=g.behavior.zoom().on("zoomstart",function(){jh.altDomain=g.event.sourceEvent.altKey?ff.orgDomain():null}).on("zoom",Be?ce:null),jh.scale=function(a){return Of?this.y(a):this.x(a)},jh.orgScaleExtent=function(){var a=Ce?Ce:[1,10];return[a[0],Math.max(fc()/a[1],a[1])]},jh.updateScaleExtent=function(){var a=Pb(ff.orgDomain())/Pb(rh),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var kh,lh,mh,nh,oh,ph,qh,rh,sh,th={};if(re.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=kh.selectAll(ne(a)),d=c.filter(oe),e=c.filter(pe);re.revert(),re.defocus(),b(d.classed("focused",!0)),b(e),kd(re.data.targets)&&Fb(a,!0),ie(a)},re.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=kh.selectAll(ne(a)),d=c.filter(oe),e=c.filter(pe);re.revert(),b(d.classed("focused",!1)),b(e),kd(re.data.targets)&&Gb(a),je(a)},re.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=kh.selectAll(ne(a)),d=c.filter(oe),e=c.filter(pe);b(d.classed("focused",!1)),b(e),kd(re.data.targets)&&Gb(a),ke()},re.show=function(a){kh.selectAll(ne(a)).transition().style("opacity",1)},re.hide=function(a){kh.selectAll(ne(a)).transition().style("opacity",0)},re.unzoom=function(){fh.clear().update(),ae({withUpdateXDomain:!0})},re.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&Zb(a.xs),"categories"in a&&Pg&&(Qf=a.categories,mf.categories(Qf)),"cacheIds"in a&&Qb(a.cacheIds))return void he(Sb(a.cacheIds),a.done);if("data"in a)he(bc(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){he(bc(c),a.done)});else if("rows"in a)he(bc(_b(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");he(bc(ac(a.columns)),a.done)}},re.unload=function(a){re.data.targets=re.data.targets.filter(function(b){return b.id!==a}),kh.selectAll(ne(a)).transition().style("opacity",0).remove(),Kf&&oh.selectAll(".legend-item"+me(a)).remove(),re.data.targets.length>0&&ae({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},re.selected=function(a){var b=me(a);return g.merge(mh.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(ue)}).map(function(a){return a.map(function(a){return a.__data__})}))},re.select=function(a,b,c){Df&&mh.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?Cd:Fd,i="circle"===this.nodeName?Dd:Gd,j=Ef||!a||a.indexOf(d.id)>=0,k=!b||b.indexOf(f)>=0;j&&k?Ff(d)&&h(g.select(this).classed(ue,!0),d,f):e(c)&&c&&i(g.select(this).classed(ue,!1),d,f)})},re.unselect=function(a,b){Df&&mh.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var e="circle"===this.nodeName?Dd:Gd,f=Ef||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0;f&&h&&Ff(c)&&e(g.select(this).classed(ue,!1),c,d)})},re.toLine=function(a){ed(a,"line"),fe()},re.toSpline=function(a){ed(a,"spline"),fe()},re.toBar=function(a){ed(a,"bar"),fe()},re.toScatter=function(a){ed(a,"scatter"),fe()},re.toArea=function(a){ed(a,"area"),fe()},re.toAreaSpline=function(a){ed(a,"area-spline"),fe()},re.toPie=function(a){ed(a,"pie"),fe({withTransform:!0})},re.toDonut=function(a){ed(a,"donut"),fe({withTransform:!0})},re.groups=function(a){return d(a)?vf:(vf=a,ae(),vf)},re.xgrids=function(a){return a?(og=a,ae(),og):og},re.xgrids.add=function(a){return a?re.xgrids(og.concat(a)):void 0},re.xgrids.remove=function(a){var b=qe(a);return re.xgrids(og.filter(b))},re.ygrids=function(a){return a?(qg=a,ae(),qg):qg},re.ygrids.add=function(a){return a?re.ygrids(qg.concat(a)):void 0},re.ygrids.remove=function(a){var b=qe(a);return re.ygrids(qg.filter(b))},re.regions=function(a){return d(a)?Eg:(Eg=a,ae(),Eg)},re.regions.add=function(a){return d(a)?Eg:(Eg=Eg.concat(a),ae(),Eg)},re.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;kh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Eg=Eg.filter(function(b){return b.classes.indexOf(a)<0})}),Eg},re.data.get=function(a){var b=re.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},re.data.getAsTarget=function(a){var b=jc(function(b){return b.id===a});return b.length>0?b[0]:void 0},re.resize=function(a){xe=a?a.width:null,ye=a?a.height:null,fe({withLegend:!0,withTransition:!1})},re.destroy=function(){re.data.targets=void 0,re.data.x={},qh.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(_b(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Vd(ac(f.data.columns))}return re}}(window); \ No newline at end of file