From b0af2e82ce1764b0086187dc38dba78f6efb0a20 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 9 Apr 2014 21:51:56 +0900 Subject: [PATCH 01/13] Fix clip path for axis --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index b8c4ddc..0c7c4c4 100644 --- a/c3.js +++ b/c3.js @@ -269,8 +269,8 @@ clipIdForXAxis = clipId + '-xaxis', clipIdForYAxis = clipId + '-yaxis', clipPath = getClipPath(clipId), - clipPathForXAxis = getClipPath(clipPathForXAxis), - clipPathForYAxis = getClipPath(clipPathForYAxis); + clipPathForXAxis = getClipPath(clipIdForXAxis), + clipPathForYAxis = getClipPath(clipIdForYAxis); var isTimeSeries = (__axis_x_type === 'timeseries'), isCategorized = (__axis_x_type === 'categorized'), diff --git a/c3.min.js b/c3.min.js index 0eaa22c..d528171 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?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||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),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?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(_h),ai=i(ai),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}Ji.html(Th(nf.data.targets.map(function(a){return lc(a.values[Vh])}),$(),rd,ji)),Ji.style("top",Wh.top).style("left",Wh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!fi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] }),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From cd004fea652f6f97ac63b9978619e6b6ba540255 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 9 Apr 2014 22:36:54 +0900 Subject: [PATCH 02/13] Purge getBBox - #131 --- c3.js | 13 +++++++------ c3.min.js | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/c3.js b/c3.js index 0c7c4c4..7fcc9c5 100644 --- a/c3.js +++ b/c3.js @@ -785,7 +785,7 @@ function getMaxTickWidth(id) { var maxWidth = 0, axisClass = id === 'x' ? CLASS.axisX : id === 'y' ? CLASS.axisY : CLASS.axisY2; d3.selectAll('.' + axisClass + ' .tick text').each(function () { - var box = this.getBBox(); + var box = this.getBoundingClientRect(); if (maxWidth < box.width) { maxWidth = box.width; } }); return maxWidth < 20 ? 20 : maxWidth; @@ -1628,7 +1628,7 @@ .data([min, max]) .enter().append('text') .text(function (d) { return d; }) - .each(function (d, i) { var box = this.getBBox(); widths[i] = box.width * paddingCoef; }) + .each(function (d, i) { widths[i] = this.getBoundingClientRect().width * paddingCoef; }) .remove(); return widths; } @@ -2017,8 +2017,9 @@ return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < _r; } function isWithinBar(_this) { - var mouse = d3.mouse(_this), box = _this.getBBox(); - var x = box.x, y = box.y, w = box.width, h = box.height, offset = 2; + var mouse = d3.mouse(_this), box = _this.getBoundingClientRect(), + seg0 = _this.pathSegList.getItem(0), seg1 = _this.pathSegList.getItem(1); + var x = seg0.x, y = Math.min(seg0.y, seg1.y), w = box.width, h = box.height, offset = 2; var sx = x - offset, ex = x + w + offset, sy = y + h + offset, ey = y - offset; return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy; } @@ -2212,7 +2213,7 @@ } } function getYForText(points, d, textElement) { - var box = textElement.getBBox(); + var box = textElement.getBoundingClientRect(); if (__axis_rotated) { return (points[0][0] + points[2][0] + box.height * 0.6) / 2; } else { @@ -3719,7 +3720,7 @@ withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; function updatePositions(textElement, id, reset) { - var box = textElement.getBBox(), + var box = textElement.getBoundingClientRect(), itemWidth = Math.ceil((box.width + paddingRight) / 10) * 10, itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10, itemLength = isLegendRight ? itemHeight : itemWidth, diff --git a/c3.min.js b/c3.min.js index d528171..86e12ab 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?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||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),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?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +!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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?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||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),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?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] }),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b05e3b0e8045c36fe676e2ce3f04ee5f4308beaf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 9 Apr 2014 22:37:36 +0900 Subject: [PATCH 03/13] Fix error when all null on line --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 7fcc9c5..fb4c513 100644 --- a/c3.js +++ b/c3.js @@ -2141,8 +2141,8 @@ isSplineType(d) ? line.interpolate("cardinal") : line.interpolate("linear"); return __data_regions[d.id] ? lineWithRegions(data, x, getYScale(d.id), __data_regions[d.id]) : line(data); } else { - x0 = x(data[0].x); - y0 = getYScale(d.id)(data[0].value); + x0 = data[0] ? x(data[0].x) : 0; + y0 = data[0] ? getYScale(d.id)(data[0].value) : 0; return __axis_rotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0; } }; diff --git a/c3.min.js b/c3.min.js index 86e12ab..441261b 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?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||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),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?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}Ji.html(Th(nf.data.targets.map(function(a){return lc(a.values[Vh])}),$(),rd,ji)),Ji.style("top",Wh.top).style("left",Wh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!fi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] }),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b87e6602b31889bb940b09625f0bdaca1919031c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 11:10:27 +0900 Subject: [PATCH 04/13] Fix hidden legend opacity to use css class - #128 --- c3.css | 3 +++ c3.js | 18 ++++++++---------- c3.min.js | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/c3.css b/c3.css index 737e783..1d8d26a 100644 --- a/c3.css +++ b/c3.css @@ -115,6 +115,9 @@ .c3-legend-item { font-size: 12px; } +.c3-legend-item-hidden { + opacity: 0.1; +} /*-- Tooltip --*/ diff --git a/c3.js b/c3.js index fb4c513..271288d 100644 --- a/c3.js +++ b/c3.js @@ -3672,14 +3672,16 @@ /*-- Draw Legend --*/ function opacityForLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? 0.5 : 1; + var item = legend.select(selectorLegend(id)); + item.style('opacity', null); // MEMO: remove to get opacity by css + return item.classed(CLASS.legendItemHidden) ? item.style('opacity') : 1; } function toggleFocusLegend(id, focus) { - var legendItem = legend.selectAll('.' + CLASS.legendItem), + var items = legend.selectAll('.' + CLASS.legendItem).filter(function () { return !d3.select(this).classed(CLASS.legendItemHidden); }), isTarget = function (d) { return (!id || d === id); }, notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); + items.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); + items.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -3943,9 +3945,7 @@ showLegend(targetIds); } else { legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, false) - .transition() - .style('opacity', 1); + .classed(CLASS.legendItemHidden, false); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); @@ -3964,9 +3964,7 @@ hideLegend(targetIds); } else { legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, true) - .transition() - .style('opacity', 0.5); + .classed(CLASS.legendItemHidden, true); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); diff --git a/c3.min.js b/c3.min.js index 441261b..93fbf12 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?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||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),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?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] -}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}Ji.html(Th(nf.data.targets.map(function(a){return lc(a.values[Vh])}),$(),rd,ji)),Ji.style("top",Wh.top).style("left",Wh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!fi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a +});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 82cdf8965ab6d8215fcc6b2ad6fbfc1695aa337b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 12:29:10 +0900 Subject: [PATCH 05/13] Add axis.x.utc option and use utc for x time format as default - #144 --- c3.js | 22 ++++++++++++---------- c3.min.js | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index 271288d..11588bd 100644 --- a/c3.js +++ b/c3.js @@ -163,6 +163,7 @@ // axis var __axis_rotated = getConfig(['axis', 'rotated'], false), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), + __axis_x_utc = getConfig(['axis', 'x', 'utc'], true), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []), __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), @@ -281,16 +282,17 @@ var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); - var defaultTimeFormat = (function () { + var xTimeFormat = __axis_x_utc ? d3.time.format.utc : d3.time.format, + defaultTimeFormat = (function () { var formats = [ - [d3.time.format("%Y/%-m/%-d"), function () { return true; }], - [d3.time.format("%-m/%-d"), function (d) { return d.getMonth(); }], - [d3.time.format("%-m/%-d"), function (d) { return d.getDate() !== 1; }], - [d3.time.format("%-m/%-d"), function (d) { return d.getDay() && d.getDate() !== 1; }], - [d3.time.format("%I %p"), function (d) { return d.getHours(); }], - [d3.time.format("%I:%M"), function (d) { return d.getMinutes(); }], - [d3.time.format(":%S"), function (d) { return d.getSeconds(); }], - [d3.time.format(".%L"), function (d) { return d.getMilliseconds(); }] + [xTimeFormat("%Y/%-m/%-d"), function () { return true; }], + [xTimeFormat("%-m/%-d"), function (d) { return d.getMonth(); }], + [xTimeFormat("%-m/%-d"), function (d) { return d.getDate() !== 1; }], + [xTimeFormat("%-m/%-d"), function (d) { return d.getDay() && d.getDate() !== 1; }], + [xTimeFormat("%I %p"), function (d) { return d.getHours(); }], + [xTimeFormat("%I:%M"), function (d) { return d.getMinutes(); }], + [xTimeFormat(":%S"), function (d) { return d.getSeconds(); }], + [xTimeFormat(".%L"), function (d) { return d.getMilliseconds(); }] ]; return function (date) { var i = formats.length - 1, f = formats[i]; @@ -641,7 +643,7 @@ if (typeof __axis_x_tick_format === 'function') { format = __axis_x_tick_format; } else if (isTimeSeries) { - format = function (date) { return d3.time.format(__axis_x_tick_format)(date); }; + format = function (date) { return xTimeFormat(__axis_x_tick_format)(date); }; } } return format; diff --git a/c3.min.js b/c3.min.js index 93fbf12..59fd804 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?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||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),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?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.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=mf.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),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=si?u:t,void(Mg?(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,si?(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=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-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 ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh: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+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.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)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.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;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a -});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ci?new Date(c.getTime()-e):c-e,g=ci?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","utc"],!0),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format.utc:mf.time.format,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 +},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 5127f887eb2a163eb699136ee20c1ddabe4493db Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 12:44:15 +0900 Subject: [PATCH 06/13] Modify axis.x.utc to axis.x.localtime - #144 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 11588bd..4daaa53 100644 --- a/c3.js +++ b/c3.js @@ -163,7 +163,7 @@ // axis var __axis_rotated = getConfig(['axis', 'rotated'], false), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), - __axis_x_utc = getConfig(['axis', 'x', 'utc'], true), + __axis_x_localtime = getConfig(['axis', 'x', 'localtime'], false), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []), __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), @@ -282,7 +282,7 @@ var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); - var xTimeFormat = __axis_x_utc ? d3.time.format.utc : d3.time.format, + var xTimeFormat = __axis_x_localtime ? d3.time.format : d3.time.format.utc, defaultTimeFormat = (function () { var formats = [ [xTimeFormat("%Y/%-m/%-d"), function () { return true; }], diff --git a/c3.min.js b/c3.min.js index 59fd804..60fffe5 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ci?new Date(c.getTime()-e):c-e,g=ci?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","utc"],!0),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format.utc:mf.time.format,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 +}Li.html(Uh(nf.data.targets.map(function(a){return lc(a.values[Wh])}),$(),rd,ki)),Li.style("top",Xh.top).style("left",Xh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!gi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 },nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From ae8cf74bd6be5f582823e1d86471c1d6c133dac7 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 23:30:26 +0900 Subject: [PATCH 07/13] Fix loading only header data from url - #143 --- c3.js | 25 ++++++++++++++++++++----- c3.min.js | 4 ++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 4daaa53..87f7aae 100644 --- a/c3.js +++ b/c3.js @@ -1218,8 +1218,13 @@ var xDomain = [getXDomainMin(targets), getXDomainMax(targets)], firstX = xDomain[0], lastX = xDomain[1], padding = getXDomainPadding(targets, xDomain), - min = isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding, + min = 0, max = 0; + if (firstX || firstX === 0) { + min = isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding; + } + if (lastX || lastX === 0) { max = isTimeSeries ? new Date(lastX.getTime() + padding) : lastX + padding; + } return [min, max]; } function diffDomain(d) { @@ -2001,13 +2006,11 @@ function parseDate(date) { var parsedDate; - if (!date) { throw Error(date + " can not be parsed as d3.time with format " + __data_x_format + ". Maybe 'x' of this data is not defined. See data.x or data.xs option."); } try { parsedDate = __data_x_format ? d3.time.format(__data_x_format).parse(date) : new Date(date); } catch (e) { - parsedDate = undefined; + window.console.error("Failed to parse x '" + date + "' to Date with format " + __data_x_format); } - if (!parsedDate) { window.console.error("Failed to parse x '" + date + "' to Date with format " + __data_x_format); } return parsedDate; } @@ -4266,7 +4269,19 @@ /*-- Load data and init chart with defined functions --*/ if ('url' in config.data) { - d3.csv(config.data.url, function (error, data) { init(data); }); + d3.xhr(config.data.url, function (error, data) { + // TODO: other mine/type + var rows = d3.csv.parseRows(data.response), d; + if (rows.length === 1) { + d = [{}]; + rows[0].forEach(function (id) { + d[0][id] = null; + }); + } else { + d = d3.csv.parse(data.response); + } + init(d); + }); } else if ('rows' in config.data) { init(convertRowsToData(config.data.rows)); diff --git a/c3.min.js b/c3.min.js index 60fffe5..a38c8ea 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ci?new Date(c.getTime()-e):c-e,g=ci?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;eDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 -},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From adbe644efc39b99d029c0193214a9730196ebfd6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 23:55:19 +0900 Subject: [PATCH 08/13] Fix x axis tick --- c3.js | 11 +++++++---- c3.min.js | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 87f7aae..777cbf9 100644 --- a/c3.js +++ b/c3.js @@ -1527,6 +1527,7 @@ tickValues.push(end); } } + if (!isTimeSeries) { tickValues = tickValues.sort(); } return tickValues; } function addHiddenTargetIds(targetIds) { @@ -3001,7 +3002,7 @@ // update axis tick values according to options, except for scatter plot if (! hasScatterType(targetsToShow)) { // TODO: fix this - tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)).sort(); + tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); } @@ -3029,9 +3030,11 @@ break; } } - d3.selectAll('.' + CLASS.axisX + ' .tick').sort(function (e1, e2) { return e1 - e2; }); - d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e, i) { - d3.select(this).style('display', i % intervalForCulling ? 'none' : 'block'); + d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { + var index = tickValues.indexOf(e); + if (index > 0) { + d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); + } }); } diff --git a/c3.min.js b/c3.min.js index a38c8ea..82c9a54 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 -},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return ci||(i=i.sort()),i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Li.style("display","none"),o(),Ii.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){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=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From e79df141ecaba5125ae87f7449a0febc35e852ba Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 11 Apr 2014 00:16:03 +0900 Subject: [PATCH 09/13] Add line.connect_null option - #81 --- c3.js | 5 ++++- c3.min.js | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index 777cbf9..e356085 100644 --- a/c3.js +++ b/c3.js @@ -212,6 +212,8 @@ __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r'], __point_focus_expand_enabled ? 4 : __point_r), __point_select_r = getConfig(['point', 'focus', 'select', 'r'], 8); + var __line_connect_null = getConfig(['line', 'connect_null'], false); + // bar var __bar_width = getConfig(['bar', 'width']), __bar_width_ratio = getConfig(['bar', 'width', 'ratio'], 0.6); @@ -2141,8 +2143,9 @@ var line = d3.svg.line() .x(__axis_rotated ? function (d) { return getYScale(d.id)(d.value); } : xx) .y(__axis_rotated ? xx : function (d) { return getYScale(d.id)(d.value); }); + if (!__line_connect_null) { line = line.defined(function (d) { return d.value != null; }); } return function (d) { - var data = filterRemoveNull(d.values), x0, y0; + var data = __line_connect_null ? filterRemoveNull(d.values) : d.values, x0, y0; if (isLineType(d)) { isSplineType(d) ? line.interpolate("cardinal") : line.interpolate("linear"); return __data_regions[d.id] ? lineWithRegions(data, x, getYScale(d.id), __data_regions[d.id]) : line(data); diff --git a/c3.min.js b/c3.min.js index 82c9a54..39921e7 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(ci?new Date(h):h);i.push(d)}return ci||(i=i.sort()),i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Li.style("display","none"),o(),Ii.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){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=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.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=mf.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),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=ui?u:t,void(Mg?(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,ui?(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=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-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 ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th: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+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%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)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.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;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] -}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(vi?0:a),right:0/0,bottom:20+(vi?0:a),left:Ng?zi:Af.left},Ef=Ng?Af.left-zi-Ai:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:vi?0:If-a,right:0/0,bottom:0,left:vi?Hf-b:0},p(),vi&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ji.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:vi?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Bi:Jg&&!vi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ei?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){wi=a}function N(a){xi=a}function O(a){yi=a}function P(){return Jg?vi?xi*(wi+1):Hf:0}function Q(){return Jg?vi?If:yi*(wi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Oi,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,qi,a),fg=X(_f,ti,a),dg=Y(Zf,ri,fh,hh),eg=Y($f,si,oh,qh),b||(Ci.scale(_f),uf&&Gi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(di?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ei){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ei?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ei?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ei&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=di?ni:ei?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:di&&(a=function(a){return mi(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ji.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ji.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ji.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Oi),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ei?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=di?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=di?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=di?a?a instanceof Date?a:ie(a):ie(ic(b,c)):fi&&!ei?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return fi&&ei&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(di?new Date(h):h);i.push(d)}return di||(i=i.sort()),i}function Gc(a){oi=oi.concat(a)}function Hc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){pi=pi.concat(a)}function Jc(a){pi=pi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Sh&&0!==m.length&&(Mi.html(Vh(a,$(),l,li)).style("display","block"),d=Mi.property("offsetWidth"),e=Mi.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Mi.style("top",i+"px").style("left",g+"px"))}function Id(){Mi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Sh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ji.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ji.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Eh?Eh:b?2*a.tickOffset()*Fh/b:0}function Sd(a,b){yc(a).forEach(function(a){Qi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return li(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(li(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return li(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ji.selectAll("."+f.circles+gd(c)):Ji).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ji.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ni=mf.select(pf),Ni.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ni.html(""),Ni.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Oi=Yf.domain(),Ci.scale(_f),uf&&Gi.scale(Yf),Hi=Ni.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Ii=Hi.append("defs"),Ii.append("clipPath").attr("id",Zh).append("rect").attr("width",Df).attr("height",Ff),Ii.append("clipPath").attr("id",$h).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ii.append("clipPath").attr("id",_h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ji=Hi.append("g").attr("transform",ui.main),Ki=Gg?Hi.append("g").attr("transform",ui.context):null,Li=Hi.append("g").attr("transform",ui.legend),Jg||(Li.style("visibility","hidden"),pi=xc(nf.data.targets)),Mi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ji.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":bi).attr("transform",ui.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ji.append("g").attr("class",f.axisY).attr("clip-path",Ng?ci:"").attr("transform",ui.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ji.append("g").attr("class",f.axisY2).attr("transform",ui.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ji.append("g").attr("clip-path",ai).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ji.append("g").attr("clip-path",ai).attr("class",f.regions),Ji.append("g").attr("clip-path",ai).attr("class",f.chart),c=Ji.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ui.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ji.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ji.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Gi).on("dblclick.zoom",null),Zg&&Ci.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ki.append("g").attr("clip-path",ai).attr("class",f.chart),Ki.select("."+f.chart).append("g").attr("class",f.chartBars),Ki.select("."+f.chart).append("g").attr("class",f.chartLines),Ki.append("g").attr("clip-path",ai).attr("class",f.brush).call(Ci).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ki.append("g").attr("class",f.axisX).attr("transform",ui.subx).attr("clip-path",Ng?"":bi)),Xe(nf.data.targets),Ng?Ji.select("."+f.axisX).style("opacity",0).call(cg):(Ji.select("."+f.axisY).style("opacity",0).call(dg),Ji.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Wh){if(di&&"string"==typeof Xh){for(Xh=ie(Xh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(gi=a,Ji.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),hi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ji.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ji.selectAll("."+f.shape).classed(f.INCLUDED,!1),hi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Oi=Yf.domain(),uf&&Gi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Ci.scale(_f)),F&&(Yf.domain(Ci.empty()?Oi:Ci.extent()),uf&&Gi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ji.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ji.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ji.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Mi.style("display","none"),o(),Ji.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){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=Yf.ticks(10);g=Ji.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ji.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ji.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ji.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return li(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ji.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Di).style("opacity",1),Ji.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ei).style("opacity",Pi),n=Ji.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ji.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=mf.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),Ji.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ji.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Ci.extent(Yf.orgDomain()).update(),z&&(Ki.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Ci.empty()||Ci.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ki.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return li(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ki.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1))),Ji.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ji.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ji.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),fi&&!ei?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ji.select("."+f.eventRects).datum(v?v.values:[]),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ji.select("."+f.regions).selectAll("rect."+f.region).data(Rh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Qi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Gi.altDomain?(Yf.domain(Gi.altDomain),void Gi.scale(Yf).updateScaleExtent()):(ei&&Yf.orgDomain()[0]===Oi[0]&&Yf.domain([Oi[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ii=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Hi.attr("width",Hf).attr("height",If),Hi.select("#"+Zh).select("rect").attr("width",Df).attr("height",Ff),Hi.select("#"+$h).select("rect").attr("width",H),Hi.select("#"+_h).select("rect").attr("width",J),Hi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ji.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return li(a)}),e=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return li(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Pi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return li(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return li(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ji.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ji.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return li(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ki.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return li(a)}),l=Ki.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)})),Hi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=vi?j:i,l=vi?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=vi?u:t,void(Mg?(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,vi?(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=Li.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",vi?g:-200).attr("y",vi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",vi?h:-200).attr("y",vi?-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 li(a)}).attr("x",vi?g:-200).attr("y",vi?-200:i).attr("width",10).attr("height",10),Li.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Li.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Li.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["line","connect_null"],!1),Eh=h(["bar","width"]),Fh=h(["bar","width","ratio"],.6),Gh=h(["pie","label","show"],!0),Hh=h(["pie","label","format"]),Ih=h(["pie","onclick"],function(){}),Jh=h(["pie","onmouseover"],function(){}),Kh=h(["pie","onmouseout"],function(){}),Lh=h(["donut","label","show"],!0),Mh=h(["donut","label","format"]),Nh=h(["donut","title"],""),Oh=h(["donut","onclick"],function(){}),Ph=h(["donut","onmouseover"],function(){}),Qh=h(["donut","onmouseout"],function(){}),Rh=h(["regions"],[]),Sh=h(["tooltip","show"],!0),Th=h(["tooltip","format","title"]),Uh=h(["tooltip","format","value"]),Vh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Th?Th:b,l=Uh?Uh: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+""}),Wh=h(["tooltip","init","show"],!1),Xh=h(["tooltip","init","x"],0),Yh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Zh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",$h=Zh+"-xaxis",_h=Zh+"-yaxis",ai=i(Zh),bi=i($h),ci=i(_h),di="timeseries"===Og,ei="categorized"===Og,fi=!di&&(gg||ne(hg)),gi=null,hi=!1,ii=!1,ji=!1,ki=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],li=he(ug,ne(Ig)?Ig:ki,tg),mi=Pg?mf.time.format:mf.time.format.utc,ni=function(){var a=[[mi("%Y/%-m/%-d"),function(){return!0}],[mi("%-m/%-d"),function(a){return a.getMonth()}],[mi("%-m/%-d"),function(a){return 1!==a.getDate()}],[mi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mi("%I %p"),function(a){return a.getHours()}],[mi("%I:%M"),function(a){return a.getMinutes()}],[mi(":%S"),function(a){return a.getSeconds()}],[mi(".%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)}}(),oi=[],pi=[],qi=Ng?"left":"bottom",ri=Ng?eh?"top":"bottom":eh?"right":"left",si=Ng?nh?"bottom":"top":nh?"left":"right",ti=Ng?"left":"bottom",ui={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},vi="right"===Kg,wi=0,xi=0,yi=0,zi=30,Ai=30,Bi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ci,Di=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return Dh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Dh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Fi=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Gi=function(){};Ci=mf.svg.brush().on("brush",Se),Ci.update=function(){return Ki&&Ki.select("."+f.brush).call(this),this},Ci.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Gi=mf.behavior.zoom().on("zoomstart",function(){Gi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Gi.scale=function(a){return Ng?this.y(a):this.x(a)},Gi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Gi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Oi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Hi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Hi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ci.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ei&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ji.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Rh:(Rh=a,Re(),Rh)},nf.regions.add=function(a){return c(a)?Rh:(Rh=Rh.concat(a),Re(),Rh)},nf.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;Hi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Rh=Rh.filter(function(b){return b.classes.indexOf(a)<0})}),Rh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a +});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Li.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Li.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ni.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From fc9e61da60e4ba41af48a9ee637b6c2b76a82576 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 21:16:39 +0900 Subject: [PATCH 10/13] Add onresize and onresized event hander - #145 --- c3.js | 6 +++++- c3.min.js | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index e356085..3db8115 100644 --- a/c3.js +++ b/c3.js @@ -113,7 +113,9 @@ __zoom_privileged = getConfig(['zoom', 'privileged'], false); var __onenter = getConfig(['onenter'], function () {}), - __onleave = getConfig(['onleave'], function () {}); + __onleave = getConfig(['onleave'], function () {}), + __onresize = getConfig(['onresize'], function () {}), + __onresized = getConfig(['onresized'], function () {}); var __transition_duration = getConfig(['transition', 'duration'], 350); @@ -2656,9 +2658,11 @@ window.onresize = generateResize(); } if (window.onresize.add) { + window.onresize.add(__onresize); window.onresize.add(function () { updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); }); + window.onresize.add(__onresized); } } diff --git a/c3.min.js b/c3.min.js index 39921e7..2cd2e2a 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.29"},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;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(vi?0:a),right:0/0,bottom:20+(vi?0:a),left:Ng?zi:Af.left},Ef=Ng?Af.left-zi-Ai:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:vi?0:If-a,right:0/0,bottom:0,left:vi?Hf-b:0},p(),vi&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ji.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:vi?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?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||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Bi:Jg&&!vi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ei?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){wi=a}function N(a){xi=a}function O(a){yi=a}function P(){return Jg?vi?xi*(wi+1):Hf:0}function Q(){return Jg?vi?If:yi*(wi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Oi,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,qi,a),fg=X(_f,ti,a),dg=Y(Zf,ri,fh,hh),eg=Y($f,si,oh,qh),b||(Ci.scale(_f),uf&&Gi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(di?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ei){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ei?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ei?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ei&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=di?ni:ei?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:di&&(a=function(a){return mi(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),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?dh=b:"y2"===a?mh=b:"x"===a&&($g=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",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"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?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/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(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ji.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ji.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ji.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.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=qd(o,p),j=$b(Zf.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&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Oi),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ei?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=di?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=di?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=di?a?a instanceof Date?a:ie(a):ie(ic(b,c)):fi&&!ei?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return fi&&ei&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.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++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(di?new Date(h):h);i.push(d)}return di||(i=i.sort()),i}function Gc(a){oi=oi.concat(a)}function Hc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){pi=pi.concat(a)}function Jc(a){pi=pi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Sh&&0!==m.length&&(Mi.html(Vh(a,$(),l,li)).style("display","block"),d=Mi.property("offsetWidth"),e=Mi.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(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)),Mi.style("top",i+"px").style("left",g+"px"))}function Id(){Mi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Sh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ji.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ji.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Eh?Eh:b?2*a.tickOffset()*Fh/b:0}function Sd(a,b){yc(a).forEach(function(a){Qi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return li(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(li(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return li(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ji.selectAll("."+f.circles+gd(c)):Ji).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ji.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Ng&&(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 Je(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 Ke(b){var c,d,e;if(Ni=mf.select(pf),Ni.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ni.html(""),Ni.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Oi=Yf.domain(),Ci.scale(_f),uf&&Gi.scale(Yf),Hi=Ni.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Ii=Hi.append("defs"),Ii.append("clipPath").attr("id",Zh).append("rect").attr("width",Df).attr("height",Ff),Ii.append("clipPath").attr("id",$h).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ii.append("clipPath").attr("id",_h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ji=Hi.append("g").attr("transform",ui.main),Ki=Gg?Hi.append("g").attr("transform",ui.context):null,Li=Hi.append("g").attr("transform",ui.legend),Jg||(Li.style("visibility","hidden"),pi=xc(nf.data.targets)),Mi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ji.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":bi).attr("transform",ui.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ji.append("g").attr("class",f.axisY).attr("clip-path",Ng?ci:"").attr("transform",ui.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ji.append("g").attr("class",f.axisY2).attr("transform",ui.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ji.append("g").attr("clip-path",ai).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ji.append("g").attr("clip-path",ai).attr("class",f.regions),Ji.append("g").attr("clip-path",ai).attr("class",f.chart),c=Ji.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ui.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ji.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ji.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Gi).on("dblclick.zoom",null),Zg&&Ci.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ki.append("g").attr("clip-path",ai).attr("class",f.chart),Ki.select("."+f.chart).append("g").attr("class",f.chartBars),Ki.select("."+f.chart).append("g").attr("class",f.chartLines),Ki.append("g").attr("clip-path",ai).attr("class",f.brush).call(Ci).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ki.append("g").attr("class",f.axisX).attr("transform",ui.subx).attr("clip-path",Ng?"":bi)),Xe(nf.data.targets),Ng?Ji.select("."+f.axisX).style("opacity",0).call(cg):(Ji.select("."+f.axisY).style("opacity",0).call(dg),Ji.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Wh){if(di&&"string"==typeof Xh){for(Xh=ie(Xh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||vg&&(gi=a,Ji.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),hi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ji.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ji.selectAll("."+f.shape).classed(f.INCLUDED,!1),hi=!1,Fg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Oi=Yf.domain(),uf&&Gi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Ci.scale(_f)),F&&(Yf.domain(Ci.empty()?Oi:Ci.extent()),uf&&Gi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ji.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ji.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ji.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Mi.style("display","none"),o(),Ji.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){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=Yf.ticks(10);g=Ji.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ji.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),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",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ji.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ji.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),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",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return li(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ji.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Di).style("opacity",1),Ji.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ei).style("opacity",Pi),n=Ji.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ji.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=mf.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),Ji.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ji.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Ci.extent(Yf.orgDomain()).update(),z&&(Ki.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Ci.empty()||Ci.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ki.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return li(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ki.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1))),Ji.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ji.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ji.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),fi&&!ei?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ji.select("."+f.eventRects).datum(v?v.values:[]),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ji.select("."+f.regions).selectAll("rect."+f.region).data(Rh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).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(),xc(nf.data.targets).forEach(function(a){Qi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Gi.altDomain?(Yf.domain(Gi.altDomain),void Gi.scale(Yf).updateScaleExtent()):(ei&&Yf.orgDomain()[0]===Oi[0]&&Yf.domain([Oi[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ii=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Hi.attr("width",Hf).attr("height",If),Hi.select("#"+Zh).select("rect").attr("width",Df).attr("height",Ff),Hi.select("#"+$h).select("rect").attr("width",H),Hi.select("#"+_h).select("rect").attr("width",J),Hi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ji.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return li(a)}),e=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return li(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Pi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return li(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return li(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ji.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ji.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return li(a.data)}).style("cursor",function(a){return xg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Gg&&(n=Ki.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return li(a)}),l=Ki.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)})),Hi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=vi?j:i,l=vi?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(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=vi?u:t,void(Mg?(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,vi?(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=Li.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",vi?g:-200).attr("y",vi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",vi?h:-200).attr("y",vi?-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 li(a)}).attr("x",vi?g:-200).attr("y",vi?-200:i).attr("width",10).attr("height",10),Li.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Li.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Li.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,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=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["line","connect_null"],!1),Eh=h(["bar","width"]),Fh=h(["bar","width","ratio"],.6),Gh=h(["pie","label","show"],!0),Hh=h(["pie","label","format"]),Ih=h(["pie","onclick"],function(){}),Jh=h(["pie","onmouseover"],function(){}),Kh=h(["pie","onmouseout"],function(){}),Lh=h(["donut","label","show"],!0),Mh=h(["donut","label","format"]),Nh=h(["donut","title"],""),Oh=h(["donut","onclick"],function(){}),Ph=h(["donut","onmouseover"],function(){}),Qh=h(["donut","onmouseout"],function(){}),Rh=h(["regions"],[]),Sh=h(["tooltip","show"],!0),Th=h(["tooltip","format","title"]),Uh=h(["tooltip","format","value"]),Vh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Th?Th:b,l=Uh?Uh: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+""}),Wh=h(["tooltip","init","show"],!1),Xh=h(["tooltip","init","x"],0),Yh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Zh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",$h=Zh+"-xaxis",_h=Zh+"-yaxis",ai=i(Zh),bi=i($h),ci=i(_h),di="timeseries"===Og,ei="categorized"===Og,fi=!di&&(gg||ne(hg)),gi=null,hi=!1,ii=!1,ji=!1,ki=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],li=he(ug,ne(Ig)?Ig:ki,tg),mi=Pg?mf.time.format:mf.time.format.utc,ni=function(){var a=[[mi("%Y/%-m/%-d"),function(){return!0}],[mi("%-m/%-d"),function(a){return a.getMonth()}],[mi("%-m/%-d"),function(a){return 1!==a.getDate()}],[mi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mi("%I %p"),function(a){return a.getHours()}],[mi("%I:%M"),function(a){return a.getMinutes()}],[mi(":%S"),function(a){return a.getSeconds()}],[mi(".%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)}}(),oi=[],pi=[],qi=Ng?"left":"bottom",ri=Ng?eh?"top":"bottom":eh?"right":"left",si=Ng?nh?"bottom":"top":nh?"left":"right",ti=Ng?"left":"bottom",ui={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},vi="right"===Kg,wi=0,xi=0,yi=0,zi=30,Ai=30,Bi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ci,Di=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return Dh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Dh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Fi=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Gi=function(){};Ci=mf.svg.brush().on("brush",Se),Ci.update=function(){return Ki&&Ki.select("."+f.brush).call(this),this},Ci.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Gi=mf.behavior.zoom().on("zoomstart",function(){Gi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Gi.scale=function(a){return Ng?this.y(a):this.x(a)},Gi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Gi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Oi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Hi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Hi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ci.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ei&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ji.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Rh:(Rh=a,Re(),Rh)},nf.regions.add=function(a){return c(a)?Rh:(Rh=Rh.concat(a),Re(),Rh)},nf.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;Hi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Rh=Rh.filter(function(b){return b.classes.indexOf(a)<0})}),Rh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a -});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Li.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Li.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ni.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!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.29"},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;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?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||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),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?fh=b:"y2"===a?oh=b:"x"===a&&(ah=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){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=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),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",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),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",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.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=mf.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),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).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(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(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=xi?u:t,void(Og?(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,xi?(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=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-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 ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,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=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh: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+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%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)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.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;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); +return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 11c0fe61af115defb69bad05af3175fe1013f4d6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 21:39:26 +0900 Subject: [PATCH 11/13] Update version to 0.1.30 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index d305465..87e14e3 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.29", + "version": "0.1.30", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 3db8115..c09c37d 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.29" + version: "0.1.30" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 2cd2e2a..1af5ea8 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.29"},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;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?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||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),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?fh=b:"y2"===a?oh=b:"x"===a&&(ah=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;eFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?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||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),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?fh=b:"y2"===a?oh=b:"x"===a&&(ah=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){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=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),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",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),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",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.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=mf.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),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).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(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(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=xi?u:t,void(Og?(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,xi?(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=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-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 ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,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=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh: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+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%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)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.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;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index 7cd0834..5dac006 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.29", + "version": "0.1.30", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 29e871ff16fedc9e05d0eb716b4186fddcac0584 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 22:08:46 +0900 Subject: [PATCH 12/13] Fix tick values sort --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index c09c37d..c8073d0 100644 --- a/c3.js +++ b/c3.js @@ -1531,7 +1531,7 @@ tickValues.push(end); } } - if (!isTimeSeries) { tickValues = tickValues.sort(); } + if (!isTimeSeries) { tickValues = tickValues.sort(function (a, b) { return a - b; }); } return tickValues; } function addHiddenTargetIds(targetIds) { diff --git a/c3.min.js b/c3.min.js index 1af5ea8..69040e6 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.30"},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;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?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||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),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?fh=b:"y2"===a?oh=b:"x"===a&&(ah=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;eFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?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||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),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?fh=b:"y2"===a?oh=b:"x"===a&&(ah=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){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=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),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",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),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",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.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=mf.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),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).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(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(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=xi?u:t,void(Og?(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,xi?(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=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-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 ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,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=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh: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+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%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)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.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;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 533ce17e1cc06c93dcaa277a5c68ff220464013e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 22:44:21 +0900 Subject: [PATCH 13/13] Fix tick culling on categorized axis and add axis.x.tick.values option - #149 --- c3.js | 42 +++++++++++++++++++++++------------------- c3.min.js | 6 +++--- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/c3.js b/c3.js index c8073d0..ae985d7 100644 --- a/c3.js +++ b/c3.js @@ -170,9 +170,10 @@ __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), __axis_x_tick_culling = getConfig(['axis', 'x', 'tick', 'culling'], {}), - __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], __axis_x_type === 'categorized' ? Infinity : 10), + __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10), __axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']), __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], false), + __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], []), __axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_min = getConfig(['axis', 'x', 'min']), __axis_x_default = getConfig(['axis', 'x', 'default']), @@ -621,6 +622,9 @@ axis.tickFormat(tickFormat); if (isCategorized) { axis.tickCentered(__axis_x_tick_centered); + if (isEmpty(__axis_x_tick_culling)) { + __axis_x_tick_culling = false; + } } else { axis.tickOffset = function () { var base = __axis_rotated ? height : width; @@ -830,10 +834,6 @@ } return ticks; } - function shouldShowTickText(ticks, i) { - var length = ticks.length - 1; - return length <= tickTextNum || i % Math.ceil(length / tickTextNum) === 0; - } function category(i) { return i < categories.length ? categories[i] : i; } @@ -876,7 +876,7 @@ lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", tickMajorSize); textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); text.attr("dy", ".71em").style("text-anchor", "middle"); - text.text(function (i) { return shouldShowTickText(ticks, i) ? formattedCategory(i) : ""; }); + text.text(formattedCategory); pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); break; } @@ -901,7 +901,7 @@ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", tickOffset); text.attr("dy", ".32em").style("text-anchor", "end"); - text.text(function (i) { return shouldShowTickText(ticks, i) ? formattedCategory(i) : ""; }); + text.text(formattedCategory); pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); break; } @@ -3009,7 +3009,7 @@ // update axis tick values according to options, except for scatter plot if (! hasScatterType(targetsToShow)) { // TODO: fix this - tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)); + tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow)); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); } @@ -3030,19 +3030,23 @@ main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1).transition().duration(durationForAxis).call(yAxis2); // show/hide if manual culling needed - if (withUpdateXDomain && __axis_x_tick_culling && tickValues) { - for (i = 1; i < tickValues.length; i++) { - if (tickValues.length / i < __axis_x_tick_culling_max) { - intervalForCulling = i; - break; + if (withUpdateXDomain) { + if (__axis_x_tick_culling && tickValues) { + for (i = 1; i < tickValues.length; i++) { + if (tickValues.length / i < __axis_x_tick_culling_max) { + intervalForCulling = i; + break; + } } + d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { + var index = tickValues.indexOf(e); + if (index >= 0) { + d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); + } + }); + } else { + d3.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); } - d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { - var index = tickValues.indexOf(e); - if (index > 0) { - d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); - } - }); } // setup drawer - MEMO: these must be called after axis updated diff --git a/c3.min.js b/c3.min.js index 69040e6..9c998ab 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.30"},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;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?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||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),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?fh=b:"y2"===a?oh=b:"x"===a&&(ah=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.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)+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]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){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=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),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",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),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",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.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=mf.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),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).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(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(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=xi?u:t,void(Og?(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,xi?(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=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-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 ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,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=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh: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+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%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)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.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;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); -return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!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.30"},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;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(yi?0:a),right:0/0,bottom:20+(yi?0:a),left:Pg?Ci:Cf.left},Gf=Pg?Cf.left-Ci-Di:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:yi?0:Kf-a,right:0/0,bottom:0,left:yi?Jf-b:0},p(),yi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Mi.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!ch||hh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:yi?P()+(lh&&!Pg?v("y2"):a):lh?qh||Pg?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||ch?"y2"!==a||lh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ei:Lg&&!yi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(hi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){zi=a}function N(a){Ai=a}function O(a){Bi=a}function P(){return Lg?yi?Ai*(zi+1):Jf:0}function Q(){return Lg?yi?Kf:Bi*(zi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Ri,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,ti,a),hg=X(bg,wi,a),fg=Y(_f,ui,ih,kh),gg=Y(ag,vi,rh,th),b||(Fi.scale(bg),uf&&Ji.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(gi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),hi){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 mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(hi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),hi?(d.tickCentered(Tg),me(Vg)&&(Vg=!1)):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},hi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=gi?qi:hi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:gi&&(a=function(a){return pi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=gh:"y2"===a?b=ph:"x"===a&&(b=bh),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?gh=b:"y2"===a?ph=b:"x"===a&&(bh=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",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"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?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/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(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Mi.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=Mc(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 mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(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 mf.max(Object.keys(i).map(function(a){return mf.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?nh:eh,n="y2"===c?mh:dh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?oh:fh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.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=qd(o,p),j=$b(_f.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&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),"y2"===c&&sh&&(f=b(sh.top)?sh.top:e,g=b(sh.bottom)?sh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ri),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return _g?_g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return $g?$g:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return hi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}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=gi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=gi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=gi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ii&&!hi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ii&&hi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.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++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(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(gi?new Date(h):h);i.push(d)}return gi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ri=ri.concat(a)}function Hc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Ic(a){si=si.concat(a)}function Jc(a){si=si.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(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 Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();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 tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Vh&&0!==m.length&&(Pi.html(Yh(a,$(),l,oi)).style("display","block"),d=Pi.property("offsetWidth"),e=Pi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(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)),Pi.style("top",i+"px").style("left",g+"px"))}function Id(){Pi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Vh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Mi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Hh?Hh:b?2*a.tickOffset()*Ih/b:0}function Sd(a,b){yc(a).forEach(function(a){Ti[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(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 ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.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 oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return oi(b)}).attr("r",1.4*Fh).transition().duration(100).attr("r",Fh)}function se(a,b,c){Fg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(oi(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return oi(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Mi.selectAll("."+f.circles+gd(c)):Mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Eh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Bh)}function Be(a){return Mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?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 Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(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 Pg&&(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 Je(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 Ke(b){var c,d,e;if(Qi=mf.select(pf),Qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qi.html(""),Qi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Ri=$f.domain(),Fi.scale(bg),uf&&Ji.scale($f),Ki=Qi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Li=Ki.append("defs"),Li.append("clipPath").attr("id",ai).append("rect").attr("width",Ff).attr("height",Hf),Li.append("clipPath").attr("id",bi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Li.append("clipPath").attr("id",ci).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Mi=Ki.append("g").attr("transform",xi.main),Ni=Ig?Ki.append("g").attr("transform",xi.context):null,Oi=Ki.append("g").attr("transform",xi.legend),Lg||(Oi.style("visibility","hidden"),si=xc(nf.data.targets)),Pi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Mi.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":ei).attr("transform",xi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ch&&Mi.append("g").attr("class",f.axisY).attr("clip-path",Pg?fi:"").attr("transform",xi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),lh&&Mi.append("g").attr("class",f.axisY2).attr("transform",xi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Mi.append("g").attr("clip-path",di).attr("class",f.grid),uh&&d.append("g").attr("class",f.xgrids),ne(wh)&&d.append("g").attr("class",f.xgridLines),Ch&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),xh&&d.append("g").attr("class",f.ygrids),ne(yh)&&d.append("g").attr("class",f.ygridLines),Mi.append("g").attr("clip-path",di).attr("class",f.regions),Mi.append("g").attr("clip-path",di).attr("class",f.chart),c=Mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",xi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Mi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Mi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ji).on("dblclick.zoom",null),ah&&Fi.extent("function"!=typeof ah?ah:ah(Zb())),Ig&&(Ni.append("g").attr("clip-path",di).attr("class",f.chart),Ni.select("."+f.chart).append("g").attr("class",f.chartBars),Ni.select("."+f.chart).append("g").attr("class",f.chartLines),Ni.append("g").attr("clip-path",di).attr("class",f.brush).call(Fi).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Ni.append("g").attr("class",f.axisX).attr("transform",xi.subx).attr("clip-path",Pg?"":ei)),Xe(nf.data.targets),Pg?Mi.select("."+f.axisX).style("opacity",0).call(eg):(Mi.select("."+f.axisY).style("opacity",0).call(fg),Mi.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Zh){if(gi&&"string"==typeof $h){for($h=ie($h),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,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 Pe(a){Yd(nf.data.targets)||xg&&(ji=a,Mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ki=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ki=!1,Hg())}function Re(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=Nd(),U=Yd(nf.data.targets),V=Dc(nf.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?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Ri=$f.domain(),uf&&Ji.scale($f).updateScaleExtent(),bg.domain($f.domain()),Fi.scale(bg)),F&&($f.domain(Fi.empty()?Ri:Fi.extent()),uf&&Ji.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Zg?Zg:Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Mi.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Mi.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Mi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F)if(Vg&&Q){for(R=1;R=0&&mf.select(this).style("display",b%S?"none":"block")})}else mf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Pi.style("display","none"),o(),Mi.select("line."+f.xgridFocus).style("visibility","hidden"),uh){if("year"===vh){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=$f.ticks(10);g=Mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(wh)&&(i=Mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(wh),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",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&xh&&(k=Mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(zh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(yh)&&(l=Mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(yh),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",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return oi(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Mi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Gi).style("opacity",1),Mi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Hi).style("opacity",Si),n=Mi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Bh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Mi.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=mf.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),Mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Mi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Fi.extent($f.orgDomain()).update(),z&&(Ni.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Fi.empty()||Fi.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Ni.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return oi(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ni.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ii).style("opacity",1))),Mi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Mi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Mi.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ii&&!hi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Mi.select("."+f.eventRects).datum(v?v.values:[]),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Mi.select("."+f.regions).selectAll("rect."+f.region).data(Uh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).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(),xc(nf.data.targets).forEach(function(a){Ti[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ji.altDomain?($f.domain(Ji.altDomain),void Ji.scale($f).updateScaleExtent()):(hi&&$f.orgDomain()[0]===Ri[0]&&$f.domain([Ri[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(li=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ki.attr("width",Jf).attr("height",Kf),Ki.select("#"+ai).select("rect").attr("width",Ff).attr("height",Hf),Ki.select("#"+bi).select("rect").attr("width",H),Ki.select("#"+ci).select("rect").attr("width",J),Ki.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(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(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return oi(a)}),e=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Si=+mf.select(this).style("opacity"),0}).style("fill",function(a){return oi(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return oi(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Mi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return oi(a.data)}).style("cursor",function(a){return zg(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),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),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"),Ig&&(n=Ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}),l=Ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)})),Ki.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.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=yi?j:i,l=yi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(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=yi?u:t,void(Og?(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,yi?(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=Oi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",yi?g:-200).attr("y",yi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",yi?h:-200).attr("y",yi?-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 oi(a)}).attr("x",yi?g:-200).attr("y",yi?-200:i).attr("width",10).attr("height",10),Oi.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Oi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Oi.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(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(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 lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,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=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","tick","values"],[]),$g=h(["axis","x","max"]),_g=h(["axis","x","min"]),ah=h(["axis","x","default"]),bh=h(["axis","x","label"],{}),ch=h(["axis","y","show"],!0),dh=h(["axis","y","max"]),eh=h(["axis","y","min"]),fh=h(["axis","y","center"]),gh=h(["axis","y","label"],{}),hh=h(["axis","y","inner"],!1),ih=h(["axis","y","tick","format"]),jh=h(["axis","y","padding"],{}),kh=h(["axis","y","ticks"],10),lh=h(["axis","y2","show"],!1),mh=h(["axis","y2","max"]),nh=h(["axis","y2","min"]),oh=h(["axis","y2","center"]),ph=h(["axis","y2","label"],{}),qh=h(["axis","y2","inner"],!1),rh=h(["axis","y2","tick","format"]),sh=h(["axis","y2","padding"],{}),th=h(["axis","y2","ticks"],10),uh=h(["grid","x","show"],!1),vh=h(["grid","x","type"],"tick"),wh=h(["grid","x","lines"],[]),xh=h(["grid","y","show"],!1),yh=h(["grid","y","lines"],[]),zh=h(["grid","y","ticks"],10),Ah=h(["point","show"],!0),Bh=Ah?h(["point","r"],2.5):0,Ch=h(["point","focus","line","enabled"],!0),Dh=h(["point","focus","expand","enabled"],!0),Eh=h(["point","focus","expand","r"],Dh?4:Bh),Fh=h(["point","focus","select","r"],8),Gh=h(["line","connect_null"],!1),Hh=h(["bar","width"]),Ih=h(["bar","width","ratio"],.6),Jh=h(["pie","label","show"],!0),Kh=h(["pie","label","format"]),Lh=h(["pie","onclick"],function(){}),Mh=h(["pie","onmouseover"],function(){}),Nh=h(["pie","onmouseout"],function(){}),Oh=h(["donut","label","show"],!0),Ph=h(["donut","label","format"]),Qh=h(["donut","title"],""),Rh=h(["donut","onclick"],function(){}),Sh=h(["donut","onmouseover"],function(){}),Th=h(["donut","onmouseout"],function(){}),Uh=h(["regions"],[]),Vh=h(["tooltip","show"],!0),Wh=h(["tooltip","format","title"]),Xh=h(["tooltip","format","value"]),Yh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Wh?Wh:b,l=Xh?Xh: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+""}),Zh=h(["tooltip","init","show"],!1),$h=h(["tooltip","init","x"],0),_h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ai=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",bi=ai+"-xaxis",ci=ai+"-yaxis",di=i(ai),ei=i(bi),fi=i(ci),gi="timeseries"===Qg,hi="categorized"===Qg,ii=!gi&&(ig||ne(jg)),ji=null,ki=!1,li=!1,mi=!1,ni=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],oi=he(wg,ne(Kg)?Kg:ni,vg),pi=Rg?mf.time.format:mf.time.format.utc,qi=function(){var a=[[pi("%Y/%-m/%-d"),function(){return!0}],[pi("%-m/%-d"),function(a){return a.getMonth()}],[pi("%-m/%-d"),function(a){return 1!==a.getDate()}],[pi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[pi("%I %p"),function(a){return a.getHours()}],[pi("%I:%M"),function(a){return a.getMinutes()}],[pi(":%S"),function(a){return a.getSeconds()}],[pi(".%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)}}(),ri=[],si=[],ti=Pg?"left":"bottom",ui=Pg?hh?"top":"bottom":hh?"right":"left",vi=Pg?qh?"bottom":"top":qh?"left":"right",wi=Pg?"left":"bottom",xi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},yi="right"===Mg,zi=0,Ai=0,Bi=0,Ci=30,Di=30,Ei=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fi,Gi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Gh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Gh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ii=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ji=function(){};Fi=mf.svg.brush().on("brush",Se),Fi.update=function(){return Ni&&Ni.select("."+f.brush).call(this),this},Fi.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ji=mf.behavior.zoom().on("zoomstart",function(){Ji.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ji.scale=function(a){return Pg?this.y(a):this.x(a)},Ji.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ji.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ki.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ki.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Fi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&hi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Mi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(wh=a,Re(),wh):wh},nf.xgrids.add=function(a){return a?nf.xgrids(wh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(wh.filter(b))},nf.ygrids=function(a){return a?(yh=a,Re(),yh):yh},nf.ygrids.add=function(a){return a?nf.ygrids(yh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(yh.filter(b))},nf.regions=function(a){return c(a)?Uh:(Uh=a,Re(),Uh)},nf.regions.add=function(a){return c(a)?Uh:(Uh=Uh.concat(a),Re(),Uh)},nf.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;Ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Uh=Uh.filter(function(b){return b.classes.indexOf(a)<0 +})}),Uh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Oi.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Oi.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Qi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file