diff --git a/c3.js b/c3.js index b1d3ac7..929bb5c 100644 --- a/c3.js +++ b/c3.js @@ -2843,7 +2843,11 @@ mouse = d3.mouse(this); closest = findClosestFromTargets(c3.data.targets, mouse); - sameXData = filterSameX(c3.data.targets, closest.x); + if (isScatterType(closest)) { + sameXData = [closest]; + } else { + sameXData = filterSameX(c3.data.targets, closest.x); + } // show tooltip when cursor is close to some point selectedData = sameXData.map(function (d) { diff --git a/c3.min.js b/c3.min.js index 731b83b..6f35bd9 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !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={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){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 U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(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 vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(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 Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();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 wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.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))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?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 Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(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 Me(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 Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){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.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(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}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%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)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); +}Xi.html(ei(qf.data.targets.map(function(a){return nc(a.values[gi])}),$(),td,wi)),Xi.style("top",hi.top).style("left",hi.left).style("display","block")}null==a.onresize&&(a.onresize=Xe()),a.onresize.add&&(a.onresize.add(Cf),a.onresize.add(function(){Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Df))}function Oe(a){a.append("rect").attr("class",cd).style("cursor",Ag&&Bg?"pointer":null).on("mouseover",function(a,b){if(!si&&!$d(qf.data.targets)){var c,d,e=qf.data.targets.map(function(a){return nc(a.values[b])});if(Object.keys(pg).length>0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){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.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(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}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%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)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.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;Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file