Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2 lines
56 KiB

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