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