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